net.rim.device.api.system
Class SMSPacketHeader

java.lang.Object
  |
  +--net.rim.device.api.system.SMSParameters
        |
        +--net.rim.device.api.system.SMSPacketHeader
All Implemented Interfaces:
RadioPacketHeader

public final class SMSPacketHeader
extends SMSParameters
implements RadioPacketHeader

A RadioPacketHeader for sending SMS packets. See GSM 03.40 for details.

Since:
JDE 4.0.0

Field Summary
static String[] INDICATOR_TYPE_NAMES
           
static int RECORD_STATUS_MS_ORIGINATED
           
static int RECORD_STATUS_REPORT_RECEIVED
           
static int RECORD_STATUS_REPORT_REQUESTED
           
static int RECORD_STATUS_UNREAD
           
static int SMS_ID_NOT_ON_SIM
           
static int WAITING_INDICATOR_TYPE_EMAIL
          Represents the email wait indicator.
static int WAITING_INDICATOR_TYPE_FAX
          Represents the fax wait indicator.
static int WAITING_INDICATOR_TYPE_OTHER
          Represents an "other" wait indicator.
static int WAITING_INDICATOR_TYPE_VOICEMAIL
          Represents the voicemail waiting indicator.
 
Fields inherited from class net.rim.device.api.system.SMSParameters
LANGUAGE_CHINESE, LANGUAGE_ENGLISH, LANGUAGE_FRENCH, LANGUAGE_HEBREW, LANGUAGE_JAPANESE, LANGUAGE_KOREAN, LANGUAGE_NONE, LANGUAGE_SPANISH, LANGUAGE_UNSPECIFIED, MESSAGE_CLASS_0, MESSAGE_CLASS_1, MESSAGE_CLASS_2, MESSAGE_CLASS_3, MESSAGE_CLASS_NOT_GIVEN, MESSAGE_CODING_8_BIT, MESSAGE_CODING_ASCII, MESSAGE_CODING_DEFAULT, MESSAGE_CODING_ISO8859_1, MESSAGE_CODING_KOREAN_KSX1001, MESSAGE_CODING_UCS2, NUM_ABBREVIATED, NUM_ALPHANUMERIC, NUM_EMAIL, NUM_INTERNATIONAL, NUM_NATIONAL, NUM_NETWORK_SPEC, NUM_RESERVED, NUM_SUBSCRIBER, NUM_UNKNOWN, PERIOD_IMMEDIATE, PERIOD_INDEFINITE, PERIOD_TILL_ACTIVE, PERIOD_TILL_AREA, PLAN_DATA, PLAN_ERMES, PLAN_ISDN, PLAN_NATIONAL, PLAN_PRIVATE, PLAN_RESERVED, PLAN_TELEX, PLAN_UNKNOWN, PRIORITY_EMERGENCY, PRIORITY_INTERACTIVE, PRIORITY_NONE, PRIORITY_NORMAL, PRIORITY_URGENT, PRIVACY_CONFIDENTIAL, PRIVACY_NONE, PRIVACY_NORMAL, PRIVACY_RESTRICTED, PRIVACY_SECRET, PROTOCOL_ID_CSPDN_TELETEX, PROTOCOL_ID_DEPERSONALIZATION_SM, PROTOCOL_ID_ERMES, PROTOCOL_ID_GRP3_FAX, PROTOCOL_ID_GRP4_FAX, PROTOCOL_ID_GSM_MS, PROTOCOL_ID_IMPLICIT, PROTOCOL_ID_INTERNET_EMAIL, PROTOCOL_ID_ISDN_TELETEX, PROTOCOL_ID_MSG_HANDLING, PROTOCOL_ID_NAT_PAGING, PROTOCOL_ID_PSPDN_TELETEX, PROTOCOL_ID_PSTN_TELETEX, PROTOCOL_ID_REPLACE_SM_TYPE1, PROTOCOL_ID_REPLACE_SM_TYPE2, PROTOCOL_ID_REPLACE_SM_TYPE3, PROTOCOL_ID_REPLACE_SM_TYPE4, PROTOCOL_ID_REPLACE_SM_TYPE5, PROTOCOL_ID_REPLACE_SM_TYPE6, PROTOCOL_ID_REPLACE_SM_TYPE7, PROTOCOL_ID_RETURN_CALL_MSG, PROTOCOL_ID_SC_SPECIFIC_1, PROTOCOL_ID_SC_SPECIFIC_2, PROTOCOL_ID_SC_SPECIFIC_3, PROTOCOL_ID_SC_SPECIFIC_4, PROTOCOL_ID_SC_SPECIFIC_5, PROTOCOL_ID_SC_SPECIFIC_6, PROTOCOL_ID_SC_SPECIFIC_7, PROTOCOL_ID_SIM_DATA_DOWNLOAD, PROTOCOL_ID_SM_TYPE0, PROTOCOL_ID_TELEX, PROTOCOL_ID_UCI, PROTOCOL_ID_UNSPEC_TELETEX, PROTOCOL_ID_VIDEOTEX, PROTOCOL_ID_VOICE, PROTOCOL_ID_X400, PROTOCOL_MEANING_RAW_DATA, PROTOCOL_MEANING_RESERVED, PROTOCOL_MEANING_SC_SPECIFIC, PROTOCOL_MEANING_SM_AL_PROTOCOL, PROTOCOL_MEANING_SM_FUNCTIONS, PROTOCOL_MEANING_TELEMATIC_INTERWORK
 
