GSM modem, javacomm, AT commands

Hi

I have been trying to develop a program to be used to make a connection to GSM modem via COM1-port. From there, I need to be able to read received SMS messages. I have AT commands needed to do that, and I have tested them in hyperterminal. I have installed javaComm.

My problem is that I don't know HOW am I supposed to send AT commands to modem, and how to receive answer. I have looked at these examples:

http://java.sun.com/developer/releases/javacomm/SimpleRead.java

http://java.sun.com/developer/releases/javacomm/SimpleWrite.java

in which (simplewrite) I have tried to replace String value of "Hello World!" to AT command, which did not have desired effect (modem did not act like it should when command is received). I need some help here to succesfully send AT command to modem, and to receive the answer.

Thanks for your time.

[883 byte] By [Akulaaria] at [2007-11-27 9:07:07]
# 1
I think you'll be after the JTAPI. I'm sure you can work out what that stands for!
georgemca at 2007-7-12 21:43:26 > top of Java-index,Java Essentials,Java Programming...
# 2

Actually I made it without JTAPI. I just had to add /r in string of AT command, which was to be sent to modem. Anyway. Using these two example codes mentioned above, and connecting them into one, I managed to get a program which sends AT command to modem and receives the answer.

However the answer is not quite what I expected, because usually it is only a few letters (for example OK or CPIN ) with strange long spaces between some letters. I'm using baud rate of 115200 to communicate with modem.

Akulaaria at 2007-7-12 21:43:26 > top of Java-index,Java Essentials,Java Programming...
# 3
Problem solved, no help needed. =)
Akulaaria at 2007-7-12 21:43:26 > top of Java-index,Java Essentials,Java Programming...
# 4

More problems came on my way on finishing my program. Situation:

I have 2 threads, one to send AT command to modem thru serial port and one for listening the answer using same port. Problem is, that I just can't get the answer from the modem. AT commands sent to the modem works fine, but no answer is received.

Source code:

http://mureakuha.com/paste/?9b6a28d4ee7e683ec98089f5cbc977f8

Thank you in advance.

Akulaaria at 2007-7-12 21:43:26 > top of Java-index,Java Essentials,Java Programming...
# 5
Problem solved! Closing the port in both threads after functionality caused modem's reply to disappear.
Akulaaria at 2007-7-12 21:43:26 > top of Java-index,Java Essentials,Java Programming...