I wish to connect 10 usb modems to a windows/linux pc and send AT comments to them to send sms and receive sms from them. Is this possible in Java?
I think it is possible. You just have to know the COMM port ID for each modem. I do not know pure java way to discover these IDs. So, you need some platform specific way (e.g. WMI on windows or some command on Unix). But once you have ID it should not be a problem.
Assuming the USB modem implements a serial interface, it should get a COMM port id. If so, you can use RXTX to talk to the model.
afaik, you can use serial communication while talking to usb devices as long as device hardware contains an ftdi chip or so. I used a c++ serial lib in a Qt project, talking to an Arduino connected on a usb port. arduino appears as a com device.
otherwise, you may look at the jusb project: http://www.ibm.com/developerworks/library/j-usb/index.html
Related
Scenario : 1
Suppose there are two phones A and B. phone B sends a message to phone A. Phone A has that message in its inbox. Both the phones are nokia multimedia phones that can be connected with my laptop via nokia pc-suite.They can also be connected via Bluetooth with my HP laptop.
Scenario : 2
A valid sim card of my local operator is inserted into a modem and the modem is connected with my laptop. I can read messages sent in that number(sim) by using the software provided with the modem.
Question:
The received text message will be the input of my java program. How can I read that message with my java program. Solution for any of the two scenarios will solve my problem.
It would be very helpful for me if someone provide me some resources regarding this issue. I am interested to implement it by java but it would be also helpful if the resources are not in java platform but relevant to my task.
You can connect GSM modem built in Mobile Phone via bluetooth or RF232 connection, then send AT Commands. Pure java conenction functions should not be enough to make it possible. So you can use low level API coded by C programming language then connect it with Java applicatio via JNI.
I need to communicate with a device with a rs232 out put,but my laptop doesn't
have a rs232 port,then i bought a rs232 to USB converter and now i want to listen on the
usb port for data,can i use jssc to achive this. ???
I know this is months old, but I see no answers. The answer is yes.
You can test your cable by going to the JSSC google code project page and access the Wiki tab's JSSCTerminal link. It's a Java Applet Terminal program that allows you to connect a device via your cable, set port, speed, stop bits, etc., and then send commands and receive data.
I am successfully using JSSC to write Java programs to download data from Blood Glucose Meters and GPS trackers to my Linux and Windows 7 desktops and my Windows 7 laptop. My serial-to-USB cable uses an older Prolific chipset. The FTDI chipset should work too.
Once the appropriate drivers are loaded in your OS the OS sees the connected cable as a COM port in Windows and usually as the serial device /dev/ttyUSB0 in Linux/Mac. At this point you can use any Terminal/Comm program or library to interact with them including JSSC. You can download and run the examples unchanged from the JSSC project.
this lib is used by arduino ide on that purpose https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Serial.java
I want to read sms from sim which is connected to my laptop by dongle(USB connector) using java code, I know that I have to use AT commands but I don't know which commands and how ???
If you are using Windows 7 and a reasonably new modem, you don't have to use AT commands. You can use the Windows Mobile Broadband API (it is available from Win 7 onwards).
It includes interface functions for SMS.
You need to enable a serial data connection via the USB connector to your GSM device/phone.
You will also need some type of terminal emulation software to connect and communicate to your phone.
You did not say what Operating system/Hardware you were trying to do this from, or what model of phone, this can affect the AT command set you need to use to access the SMS info, so I can't be more specific.
I have done this a few years ago using a bluetooth connection to a Motorola Razor from a mac Laptop, using a small Realbasic program to send and recieve SMS messages as a proof of concept for sending server monitoring messages to IT staff via sms. You can google the AT for GSM command set.
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.