Constructor Summary
SMSPacketHeader()
          Constructs a new SMSPacketHeader.
 
Method Summary
static int getBitsPerCharacter(int messageCoding)
          Returns the number of bits required per character for the specified encoding type.
static int getBitsPerSegment(int messageCoding)
          Get the number of bits which can fit into a segment.
static int getBitsPerSegment(int messageCoding, int wmaUDHLength)
          Get the number of bits which can fit into a segment.
static int getBytesPerCharacter(int messageCoding)
          Returns the number of bytes consumed per character for the specified encoding type.
static int getCharacters(int segments, int messageCoding)
          Returns the number of characters which can fit into the specified number of segments using the specified encoding type.
 int getID()
          Returns the SIM ID for this message.
 int getMessageWaitingType()
          Returns this message's MWI Group type.
 int getNumMessages()
          Returns the number of messages waiting.
 int getRecordStatus()
          Returns the record status for this message.
static int getSegments(int characters, int messageCoding)
          Returns the number of segments required for the specified number of characters and encoding type.
static int getSegments(int characters, int messageCoding, int udhLength)
          Returns the number of segments required for the specified number of characters and encoding type.
 boolean getStatusReportRequest()
          Returns the status report request.
 long getTimestamp()
          Returns the timestamp for this message.
 boolean isDeliveryPeriodDefault()
          Returns a boolean indicating whether or not the delivery period is set to the default amount of time.
 boolean isFromSIMCard()
          Determines if this message originated from the device SIM card.
 boolean isMessageWaitingActive()
          Determines if this message's MWI Group is "Active".
 boolean isMessageWaitingGroup()
          Determines if this message is part of the Message Waiting Indication Group.
 boolean isMessageWaitingStore()
          Determines if this message's MWI Group is "Store Message".
 boolean isReplyPath()
          Determines if this message specifies the reply path to use.
static boolean isSegmentationSupported()
          Returns true if composition of fragmented SMS messages is supported.
static boolean isSendSupported()
           
 boolean isUserDataHeaderPresent()
          Returns a boolean indicating whether or not a user data header is present.
 boolean isValidityPeriodDefault()
           
 void reset()
          Resets the contents of this header.
 void setDeliveryPeriod(int deliveryPeriod)
          Sets the delivery period for the message.
 void setMessageClass(int messageClass)
          Sets the message class.
 void setMessageCoding(int messageCoding)
          Sets the message coding.
 void setMessageWaitingType(int waitingIndType)
          Sets this message's MWI Group type.
 void setNumMessages(int numMessages)
          Sets the number of messages waiting.
 void setProtocolId(int protocolMeaning, int protocolId)
          Sets the protocol meaning and ID.
 void setStatusReportRequest(boolean statusReportRequest)
          Sets the status report request for the message.
 void setUserDataHeaderPresent(boolean userDataHeaderPresent)
          Sets the user data header present for the message.
 void setValidityPeriod(int validityPeriod)
          Sets the validity period for the message.
