Class SMSDataCodingScheme
- java.lang.Object
-
- com.opencloud.util.AbstractDataObject
-
- com.opencloud.util.AbstractFieldsObject
-
- AbstractEncodedDataObject<T>
-
- AbstractLazyEncodedDataObject<T>
-
- AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue>
-
- com.opencloud.slee.resources.in.datatypes.sms.SMSDataCodingScheme
-
- All Implemented Interfaces:
DataObject
,FastSerializable
,Serializable
public final class SMSDataCodingScheme extends AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue> implements FastSerializable
Class SMSDataCodingScheme encapsulates a TP-DCS field, which appears inside a SMSTPDU, hence it represents part of a larger octet string.The API offered by this class is as if the type were specified in ASN.1 as follows.
SMSDataCodingScheme ::= CHOICE { generalData GeneralScheme, autoDelete GeneralScheme, messageWaitingDiscard MessageWaitingScheme, messageWaitingStoreGSM7 MessageWaitingScheme, messageWaitingStoreUCS2 MessageWaitingScheme, messageCoding MessageCodingScheme }
The three subtypes referenced in this CHOICE type are implemented by nested classes; those represent the three alternative layouts of the octet in the data encoding tabulated below. The labels for those layouts in the table are "cases 0,1", "cases 0,1,2" and "case 3"; these numbers correspond to the six alternatives in the CHOICE.Data Encoding - based on 3GPP TS 23.038 V8.2.0 (2008-09) §4 pp8-10 7 6 5 4 3 2 1 0 Octet 0 Coding group discriminates... cases 0,1 0 0 or 1 Compressed? Has message class? Character set Message class case 2 1 0 Reserved case 3 Message waiting indication group discriminates... cases 0,1,2 1 1 00 or 01 or 10 Indication active? 0 Indication type case 3 1 1 1 1 0 Message coding Message class
Field names ending in ? are booleans: 1 for true, 0 for false.We regard the Coding Group as a discriminant for how the following six bits are interpreted. We regard the Message Waiting Indication Group as a discriminant for how the following four bits are interpreted. This nomenclature differs from the standard 23.038, where the Coding Group refers to bits 7-4, and the Message Waiting Indication Group distinguishes particular cases of the Coding Group.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMSDataCodingScheme.Choice
Enumeration of discriminating values.static class
SMSDataCodingScheme.EncodedValue
Representation of SMSDataCodingScheme values as NamedIntegers.static class
SMSDataCodingScheme.GeneralScheme
Class GeneralScheme represents the General Data and Auto Delete cases of a TP-DCS field.static class
SMSDataCodingScheme.MessageClass
Enumeration of Message Class constants.static class
SMSDataCodingScheme.MessageCodingScheme
Class MessageCodingScheme represents the Message Coding case of a TP_DCS field.static class
SMSDataCodingScheme.MessageWaitingScheme
Class MessageWaitingScheme represents the Message Waiting cases of a TP_DCS field.
-
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 SMSDataCodingScheme()
Constructs a new SMSDataCodingScheme object with no fields set.SMSDataCodingScheme(byte[] data)
Constructs a new SMSDataCodingScheme object from network-encoded data.SMSDataCodingScheme(byte[] data, int start, int len)
Constructs a new SMSDataCodingScheme object from part of network-encoded data.SMSDataCodingScheme(DataInput in)
Constructs a new SMSDataCodingScheme object from data deserialized from a stream that was written bytoStream(DataOutput)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkFieldsSet()
Checks that all mandatory fields are present.SMSDataCodingScheme
clone()
Constructs a copy of this object and everything reachable from it.static SMSDataCodingScheme
copyOf(SMSDataCodingScheme from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.protected void
decode()
Computes the decoded form from the encoded form.protected void
encode()
Computes the encoded form from the decoded form.protected boolean
encodedIsInvalid()
Determines whether the encoded form is invalid.protected SMSDataCodingScheme.EncodedValue
fromValue(int value)
Converts an int to a NamedInteger.SMSDataCodingScheme.GeneralScheme
getAutoDelete()
Gets the value of the auto delete alternative.byte[]
getByteArrayForm()
Gets the byte array encoded form.SMSDataCodingScheme.Choice
getChoice()
Gets the discriminant for which choice is chosen.SMSDataCodingScheme.EncodedValue
getEncodedForm()
Gets the encoded form.static FieldAccessor[]
getFieldAccessors()
Gets a new array of the accessors for fields of this type.Map<String,Object>
getFieldsMap(boolean withAbsents)
Gets a Map from :discriminant-name to field-value.SMSDataCodingScheme.GeneralScheme
getGeneralData()
Gets the value of the general data alternative.SMSDataCodingScheme.MessageCodingScheme
getMessageCoding()
Gets the value of the message coding alternative.SMSDataCodingScheme.MessageWaitingScheme
getMessageWaitingDiscard()
Gets the value of the message waiting discard alternative.SMSDataCodingScheme.MessageWaitingScheme
getMessageWaitingStoreGSM7()
Gets the value of the message waiting store GSM7 alternative.SMSDataCodingScheme.MessageWaitingScheme
getMessageWaitingStoreUCS2()
Gets the value of the message waiting store UCS2 alternative.boolean
isAutoDeleteChosen()
Tests whether the choice is autoDelete.boolean
isData8Bit()
Determines whether 8-bit data encoding is specified.boolean
isGeneralDataChosen()
Tests whether the choice is generalData.boolean
isGSM7Bit()
Determines whether GSM 7-bit encoding is specified.boolean
isMessageCodingChosen()
Tests whether the choice is messageCoding.boolean
isMessageWaitingDiscardChosen()
Tests whether the choice is messageWaitingDiscard.boolean
isMessageWaitingStoreGSM7Chosen()
Tests whether the choice is messageWaitingStoreGSM7.boolean
isMessageWaitingStoreUCS2Chosen()
Tests whether the choice is messageWaitingStoreUCS2.boolean
isUCS2()
Determines whether UCS-2 encoding is specified.SMSDataCodingScheme
setAutoDelete(SMSDataCodingScheme.GeneralScheme value)
Sets the value of the auto delete alternative.SMSDataCodingScheme
setGeneralData(SMSDataCodingScheme.GeneralScheme value)
Sets the value of the general data alternative.SMSDataCodingScheme
setMessageCoding(SMSDataCodingScheme.MessageCodingScheme value)
Sets the value of the message coding alternative.SMSDataCodingScheme
setMessageWaitingDiscard(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting discard alternative.SMSDataCodingScheme
setMessageWaitingStoreGSM7(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting store GSM7 alternative.SMSDataCodingScheme
setMessageWaitingStoreUCS2(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting store UCS2 alternative.void
setReadOnly()
Sets this and all its fields to be immutable.void
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading bySMSDataCodingScheme(DataInput)
.-
Methods inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
checkDecode, checkModifyAndDecode
-
Methods inherited from class com.opencloud.util.AbstractFieldsObject
equals, hashCode, toString
-
Methods inherited from class com.opencloud.util.AbstractDataObject
checkModify, isReadOnly
-
-
-
-
Constructor Detail
-
SMSDataCodingScheme
public SMSDataCodingScheme()
Constructs a new SMSDataCodingScheme object with no fields set.
-
SMSDataCodingScheme
public SMSDataCodingScheme(byte[] data)
Constructs a new SMSDataCodingScheme 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
-
SMSDataCodingScheme
public SMSDataCodingScheme(byte[] data, int start, int len)
Constructs a new SMSDataCodingScheme 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
-
SMSDataCodingScheme
public SMSDataCodingScheme(DataInput in) throws IOException
Constructs a new SMSDataCodingScheme object from data deserialized from a stream that was written bytoStream(DataOutput)
.- Parameters:
in
- the stream to read from- Throws:
EOFException
- if reading is pre-empted by end-of-fileIOException
- if the data cannot be read
-
-
Method Detail
-
toStream
public void toStream(DataOutput out) throws IOException
Serializes this object to a stream in a form suitable for reading bySMSDataCodingScheme(DataInput)
.- Specified by:
toStream
in interfaceFastSerializable
- Parameters:
out
- the stream to write to- Throws:
IOException
- if an I/O error occurs
-
getChoice
public SMSDataCodingScheme.Choice getChoice() throws DecodeException
Gets the discriminant for which choice is chosen.- Returns:
- enumerated constant
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isGeneralDataChosen
public boolean isGeneralDataChosen() throws DecodeException
Tests whether the choice is generalData.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isAutoDeleteChosen
public boolean isAutoDeleteChosen() throws DecodeException
Tests whether the choice is autoDelete.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isMessageWaitingDiscardChosen
public boolean isMessageWaitingDiscardChosen() throws DecodeException
Tests whether the choice is messageWaitingDiscard.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isMessageWaitingStoreGSM7Chosen
public boolean isMessageWaitingStoreGSM7Chosen() throws DecodeException
Tests whether the choice is messageWaitingStoreGSM7.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isMessageWaitingStoreUCS2Chosen
public boolean isMessageWaitingStoreUCS2Chosen() throws DecodeException
Tests whether the choice is messageWaitingStoreUCS2.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
isMessageCodingChosen
public boolean isMessageCodingChosen() throws DecodeException
Tests whether the choice is messageCoding.- Returns:
- true if chosen, false if not
- Throws:
DecodeException
- if encoded state cannot be decoded
-
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<SMSDataCodingScheme.EncodedValue>
- Throws:
EncodeException
- if any mandatory field is not present
-
getGeneralData
public SMSDataCodingScheme.GeneralScheme getGeneralData() throws DecodeException
Gets the value of the general data alternative.- Returns:
- GeneralScheme representation of the general data alternative, if choice is the general data alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getAutoDelete
public SMSDataCodingScheme.GeneralScheme getAutoDelete() throws DecodeException
Gets the value of the auto delete alternative.- Returns:
- GeneralScheme representation of the auto delete alternative, if choice is the auto delete alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getMessageWaitingDiscard
public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingDiscard() throws DecodeException
Gets the value of the message waiting discard alternative.- Returns:
- MessageWaitingScheme representation of the message waiting discard alternative, if choice is the message waiting discard alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getMessageWaitingStoreGSM7
public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreGSM7() throws DecodeException
Gets the value of the message waiting store GSM7 alternative.- Returns:
- MessageWaitingScheme representation of the message waiting store GSM7 alternative, if choice is the message waiting store GSM7 alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getMessageWaitingStoreUCS2
public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreUCS2() throws DecodeException
Gets the value of the message waiting store UCS2 alternative.- Returns:
- MessageWaitingScheme representation of the message waiting store UCS2 alternative, if choice is the message waiting store UCS2 alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getMessageCoding
public SMSDataCodingScheme.MessageCodingScheme getMessageCoding() throws DecodeException
Gets the value of the message coding alternative.- Returns:
- MessageCodingScheme representation of the message coding alternative, if choice is the message coding alternative, else null
- Throws:
DecodeException
- if encoded state cannot be decoded
-
setGeneralData
public SMSDataCodingScheme setGeneralData(SMSDataCodingScheme.GeneralScheme value) throws IllegalStateException
Sets the value of the general data alternative.- Parameters:
value
- GeneralScheme representation of the general data alternative- Returns:
- this
- Throws:
IllegalStateException
-
setAutoDelete
public SMSDataCodingScheme setAutoDelete(SMSDataCodingScheme.GeneralScheme value) throws IllegalStateException
Sets the value of the auto delete alternative.- Parameters:
value
- GeneralScheme representation of the auto delete alternative- Returns:
- this
- Throws:
IllegalStateException
-
setMessageWaitingDiscard
public SMSDataCodingScheme setMessageWaitingDiscard(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
Sets the value of the message waiting discard alternative.- Parameters:
value
- MessageWaitingScheme representation of the message waiting discard alternative- Returns:
- this
- Throws:
IllegalStateException
-
setMessageWaitingStoreGSM7
public SMSDataCodingScheme setMessageWaitingStoreGSM7(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
Sets the value of the message waiting store GSM7 alternative.- Parameters:
value
- MessageWaitingScheme representation of the message waiting store GSM7 alternative- Returns:
- this
- Throws:
IllegalStateException
-
setMessageWaitingStoreUCS2
public SMSDataCodingScheme setMessageWaitingStoreUCS2(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
Sets the value of the message waiting store UCS2 alternative.- Parameters:
value
- MessageWaitingScheme representation of the message waiting store UCS2 alternative- Returns:
- this
- Throws:
IllegalStateException
-
setMessageCoding
public SMSDataCodingScheme setMessageCoding(SMSDataCodingScheme.MessageCodingScheme value) throws IllegalStateException
Sets the value of the message coding alternative.- Parameters:
value
- MessageCodingScheme representation of the message coding alternative- Returns:
- this
- Throws:
IllegalStateException
-
copyOf
public static SMSDataCodingScheme copyOf(SMSDataCodingScheme from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.- Parameters:
from
- the object from which to copy- Returns:
- SMSDataCodingScheme
-
clone
public SMSDataCodingScheme clone()
Constructs a copy of this object and everything reachable from it.- Specified by:
clone
in interfaceDataObject
- Specified by:
clone
in classAbstractDataObject
- Returns:
- copy of object
-
setReadOnly
public void setReadOnly()
Sets this and all its fields to be immutable.- Specified by:
setReadOnly
in interfaceDataObject
- Overrides:
setReadOnly
in classAbstractDataObject
-
getFieldAccessors
public static FieldAccessor[] getFieldAccessors()
Gets a new array of the accessors for fields of this type.- Returns:
- FieldAccessor[]
-
getFieldsMap
public Map<String,Object> getFieldsMap(boolean withAbsents)
Gets a Map from :discriminant-name to field-value. If choice is not set, returns a Map from : to AbstractFieldsObject.FIELD_UNINITIALISED. For a field of primitive type, the field-value is boxed. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue:" to the byte array value is returned.- Specified by:
getFieldsMap
in classAbstractFieldsObject
- Parameters:
withAbsents
- the value of this parameter is ignored- Returns:
- Map from :discriminant-name to field-value
-
encodedIsInvalid
protected boolean encodedIsInvalid()
Determines whether the encoded form is invalid.- Returns:
- boolean
-
getEncodedForm
public SMSDataCodingScheme.EncodedValue getEncodedForm() throws EncodeException
Gets the encoded form.- Returns:
- encoded form
- Throws:
EncodeException
- if encoding fails
-
getByteArrayForm
public byte[] getByteArrayForm() throws EncodeException
Gets the byte array encoded form. The size of the array is the least of 1, 2, 4, or 8 according to the type's bounds. The most significant byte of the numeric value is in the lowest indexed byte of the array.- Returns:
- byte array form
- Throws:
EncodeException
- if encoding fails
-
fromValue
protected SMSDataCodingScheme.EncodedValue fromValue(int value)
Converts an int to a NamedInteger. Reuses any existing instance where possible.- Specified by:
fromValue
in classAbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue>
- Parameters:
value
- int- Returns:
- NamedInteger
-
isGSM7Bit
public boolean isGSM7Bit()
Determines whether GSM 7-bit encoding is specified. This is the case if the coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is GSM_7BIT, or coding group is RESERVED, or coding group is MESSAGE_WAITING and (message waiting is DISCARD or STORE_GSM7, or is DATA and message coding is GSM_7BIT).- Returns:
- whether GSM 7-bit encoding is specified
-
isUCS2
public boolean isUCS2()
Determines whether UCS-2 encoding is specified. This is the case if coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is UCS2, or coding group is MESSAGE_WAITING and message waiting is STORE_UCS2.- Returns:
- whether UCS-2 encoding is specified
-
isData8Bit
public boolean isData8Bit()
Determines whether 8-bit data encoding is specified. This is the case if coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is DATA_8BIT, or coding group is MESSAGE_WAITING and message waiting is DATA and message coding is DATA_8BIT.- Returns:
- whether 8-bit data encoding is specified
-
encode
protected void encode() throws EncodeException
Computes the encoded form from the decoded form.- Specified by:
encode
in classAbstractLazyEncodedDataObject<SMSDataCodingScheme.EncodedValue>
- Throws:
EncodeException
- if address cannot be encoded
-
decode
protected void decode()
Computes the decoded form from the encoded form.- Specified by:
decode
in classAbstractLazyEncodedDataObject<SMSDataCodingScheme.EncodedValue>
-
-