Class SMSTPDU
- java.lang.Object
-
- com.opencloud.util.AbstractDataObject
-
- com.opencloud.util.AbstractFieldsObject
-
- AbstractEncodedDataObject<T>
-
- AbstractLazyEncodedDataObject<byte[]>
-
- AbstractLazyEncodedByteArray
-
- com.opencloud.slee.resources.in.datatypes.sms.SMSTPDU
-
- All Implemented Interfaces:
DataObject
,Serializable
- Direct Known Subclasses:
SMSCommand
,SMSReserved
,SMSTPDUWithData
public abstract class SMSTPDU extends AbstractLazyEncodedByteArray
Representation of a SMS-TPDU as defined in 3GPP TS 23.040 V9.0.0 (2009-06).In general, accessors of all subclasses of SMSTPDU follow the following rules:
- getXXX() and setXXX() call checkDecode() to decode data when required. checkDecode() may throw DecodeException or ArrayIndexOutOfBoundsException.
- setXXX() throws IllegalStateException if the object is immutable or was set read-only
- setXXX() throws IllegalArgumentException if the provided value is out of range
For the sake of brevity, this common behaviour is not described individually on each accessor method.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMSTPDU.Type
Enumeration of PDU types.
-
Field Summary
-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
isDecoded
-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractEncodedDataObject
encoded
-
Fields inherited from class com.opencloud.util.AbstractFieldsObject
FIELD_ABSENT, FIELD_UNINITIALISED
-
-
Constructor Summary
Constructors Constructor Description SMSTPDU()
Constructs a new SMSTPDU object with no fields set.SMSTPDU(byte[] data)
Constructs a new SMSTPDU object from network-encoded data.SMSTPDU(byte[] data, int start, int len)
Constructs a new SMSTPDU object from part of network-encoded data.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
checkFieldsSet()
Checks that all mandatory fields are present.static SMSTPDU
decodeRPAck(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA) Equivalent todecodeRPAck(message, 0, message.length)
static SMSTPDU
decodeRPAck(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA) Only basic message-type decoding is performed immediately.static SMSTPDU
decodeRPError(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA).static SMSTPDU
decodeRPError(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA) Only basic message-type decoding is performed immediately.static SMSTPDU
decodeRPMOData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC) Equivalent todecodeRPMOData(message, 0, message.length)
static SMSTPDU
decodeRPMOData(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC) Only basic message-type decoding is performed immediately.static SMSTPDU
decodeRPMTData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS) Equivalent todecodeRPMTData(message, 0, message.length)
static SMSTPDU
decodeRPMTData(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS) Only basic message-type decoding is performed immediately.static byte[]
encodeRPAck(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-ACK message.static byte[]
encodeRPError(SMSTPDU tpdu)
Encode this TPDU for sending as the payload of a SM-RL RP-ERROR message.static byte[]
encodeRPMOData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MO-DATA message.static byte[]
encodeRPMTData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MT-DATA message.abstract byte[]
getEncodedForm()
Encode this message to the network form.abstract SMSTPDU.Type
getType()
Return the message type of this PDU-
Methods inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
checkDecode, checkModifyAndDecode, decode, encode
-
Methods inherited from class com.opencloud.util.AbstractFieldsObject
equals, getFieldsMap, hashCode, toString
-
Methods inherited from class com.opencloud.util.AbstractDataObject
checkModify, clone, isReadOnly, setReadOnly
-
-
-
-
Constructor Detail
-
SMSTPDU
public SMSTPDU()
Constructs a new SMSTPDU object with no fields set.
-
SMSTPDU
public SMSTPDU(byte[] data)
Constructs a new SMSTPDU object from network-encoded data. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded data- Throws:
NullPointerException
- if data is null
-
SMSTPDU
public SMSTPDU(byte[] data, int start, int len)
Constructs a new SMSTPDU object from part of network-encoded data. The part starts at indexstart
and islen
bytes long. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded datastart
- starting offset of network-encoded data in byte arraylen
- default length if not predictable- Throws:
NullPointerException
- if data is nullIllegalArgumentException
- if len is negative
-
-
Method Detail
-
checkFieldsSet
public void checkFieldsSet() throws EncodeException
Checks that all mandatory fields are present. Should be called immediately before all calls to encode().- Specified by:
checkFieldsSet
in classAbstractLazyEncodedDataObject<byte[]>
- Throws:
EncodeException
- if any mandatory field is not present
-
getType
public abstract SMSTPDU.Type getType()
Return the message type of this PDU- Returns:
- the type
-
getEncodedForm
public abstract byte[] getEncodedForm() throws EncodeException
Encode this message to the network form. If the message is already encoded, the existing encoding is reused.- Returns:
- a bytearray containing the encoded form
- Throws:
EncodeException
- if the PDU is missing mandatory fields, or provided field values are inconsistent
-
decodeRPMOData
public static SMSTPDU decodeRPMOData(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC) Only basic message-type decoding is performed immediately. Decoding of other fields is deferred until accessed, or untilAbstractLazyEncodedDataObject.checkDecode()
is called.- Parameters:
message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of range
-
decodeRPMOData
public static SMSTPDU decodeRPMOData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC) Equivalent todecodeRPMOData(message, 0, message.length)
- Parameters:
message
- a bytearray containing the encoded PDU- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is null
-
encodeRPMOData
public static byte[] encodeRPMOData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MO-DATA message.- Parameters:
tpdu
- the pdu to encode- Returns:
- the encoded form of the PDU
- Throws:
EncodeException
- if the TPDU could not be encoded for use in the RP-MO-DATA context
-
decodeRPMTData
public static SMSTPDU decodeRPMTData(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS) Only basic message-type decoding is performed immediately. Decoding of other fields is deferred until accessed, or untilAbstractLazyEncodedDataObject.checkDecode()
is called.- Parameters:
message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of range
-
decodeRPMTData
public static SMSTPDU decodeRPMTData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS) Equivalent todecodeRPMTData(message, 0, message.length)
- Parameters:
message
- a bytearray containing the encoded PDU- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is empty
-
encodeRPMTData
public static byte[] encodeRPMTData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MT-DATA message.- Parameters:
tpdu
- the pdu to encode- Returns:
- the encoded form of the PDU
- Throws:
EncodeException
- if the TPDU could not be encoded for use in the RP-MT-DATA context
-
decodeRPAck
public static SMSTPDU decodeRPAck(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA) Only basic message-type decoding is performed immediately. Decoding of other fields is deferred until accessed, or untilAbstractLazyEncodedDataObject.checkDecode()
is called.- Parameters:
message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of range
-
decodeRPAck
public static SMSTPDU decodeRPAck(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA) Equivalent todecodeRPAck(message, 0, message.length)
- Parameters:
message
- a bytearray containing the encoded PDU- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is empty
-
encodeRPAck
public static byte[] encodeRPAck(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-ACK message.- Parameters:
tpdu
- the pdu to encode- Returns:
- the encoded form of the PDU
- Throws:
EncodeException
- if the TPDU could not be encoded for use in the RP-ACK context
-
decodeRPError
public static SMSTPDU decodeRPError(byte[] message, int start, int len)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA) Only basic message-type decoding is performed immediately. Decoding of other fields is deferred until accessed, or untilAbstractLazyEncodedDataObject.checkDecode()
is called.- Parameters:
message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of range
-
decodeRPError
public static SMSTPDU decodeRPError(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA). Equivalent todecodeRPError(message, 0, message.length)
- Parameters:
message
- a bytearray containing the encoded PDU- Returns:
- the decoded message
- Throws:
NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is empty
-
encodeRPError
public static byte[] encodeRPError(SMSTPDU tpdu)
Encode this TPDU for sending as the payload of a SM-RL RP-ERROR message.- Parameters:
tpdu
- the pdu to encode- Returns:
- the encoded form of the PDU
- Throws:
EncodeException
- if the TPDU could not be encoded for use in the RP-ERROR context
-
-