static boolean validateForASCIIMessageCoding(char c)
          Validate the given character against the ASCII encoding.
static boolean validateForDefaultMessageCoding(char c)
          Validate the given character against the default encoding.
static boolean validateForISO8859MessageCoding(char c)
          Validate the given character against the ISO8859 encoding.
static boolean validateForMessageCoding(char c, int messageCoding)
          Determines if the specified character is valid for the given encoding type.
static boolean validateForUCS2MessageCoding(char c)
          Validate the given character against the UCS2 encoding.
 
Methods inherited from class net.rim.device.api.system.SMSParameters
getCallbackAddress, getCallbackPlan, getCallbackType, getDeliveryPeriod, getLanguage, getMessageClass, getMessageCoding, getPeerAddress, getPeerPlan, getPeerType, getPriority, getPrivacy, getProtocolId, getProtocolMeaning, getSCAddress, getSCPlan, getSCType, getValidityPeriod, setCallbackAddress, setCallbackAddress, setLanguage, setPeerAddress, setPeerAddress, setPriority, setPrivacy, setProtocolId, setProtocolMeaning, setSCAddress, setSCAddress
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDICATOR_TYPE_NAMES

public static final String[] INDICATOR_TYPE_NAMES
Since:
JDE 4.0.0

RECORD_STATUS_MS_ORIGINATED

public static final int RECORD_STATUS_MS_ORIGINATED
Since:
JDE 4.0.0

RECORD_STATUS_REPORT_RECEIVED

public static final int RECORD_STATUS_REPORT_RECEIVED
Since:
JDE 4.0.0

RECORD_STATUS_REPORT_REQUESTED

public static final int RECORD_STATUS_REPORT_REQUESTED
Since:
JDE 4.0.0

RECORD_STATUS_UNREAD

public static final int RECORD_STATUS_UNREAD
Since:
JDE 4.0.0

SMS_ID_NOT_ON_SIM

public static final int SMS_ID_NOT_ON_SIM
Since:
JDE 4.0.0

WAITING_INDICATOR_TYPE_EMAIL

public static final int WAITING_INDICATOR_TYPE_EMAIL
Represents the email wait indicator.

Indicates that an email is waiting.

Since:
JDE 4.0.0

WAITING_INDICATOR_TYPE_FAX

public static final int WAITING_INDICATOR_TYPE_FAX
Represents the fax wait indicator.

Indicates that a fax is waiting.

Since:
JDE 4.0.0

WAITING_INDICATOR_TYPE_OTHER

public static final int WAITING_INDICATOR_TYPE_OTHER
Represents an "other" wait indicator.
Since:
JDE 4.0.0

WAITING_INDICATOR_TYPE_VOICEMAIL

public static final int WAITING_INDICATOR_TYPE_VOICEMAIL
Represents the voicemail waiting indicator.

Indicates that a voicemail is waiting.

Since:
JDE 4.0.0
Constructor Detail

SMSPacketHeader

public SMSPacketHeader()
Constructs a new SMSPacketHeader.
Since:
JDE 4.0.0
Method Detail

getBitsPerCharacter

public static int getBitsPerCharacter(int messageCoding)
Returns the number of bits required per character for the specified encoding type.

Parameters:
messageCoding - The encoding type.
Returns:
The number of bits per character required.
Since:
JDE 4.0.0

getBitsPerSegment

public static int getBitsPerSegment(int messageCoding)
Get the number of bits which can fit into a segment.
Since:
JDE 4.0.0

getBitsPerSegment

public static int getBitsPerSegment(int messageCoding,
                                    int wmaUDHLength)
Get the number of bits which can fit into a segment.
Since:
JDE 4.1.0

getBytesPerCharacter

public static int getBytesPerCharacter(int messageCoding)
Returns the number of bytes consumed per character for the specified encoding type.

