com.objectxp.msg
Class AtReply

java.lang.Object
  extended by com.objectxp.msg.AtReply

public class AtReply
extends java.lang.Object

This class represents a reply received from a Modem after sending an AT command.

Since:
jSMS 1.8.2
See Also:
GsmSmsService.sendATCommand(String)

Method Summary
 int getCmsCode()
          Returns the Message Service Failure Result Code (+CMS ERROR) if available or 0 if no CMS code is present.
 java.lang.String getCmsText()
          Returns a text-representation of the Message Service Failure Result Code or null if no CMS error code is present.
 java.lang.String getReply()
          Returns the modem reply text.
 java.io.BufferedReader getReplyReader()
          Returns a BufferedReader for the modem answer.
 boolean isError()
          Returns true if the reply indicates an error (the Modem replied with either "ERROR" or "+CMS ERROR").
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isError

public boolean isError()
Returns true if the reply indicates an error (the Modem replied with either "ERROR" or "+CMS ERROR").


getReply

public java.lang.String getReply()
Returns the modem reply text.

The reply text never contains the status (e.g. "OK" or "ERROR"). If the modem reply contains multiple lines, the string returned contains newline characters ('\n'). If the modem replies with "OK" or "ERROR" only, getReply() returns null. Local echoing by the modem will be filtered out.

Let's assume that the modem replied to the command "AT+CGSN" with the following data (local echo is enabled):
 AT+CGSN<cr><lf>
 123456789012345<lf>
 OK<lf>
 
For the reply above, getReply() will return the String "123456789012345".


getReplyReader

public java.io.BufferedReader getReplyReader()
Returns a BufferedReader for the modem answer. The reader can be used to read answers constisting of multiple lines.


getCmsCode

public int getCmsCode()
Returns the Message Service Failure Result Code (+CMS ERROR) if available or 0 if no CMS code is present. Have a look at the GSM 03.40, 04.11 and 07.05 specifications for more information about the possible failure codes.

Returns:
int the Message Service Failure Code or 0 if the modem didn't provide a CMS error code.

getCmsText

public java.lang.String getCmsText()
Returns a text-representation of the Message Service Failure Result Code or null if no CMS error code is present.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


object XP, Inc. © 2000-2008. All rights reserved object XP