I am trying to read some data of GPS from COM1 port. I have to show a message that the device is not connected if the gps device is not attached with the com port. I am using rxtxComm.jar, rxtxSerial.dll, gpsinput.jar in my project.
I am also facing problem from reading GPS data from com port.In my input stream no data is coming but the gps device is throughing data at the com port (I checked it by using hyper terminal).
code
Please refer to this.
How to send data to COM PORT using JAVA?
Related
Is there any way I can read hyper-terminal data in JAVA to display it in a desktop software.
I am using hyper-terminal with a weighing machine connected with a port COMM 3.
I am not able to get how to read the data from it and how to display it into a screen of desktop software.
normally you can read a hyper terminal like all other com Ports.
Same times you must send a specified symbol to the device. This you will find in
in the device data sheet.
Here is an example to read a com Port.
Com Port
I want to do a simple project where I send the phone's gyroscope data to a computer, where both are connected over Bluetooth. The receiving computer will be using C++, which I assume has its own Bluetooth communication protocols.
I have no idea how to get started - does anyone have sample code or tutorials for this? Preferably for both the client (phone) and the server (computer).
I think you should use the SPP BT profile to continuously sending data over bluetooth.
You can see a SPP link over BT as an normal RS232 serial cable.
Here are a sample code how to create an app (bluetooth chat) in android using the spp profile.
http://developer.android.com/guide/topics/connectivity/bluetooth.html
On the computer side, are you using windows?
If so, the bluetooth stack on computer will create an COM port for you with the SPP data from phone.
I haven't create any application that read and write from a COM port in windows but I guess it will be tutorials on the net.
First step could be to connect an Hyper terminal to that COM port and see that you can read data from it.
I'd like to intercept SMS messages from an Android phone connected to PC over USB. Java app on PC side.
Where should I start? Would it be apps on both sides? Or is there some PC-side lib for that?
I've only found tips for serial port access like SmsJ.
Background :
When you attach phone with USB cable, your computer creates a virtual COMM Port and a new port number is assign to it. You can see the port number detail in Device Manager List.
Development Part:
For the starting you can read the Java's Port reading example. Just study this example and you will be able to connect and send SMS from your android phone. It will allow to fire you command in Computer that will actually goes to attached Phone. For sending command to COMM Port you will be requiring AT Commands to Send SMS. Using AT Commands, you will also be able to read SMS and perform other functions on the phone.
You can also connect your phone through bluetooth, It will also assign same virtual COMM Port and you can do all functionality as well.
I have connected my nokia through data cable to USB port. I need a program in java to access the gsm module of my mobile and send text messages.
which API i need to use for it? communication need to be taken place through USB port.
Thanks & Regards,
Sri
You can use smslib. It is a very reliable solution. It supports GSM phones and GSM modems connected via serial port interfaces or IP interfaces.
Look here for more.
Have a look at Kannel. It is not a Java application, BTW.
Java API for Kannel
An Example
Sending SMS with SMPP, Kannel and Java
The phone needs to be hooked up via a serial port for RS-232. Using either a USB data cable or a USB-to-RS232 adapter and a serial data cable.
Use Java Communications API to connect to the Phone.
Then use the AT command to send and receive SMS messages. There is and example here. It is not specific to Nokia, but it is pretty much a standard command set.
I am using rxtx api to read data from a GPS device over a com port. Right now I'm finding the correct com port by reading a config file and looking for the port listed. The problem that I'm having is that if the device is unplugged the com port could change then the user has to know to change the config file. I wrote an app similar to this in c# and was able to list the windows device name instead of the com port and I cycled through the com ports until the device name matched the name in the config file. Using that method nothing in the config file has to change even if the com port being used changes. Is there a way to do that with the rxtx api?
Thanks in advance!
If anyone is interested...
I created a windows service in C# that monitors a socket. If a client connects to that socket the service gathers port name, and device id that is on that port and sends the data in a string over the com port the client can then parse apart the string to get the data it needs.
In my case the string being passed is:
"ACPI\PNP0501 *PNP0501 ,COM1 ,PCI\VEN_8086&DEV_29B7&SUBSYS_02111028&REV_02 PCI\VEN_8086&DEV_29B7&SUBSYS_02111028 PCI\VEN_8086&DEV_29B7&CC_070002 PCI\VEN_8086&DEV_29B7&CC_0700 ,COM3 ,USB\Vid_067b&Pid_2303&Rev_0400 USB\Vid_067b&Pid_2303 ,COM5"
When I parse it I can see that ACPI\PNP0501 *PNP0501 is the device id for COM 1, there are three device id's for COM3, and two device ids on COM5.
This may not be the best way to handle this but it is good enough for my needs and it saved me from JNI. :)
CommPortIdentifier.getPortIdentifiers lists all ports in the system that are usable by the Javacomm API. Iterate through them to find the port your device is connected to.
If you want to get the name associated with the device on the COM port (particularly if a driver is installed to provide it), you'll have to do so with a smidge of the dreaded Java->Native Interface to talk to the Windows APIs that gather this information. C# is nice, in that this information is gathered and provided to you, but in Java you have to go this extra step.
Windows Function Discovery may prove useful. I'm not certain exactly what API provides this functionality.