Parameters:
messageCoding - The encoding type.
Returns:
The number of bytes consumed per character.
Since:
JDE 4.0.0

getCharacters

public static int getCharacters(int segments,
                                int messageCoding)
Returns the number of characters which can fit into the specified number of segments using the specified encoding type.
Parameters:
segments - The number of segments.
messageCoding - The encoding type.
Returns:
The number of characters.
Since:
JDE 4.0.0

getID

public int getID()
Returns the SIM ID for this message.

Returns:
The SIM ID for this message, or SMS_ID_NOT_ON_SIM if the message is not stored on the SIM.
Since:
JDE 4.0.0

getMessageWaitingType

public int getMessageWaitingType()
Returns this message's MWI Group type.

Returns:
This message's MWI Group type.
Since:
JDE 4.0.0

getNumMessages

public int getNumMessages()
Returns the number of messages waiting.

Returns:
The number of messages waiting.
Since:
JDE 4.0.0

getRecordStatus

public int getRecordStatus()
Returns the record status for this message.

Returns:
A combination of the RECORD_STATUS_ values.
Since:
JDE 4.0.0

getSegments

public static int getSegments(int characters,
                              int messageCoding)
Returns the number of segments required for the specified number of characters and encoding type.

NOTE:The value returned by this method is an approximation and does not take esacped characters into account. As such it should not be used to build packets to be sent over the wire, however it is fine for ui purposes.

Parameters:
characters - The number of characters.
messageCoding - The encoding type.
Returns:
The number of segments required.
Since:
JDE 4.0.0

getSegments

public static int getSegments(int characters,
                              int messageCoding,
                              int udhLength)
Returns the number of segments required for the specified number of characters and encoding type.

NOTE:The value returned by this method is an approximation and does not take esacped characters into account. As such it should not be used to build packets to be sent over the wire, however it is fine for ui purposes.

Parameters:
characters - The number of characters.
messageCoding - The encoding type.
udhLength - The number of bytes required by user defined data
Returns:
The number of segments required.
Since:
JDE 4.0.0

getStatusReportRequest

public boolean getStatusReportRequest()
Returns the status report request.

Returns:
True if status report is requested, false otherwise. Will also return false if ability to request status reports is blocked by the radio layer.
Since:
JDE 4.0.0

getTimestamp

public long getTimestamp()
Returns the timestamp for this message.

Returns:
The timestamp.
Since:
JDE 4.0.0

isDeliveryPeriodDefault

public boolean isDeliveryPeriodDefault()
Returns a boolean indicating whether or not the delivery period is set to the default amount of time.

Returns:
true if the delivery period is set to the default amount of time, false otherwise.
Since:
JDE 4.0.0

isFromSIMCard

public boolean isFromSIMCard()
Determines if this message originated from the device SIM card.

Returns:
True if the message originated from the SIM Card, false if it is being received OTA.
Since:
JDE 4.0.0

isMessageWaitingActive

public boolean isMessageWaitingActive()
Determines if this message's MWI Group is "Active".

Returns:
True if the Message Waiting Indication Group is "Active"; otherwise, false.
Since:
JDE 4.0.0

isMessageWaitingGroup

public boolean isMessageWaitingGroup()
Determines if this message is part of the Message Waiting Indication Group.

Returns:
True if this message is part of the MWI Group; otherwise, false.
Since:
JDE 4.0.0

isMessageWaitingStore

public boolean isMessageWaitingStore()
Determines if this message's MWI Group is "Store Message".

Returns:
True if the Message Waiting Indicaton Group is 'Store Message'; otherwise, false.
Since:
JDE 4.0.0

isReplyPath

public boolean isReplyPath()
Determines if this message specifies the reply path to use.

Returns:
True if the message specified the reply path, false otherwise.
Since:
JDE 4.0.0

isSegmentationSupported

public static boolean isSegmentationSupported()
Returns true if composition of fragmented SMS messages is supported.
Since:
JDE 4.0.0

isSendSupported

public static boolean isSendSupported()
Returns:
True if sending SMS messages is supported
Since:
JDE 4.1.0

isUserDataHeaderPresent

