0 Replies Latest reply: Jun 1, 2012 8:10 AM by 927582 RSS

    AT commands appearing in sent message

    927582
      Hi guys,

      I am using AT commands to send SMS from my computer using a java program.
      When I send a message, the recipient receives the message but with additional AT commands embedded that were used on my side to send the message.
      What do I need to do in order to ensure that only the message is sent and no additional AT commands go along.
      This is the code segment that i use to send the message
                      gsm.connect();
                      //gsm.enableExtendedCommands();
                      gsm.checkStatus();
                      //Thread.sleep(5000);
                      Thread.sleep(5000);
                      //gsm.flush();
                      //Put the GSM modem/phone in text mode
                      gsm.send("AT+CMGF=1\r\n");
                      //out.flush();
                      //Enable extended error codes
                      gsm.send("AT+CMEE=1\r\n");
                      //out.flush();
                      //Clear the outputstream of any characters unwanted in SMS to be sent
                      //gsm.flush();
                      //Send SMS
                      gsm.send("AT+CMGS=\"" + phoneNumber + "\"\r\n");
                      //gsm.flush();
                      //Add a whitespace character
                      gsm.send(message + '\032');
                      //gsm.sendSmsMessage(message, phoneNumber);
                      //Thread.sleep(200);
                      Thread.sleep(2000);
                      gsm.hangup();
                      gsm.serialPort.close();
      The send() method is as follows
          public void send(String cmd) {
              try {            
                  outputStream.write(cmd.getBytes());
                  
              } catch (IOException ioException) {
                  ioException.printStackTrace();
              }
          }