Hi everyone. I'm trying to build a java program using RXTX java library to send AT-Commands to my bluetooth modem(quectel m66) from my windows PC. I am using Eclipse JAVA programming software in my windows PC.
I've looked up through google, but cant seem to find a working example which I can use as a reference.
What I'm trying to do for my project is to able to send a AT command using RXTX java library from my windows PC to a bluetooth modem(quectel m66) and received the response from modem and vice versa. At this point, I've already found the AT-Commands. However, I'm only able to run the commands through putty serial terminal.
How can do java program send AT command from eclipse software in my PC to the bluetooth modem and received the replay from the modem.
As I recall from many years ago, the RXTX product is designed so that Java code can communicate with serial ports. But now that computers don't come with serial ports in their hardware any more, it probably doesn't get much use.
Anyway the point is that it communicates with serial ports. So your Bluetooth modem would have to look like a serial port for RXTX to be able to find it. Maybe there's some configuration which needs to be done?
Edit: It looks like I assumed that your Java code plus RXTX can't find the Bluetooth modem. But now that I reread your post I see that you didn't actually describe your problem. Perhaps I assumed wrong?
The most popular way to do Bluetooth these days is via a USB dongle (although I have some direct-wire devices for working with Arduino-style controllers).
That's assuming that you don't have Bluetooth build into the hardware, as many laptops and Raspberry Pi systems do.
Bluetooth control via "AT" commands tells me, however, that you're using USB. And your OS should automatically register the USB dongle as a "serial device". So no problem there. You just open it the same way you would a COM port (or in Linux, /dev/ttyUSBx) and in theory you're good to go.
Alas, in real life, serial programming can be very frustrating, because modern-day serial interfaces don't just jam stuff out via a UART, they have automatic handling of line endings, flow control characters, and that most aggravating characteristic at all: buffering.
So in some cases you have to adjust hardware parameters (stty). And in languages like Java, you'll probably have to forcibly flush buffers. Unless you use a PrintWriter, which is supposed to flush the buffer automatically every time you do a println().
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Although Paul, Jim and Tim wanted to help, all needed informations are already posted by OP: Using RxTx to use a virtual COM with Java. Also an additional very helpful information was given: It works with Putty. TLDR: It's not an issue the system can't communicate with the device but rather the Java code used to "open" the COM port and/or for transmitting / receiving data has issues: Either the port is opened with wrong parameters (baud rate, parity, stop-bits, flow control) or passing data into or retreiving data from the maybe correct opened port doesn't work as it need to.
It all comes down to: We need code to see what you're doin to try to help spot what's maybe wrong.