public boolean isUserDataHeaderPresent()
Returns a boolean indicating whether or not a user data header is present.

Returns:
True if there is a user data header present, false otherwise.
Since:
JDE 4.0.0

isValidityPeriodDefault

public boolean isValidityPeriodDefault()
Since:
JDE 4.0.0

reset

public void reset()
Description copied from interface: RadioPacketHeader
Resets the contents of this header.
Overrides:
reset in class SMSParameters
Since:
JDE 4.0.0

setDeliveryPeriod

public void setDeliveryPeriod(int deliveryPeriod)
Sets the delivery period for the message.

If this is not specified, the default delivery period is used.

Overrides:
setDeliveryPeriod in class SMSParameters
Parameters:
deliveryPeriod - The delivery period.
Since:
JDE 4.0.0

setMessageClass

public void setMessageClass(int messageClass)
Sets the message class.

If this is not specified, the default message class is used.

Overrides:
setMessageClass in class SMSParameters
Parameters:
messageClass - An integer representing the message class.
Since:
JDE 4.0.0

setMessageCoding

public void setMessageCoding(int messageCoding)
Sets the message coding.

If this is not specified, the default message coding is used.

Overrides:
setMessageCoding in class SMSParameters
Parameters:
messageCoding - An integer representing the message coding.
Since:
JDE 4.0.0

setMessageWaitingType

public void setMessageWaitingType(int waitingIndType)
Sets this message's MWI Group type.

Parameters:
waitingIndType - An integer representing the message waiting idnication group type to set.
Since:
JDE 4.0.0

setNumMessages

public void setNumMessages(int numMessages)
Sets the number of messages waiting.

Parameters:
numMessages - The number of messages waiting.
Since:
JDE 4.0.0

setProtocolId

public void setProtocolId(int protocolMeaning,
                          int protocolId)
Sets the protocol meaning and ID.

If this is not specified, the default protocol meaning and ID are used.

Parameters:
protocolMeaning - An integer representing the protocol meaning.
protocolId - An integer representing the protocol Id.
Since:
JDE 4.0.0

setStatusReportRequest

public void setStatusReportRequest(boolean statusReportRequest)
Sets the status report request for the message.

Parameters:
statusReportRequest - The status report request.
Since:
JDE 4.0.0

setUserDataHeaderPresent

public void setUserDataHeaderPresent(boolean userDataHeaderPresent)
Sets the user data header present for the message.

Parameters:
userDataHeaderPresent - Whether user data header is present
Since:
JDE 4.0.0

setValidityPeriod

public void setValidityPeriod(int validityPeriod)
Sets the validity period for the message.

If this is not specified, the default validity period is used.

Overrides:
setValidityPeriod in class SMSParameters
Parameters:
validityPeriod - The validity period.
Since:
JDE 4.0.0

validateForASCIIMessageCoding

public static boolean validateForASCIIMessageCoding(char c)
Validate the given character against the ASCII encoding.
Parameters:
c - The character to validate.
Returns:
If the character is valid; false otherwise.
Since:
JDE 4.0.0

validateForDefaultMessageCoding

public static boolean validateForDefaultMessageCoding(char c)
Validate the given character against the default encoding.
Parameters:
c - The character to validate.
Returns:
If the character is valid; false otherwise.
Since:
JDE 4.0.0

validateForISO8859MessageCoding

public static boolean validateForISO8859MessageCoding(char c)
Validate the given character against the ISO8859 encoding.
Parameters:
c - The character to validate.
Returns:
If the character is valid; false otherwise.
Since:
JDE 4.0.0

validateForMessageCoding

public static boolean validateForMessageCoding(char c,
                                               int messageCoding)
Determines if the specified character is valid for the given encoding type.
Parameters:
c - The character to validate.
messageCoding - The encoding type.
Returns:
True if the character is valid.
Since:
JDE 4.0.0

validateForUCS2MessageCoding

public static boolean validateForUCS2MessageCoding(char c)
Validate the given character against the UCS2 encoding.
Parameters:
c - The character to validate.
Returns:
If the character is valid; false otherwise.
Since:
JDE 4.0.0



Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.