public class SmsMessage extends SmsMessageBase
Modifier and Type | Class and Description |
---|---|
static class |
SmsMessage.SubmitPdu |
SmsMessageBase.SubmitPduBase
mEmailBody, mEmailFrom, mIndexOnIcc, mIsEmail, mIsMwi, mMessageBody, mMessageRef, mMwiDontStore, mMwiSense, mOriginatingAddress, mPdu, mPseudoSubject, mScAddress, mScTimeMillis, mStatusOnIcc, mUserData, mUserDataHeader
Constructor and Description |
---|
SmsMessage() |
Modifier and Type | Method and Description |
---|---|
static GsmAlphabet.TextEncodingDetails |
calculateLength(CharSequence msgBody,
boolean use7bitOnly)
Calculates the number of SMS's required to encode the message body and
the number of characters remaining until the next message.
|
static SmsMessage |
createFromEfRecord(int index,
byte[] data)
Create an SmsMessage from an SMS EF record.
|
static SmsMessage |
createFromPdu(byte[] pdu)
Create an SmsMessage from a raw PDU.
|
SmsConstants.MessageClass |
getMessageClass()
Returns the class of this message.
|
int |
getNumOfVoicemails() |
int |
getProtocolIdentifier()
Get protocol identifier.
|
int |
getStatus()
For an SMS-STATUS-REPORT message, this returns the status field from
the status report.
|
static SmsMessage.SubmitPdu |
getSubmitPdu(String scAddress,
String destinationAddress,
int destinationPort,
byte[] data,
boolean statusReportRequested)
Get an SMS-SUBMIT PDU for a data message to a destination address & port
|
static SmsMessage.SubmitPdu |
getSubmitPdu(String scAddress,
String destinationAddress,
String message,
boolean statusReportRequested)
Get an SMS-SUBMIT PDU for a destination address and a message
|
static SmsMessage.SubmitPdu |
getSubmitPdu(String scAddress,
String destinationAddress,
String message,
boolean statusReportRequested,
byte[] header)
Get an SMS-SUBMIT PDU for a destination address and a message
|
static SmsMessage.SubmitPdu |
getSubmitPdu(String scAddress,
String destinationAddress,
String message,
boolean statusReportRequested,
byte[] header,
int encoding,
int languageTable,
int languageShiftTable)
Get an SMS-SUBMIT PDU for a destination address and a message using the
specified encoding.
|
static int |
getTPLayerLengthForPDU(String pdu)
Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the
length in bytes (not hex chars) less the SMSC header
|
boolean |
isCphsMwiMessage()
Returns true for CPHS MWI toggle message.
|
boolean |
isMWIClearMessage()
returns true if this message is a CPHS voicemail / message waiting
indicator (MWI) clear message
|
boolean |
isMwiDontStore()
returns true if this message is a "Message Waiting Indication Group:
Discard Message" notification and should not be stored.
|
boolean |
isMWISetMessage()
returns true if this message is a CPHS voicemail / message waiting
indicator (MWI) set message
|
boolean |
isReplace()
See TS 23.040 9.2.3.9 returns true if this is a "replace short message"
SMS
|
boolean |
isReplyPathPresent()
Returns true iff the
TP-Reply-Path bit is set in
this message. |
boolean |
isStatusReportMessage()
Return true iff the message is a SMS-STATUS-REPORT message.
|
boolean |
isTypeZero()
3GPP TS 23.040 9.2.3.9 specifies that Type Zero messages are indicated
by TP_PID field set to value 0x40
|
static SmsMessage |
newFromCDS(String line) |
static SmsMessage |
newFromCMT(String[] lines)
TS 27.005 3.4.1 lines[0] and lines[1] are the two lines read from the
+CMT unsolicited response (PDU mode, of course)
+CMT: [<alpha>],
|
calcUnicodeEncodingDetails, extractEmailAddressFromMessageBody, findNextUnicodePosition, getDisplayMessageBody, getDisplayOriginatingAddress, getEmailBody, getEmailFrom, getIndexOnIcc, getMessageBody, getOriginatingAddress, getPdu, getPseudoSubject, getServiceCenterAddress, getStatusOnIcc, getTimestampMillis, getUserData, getUserDataHeader, isEmail, parseMessageBody
public static SmsMessage createFromPdu(byte[] pdu)
public boolean isTypeZero()
public static SmsMessage newFromCMT(String[] lines)
public static SmsMessage newFromCDS(String line)
public static SmsMessage createFromEfRecord(int index, byte[] data)
index
- Index of SMS record. This should be index in ArrayList
returned by SmsManager.getAllMessagesFromSim + 1.data
- Record data.public static int getTPLayerLengthForPDU(String pdu)
public static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested, byte[] header)
scAddress
- Service Centre address. Null means use default.SubmitPdu
containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.public static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested, byte[] header, int encoding, int languageTable, int languageShiftTable)
scAddress
- Service Centre address. Null means use default.encoding
- Encoding defined by constants in
com.android.internal.telephony.SmsConstants.ENCODING_*languageTable
- languageShiftTable
- SubmitPdu
containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.public static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested)
scAddress
- Service Centre address. Null means use default.SubmitPdu
containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.public static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, int destinationPort, byte[] data, boolean statusReportRequested)
scAddress
- Service Centre address. null == use defaultdestinationAddress
- the address of the destination for the messagedestinationPort
- the port to deliver the message to at the
destinationdata
- the data for the messageSubmitPdu
containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.public static GsmAlphabet.TextEncodingDetails calculateLength(CharSequence msgBody, boolean use7bitOnly)
msgBody
- the message to encodeuse7bitOnly
- ignore (but still count) illegal characters if truepublic int getProtocolIdentifier()
getProtocolIdentifier
in class SmsMessageBase
public boolean isReplace()
isReplace
in class SmsMessageBase
public boolean isCphsMwiMessage()
isCphsMwiMessage
in class SmsMessageBase
public boolean isMWIClearMessage()
isMWIClearMessage
in class SmsMessageBase
public boolean isMWISetMessage()
isMWISetMessage
in class SmsMessageBase
public boolean isMwiDontStore()
isMwiDontStore
in class SmsMessageBase
public int getStatus()
getStatus
in class SmsMessageBase
public boolean isStatusReportMessage()
isStatusReportMessage
in class SmsMessageBase
public boolean isReplyPathPresent()
TP-Reply-Path
bit is set in
this message.isReplyPathPresent
in class SmsMessageBase
public SmsConstants.MessageClass getMessageClass()
getMessageClass
in class SmsMessageBase
public int getNumOfVoicemails()