1

EDITED:

Im developing SMS application in java for reading SMS.Im sending AT commands to GSM mode for sending an SMS,messages is sending successfully ,but im not getting any response from the modem.If i send the AT commands through Hyperterminal im getting the response.Whats the exact problem?

            InputStream inputStream;
            OutputStream out;


            this.inputStream = serialPort.getInputStream();
            this.out = serialPort.getOutputStream();
            out.write(("AT"+"\r").getBytes());
            try {
                Thread.sleep(1500);
            } catch (InterruptedException ex) {
                Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            out.write(("AT+CMGF=1"+"\r").getBytes());
            try {
                Thread.sleep(1500);
            } catch (InterruptedException ex) {
                Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            out.write(("AT+CMGS=\""+"+91xxxxxxxxxx"+"\""+"\r").getBytes());
            try {
                Thread.sleep(1500);
            } catch (InterruptedException ex) {
                Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            out.write(("TEST "+cntrlZ).getBytes());
            try {
                Thread.sleep(1500);
            } catch (InterruptedException ex) {
                Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
            }


 //Im using SerialPortEventListener to  read the input from modem
int a = inputStream.available();
System.out.println(inputStream.available() + "  BYTES AVAILABLE ");
inputStream.read(readBuffer, 0, a);

I also tried to read after sending each AT commands,but im not getting anything as a response from the modem.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
Mukthi
  • 561
  • 4
  • 13
  • 35

2 Answers2

2

Issues receving in RXTX

After setting the flow control for the serial port its working fine.

serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN |    SerialPort.FLOWCONTROL_RTSCTS_OUT);
Community
  • 1
  • 1
Mukthi
  • 561
  • 4
  • 13
  • 35
  • i am also working same application but not able to send message as i have getting port number successfully...plz help me to solve my problem... – Aniket Mar 18 '13 at 16:27
0

Please make sure that you have installed all libraries required by SMSlib and your modem is on supported modems list. Having supported modem is not required, but can eliminate compatibility problem right off the bat.

Also you should verify if your modem is connected properly. You could perform some operations on it directly, via AT commands.

ŁukaszBachman
  • 33,595
  • 11
  • 64
  • 74