EnvelopeHandlerpublic final class EnvelopeHandler extends ViewHandler The EnvelopeHandler class contains basic methods to handle the Envelope
data field. This class will be used by the Toolkit applet in order to
have access to the current Envelope information. No constructor is available
for the Toolkit applet. The EnvelopeHandler class is a Temporary JCRE
Entry Point Object. The only way to get a EnvelopeHandler reference is
through the getTheHandler() static method.
Toolkit Applet Example:
private static final byte MY_TAG = (byte)0x54;
private byte[] data;
data = new byte[32];
void processToolkit(byte event) throws ToolkitException {
// get the EnvelopeHandler system instance
EnvelopeHandler theEnv = EnvelopeHandler.getTheHandler();
// look for MY_TAG TLV
if (theEnv.findTLV(MY_TAG, (byte)1) != TLV_NOT_FOUND) {
// check first element byte
if (theEnv.getValueByte((short)0) == (byte)1) {
// copy element part into data buffer
theEnv.copyValue((short)1,
data,
(short)0,
(short)(theEnv.getValueLength() - 1));
}
}
}
|
Constructors Summary |
---|
private EnvelopeHandler()constructor
|
Methods Summary |
---|
public byte | getEnvelopeTag()Returns the Envelope BER-TLV tag.
byte[] buffer = ViewHandler.getAPDUBuffer();
return buffer[BER_TLV_TAG_OFFSET];
| public byte | getItemIdentifier()Returns the item identifier byte value from the first Item
Identifier TLV element in the current Envelope data field.
If the element is available it becomes the TLV selected.
byte[] buffer = ViewHandler.getAPDUBuffer();
currentTLVOffset = firstTLVOffset;
return buffer[firstTLVOffset];
| public short | getSecuredDataLength()Looks for the length of the Secured Data from the Command Packet
in the first SMS TPDU or Cell Broadcast Page Simple TLV contained
in the Envelope handler. This can be used on the events:
- EVENT_FORMATTED_SMS_PP_ENV, EVENT_FORMATTED_SMS_PP_UPD,
if the SMS TP-UD is formatted according to GSM03.48 Single
Short Message.
- EVENT_FORMATTED_SMS_CB, if the Cell Broadcast Page is formatted
according to GSM 03.48.
If the element is available it becomes the TLV selected.
return 0;
| public short | getSecuredDataOffset()Looks for the Secured Data from the Command Packet in the first SMS
TPDU or Cell Broadcast Page Simple TLV contained in the Envelope
handler. This can be used on the events:
- EVENT_FORMATTED_SMS_PP_ENV, EVENT_FORMATTED_SMS_PP_UPD,
if the SMS TP-UD is formatted according to GSM03.48 Single
Short Message.
- EVENT_FORMATTED_SMS_CB, if the Cell Broadcast Page is formatted
according to GSM 03.48.
If the element is available it becomes the TLV selected.
return 0;
| public short | getTPUDLOffset()Looks for the TP-UDL field in the first TPDU TLV element in the Envelope
data field. This method can be used on the events
EVENT_FORMATTED_SMS_PP_ENV,
EVENT_FORMATTED_SMS_PP_UPD, EVENT_UNFORMATTED_SMS_PP_ENV,
EVENT_UNFORMATTED_SMS_PP_UPD.
If the element is available it becomes the TLV selected.
// get to the SMS TLV
byte[] buffer = ViewHandler.getAPDUBuffer();
short Lc = buffer[OFFSET_LC];
short SMSTLVOffset = getTLVOffset(buffer,
ToolkitConstants.TAG_SMS_TPDU, Lc, (byte)1);
if (SMSTLVOffset >= Lc)
ToolkitException.throwIt(ToolkitException.UNAVAILABLE_ELEMENT);
currentTLVOffset = SMSTLVOffset;
return 0;
| public static sim.toolkit.EnvelopeHandler | getTheHandler()Returns the single system instance of the EnvelopeHandler class.
The applet shall get the reference of the handler at its triggering,
the beginning of the processToolkit method.
EnvelopeHandler theEnvelopeHandler = new EnvelopeHandler();
// BER TLV offset is 5 in the buffer
// offset for the first TLV would be BER TLV offset + 2
theEnvelopeHandler.firstTLVOffset = (short)(BER_TLV_TAG_OFFSET + 2);
theEnvelopeHandler.currentTLVOffset = (short)(BER_TLV_TAG_OFFSET + 2);
return theEnvelopeHandler;
|
|