| java.lang.Object sim.toolkit.ViewHandler sim.toolkit.ProactiveResponseHandler
ProactiveResponseHandler | final public class ProactiveResponseHandler extends ViewHandler (Code) | | The ProactiveResponseHandler class contains basic methods to handle the
Terminal
Response data field. This class will be used by the Toolkit applet to
get the response to the Proactive commands. No constructor is available for
the Toolkit applet. The ProactiveResponseHandler class is a Temporary
JCRE Entry Point Object. The only way to get a ProactiveResponseHandler
reference is through the getTheHandler() static method.
Example of use:
private byte[] data;
data = new byte[32]; // build a buffer
ProactiveResponseHandler ProRespHdlr; // get the system instance
ProRespHdlr = ProactiveResponseHandler.getTheHandler();
// get General Result
byte result = ProRespHdlr.getGeneralResult();
// look for Device Identities
respHdlr.findTLV(TAG_DEVICE_IDENTITIES, 1);
// read Device Identities
byte sourceDev = ProRespHdlr.getValueByte((short)0);
byte destinDev = ProRespHdlr.getValueByte((short)1);
// look for Text String element
if (ProRespHdlr.findTLV(TAG_TEXT_STRING, (byte)1) == TLV_FOUND_CR_SET) {
if ((short len = ProRespHdlr.getValueLength()) > 1) {
// not empty string: to be copied
ProRespHdlr.copyValue((short)1, data, (short)0, (short)(len - 1));
}
}
version: 8.3.0 See Also: ViewHandler See Also: ProactiveHandler See Also: ToolkitException |
Method Summary | |
public short | copyAdditionalInformation(byte[] dstBuffer, short dstOffset, short dstLength) Copies a part of the additional information field from the first Result
TLV element of the current response data field. | public short | copyTextString(byte[] dstBuffer, short dstOffset) Copies the text string value from the first Text String TLV element
of the
current response data field. | public short | getAdditionalInformationLength() Returns the length of the additional information field from the first
Result TLV element of the current response data field. | public byte | getGeneralResult() Returns the general result byte of the Proactive command. | public byte | getItemIdentifier() Returns the item identifier byte value from the first Item
Identifier TLV element of the current response data field. | public byte | getTextStringCodingScheme() Returns the data coding scheme byte from the first Text String TLV
element of the current response data field. | public short | getTextStringLength() Returns the text string length value from the first Text String TLV
element of the current response data field. | public static ProactiveResponseHandler | getTheHandler() Returns the single system instance of the
ProactiveResponseHandler class. |
copyAdditionalInformation | public short copyAdditionalInformation(byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Copies a part of the additional information field from the first Result
TLV element of the current response data field.
If the element is available it becomes the TLV selected.
Notes:
- If
dstOffset or
dstLength parameter is negative an
ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
- If
dstOffset+dstLength is
greater than dstBuffer.length , the length
of the dstBuffer array an
ArrayIndexOutOfBoundsException exception is thrown
and no copy is performed.
Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer Parameters: dstLength - the data length to be copied dstOffset+dstLength exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if copyAdditionalInformation would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Result TLV elementOUT_OF_TLV_BOUNDARIES if dstLength is greater than the value field of the available TLV
|
copyTextString | public short copyTextString(byte[] dstBuffer, short dstOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Copies the text string value from the first Text String TLV element
of the
current response data field. The Data Coding Scheme byte is not copied.
If the element is available it becomes the TLV selected.
Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer dstOffset + length of the copied value exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if dstOffset or dstOffset + (length of the TextString to be copied, without the Data Coding Scheme included) , as specified for the returned value, would cause access outside array bounds. exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Text String TLV element
|
getAdditionalInformationLength | public short getAdditionalInformationLength() throws ToolkitException(Code) | | Returns the length of the additional information field from the first
Result TLV element of the current response data field.
If the element is available it becomes the TLV selected.
additional information length exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Result TLV element
|
getGeneralResult | public byte getGeneralResult() throws ToolkitException(Code) | | Returns the general result byte of the Proactive command.
If the element is available it becomes the TLV selected.
general result of the command (first byte of Result TLV in Terminal Response) exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Result TLV elementOUT_OF_TLV_BOUNDARIES if the general result byte is missing in the Result Simple TLV
|
getItemIdentifier | public byte getItemIdentifier() throws ToolkitException(Code) | | Returns the item identifier byte value from the first Item
Identifier TLV element of the current response data field.
If the element is available it becomes the TLV selected.
item identifier exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Item Identifier TLV elementOUT_OF_TLV_BOUNDARIES if the item identifier byte is missing in the Item Identifier Simple TLV
|
getTextStringCodingScheme | public byte getTextStringCodingScheme() throws ToolkitException(Code) | | Returns the data coding scheme byte from the first Text String TLV
element of the current response data field.
If the element is available it becomes the TLV selected.
text string coding scheme exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable TextString TLV elementOUT_OF_TLV_BOUNDARIES if the Text String TLV is present with a length of 0 (no DCS byte)
|
getTextStringLength | public short getTextStringLength() throws ToolkitException(Code) | | Returns the text string length value from the first Text String TLV
element of the current response data field. The Data Coding Scheme byte
is not taken into account.
If the element is available it becomes the TLV selected.
text string length exception: ToolkitException - with the following reason codes: UNAVAILABLE_ELEMENT in case of unavailable Text String TLV element
|
getTheHandler | public static ProactiveResponseHandler getTheHandler() throws ToolkitException(Code) | | Returns the single system instance of the
ProactiveResponseHandler class. The applet shall get the
reference of the handler at its triggering, the beginning of
the processToolkit method.
reference of the system instance exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handleris busy. |
Methods inherited from sim.toolkit.ViewHandler | public byte compareValue(short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public short copy(byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public short copyValue(short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public byte findAndCompareValue(byte tag, byte[] compareBuffer, short compareOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public byte findAndCompareValue(byte tag, byte occurrence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public short findAndCopyValue(byte tag, byte[] dstBuffer, short dstOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public short findAndCopyValue(byte tag, byte occurrence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code)(Java Doc) public byte findTLV(byte tag, byte occurrence) throws ToolkitException(Code)(Java Doc) public static byte[] getAPDUBuffer(byte[] buffer)(Code)(Java Doc) public static byte[] getAPDUBuffer()(Code)(Java Doc) protected short getLastTLVOffset(byte[] buffer, short Lc)(Code)(Java Doc) public short getLength() throws ToolkitException(Code)(Java Doc) protected short getTLVOffset(byte[] buffer, byte tag, short Lc, short occurrence)(Code)(Java Doc) public byte getValueByte(short valueOffset) throws ToolkitException(Code)(Java Doc) public short getValueLength() throws ToolkitException(Code)(Java Doc) public static void setAPDUBuffer(byte[] buffer, short length)(Code)(Java Doc) public static void setAPDUBuffer(short length)(Code)(Java Doc) public static void setOutBufferData(short length)(Code)(Java Doc)
|
|
|