|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sim.toolkit.ViewHandler | +--sim.toolkit.EditHandler | +--sim.toolkit.ProactiveHandler
This class is the basic class for the definition of Proactive commands
. Low level methods, as init()
, appendTLV()
...
will be used to handle generic Proactive commands (standard or future
definitions...). The ProactiveHandler class is a Temporary JCRE Entry Point Object.
The Toolkit applets, which need to send Proactive commands,
shall call the getTheHandler()
static method to get the
reference of this system instance.
Example of use:
// constants definition
private static final byte MY_COMMAND = (byte)0x33;
private static final byte MY_TAG = (byte)0x45;
ProactiveHandler proHdlr; // get the system instance
proHdlr = ProactiveHandler.getTheHandler();
// build and send a new Proactive command
proHdlr.init(MY_COMMAND, (byte)0, DEV_ID_ME);
proHdlr.appendTLV((byte)(MY_TAG | TAG_SET_CR),
(byte)0);
short len = proHdlr.getLength(); // length should be 14 !
byte result = proHdlr.send();
private byte[] text = new byte[12]; // byte array definition
text[0] = (byte)'S'; // text, in 8-bit format, is "SAT"
text[1] = (byte)'A';
text[2] = (byte)'T';
// build and send a DisplayText command
result = proHdlr.initDisplayText((byte)0x80, DCS_8_BIT_DATA, text, (short)0, (short)3);
result = proHdlr.send();
ViewHandler
,
EditHandler
,
ProactiveResponseHandler
,
ToolkitException
Method Summary | |
short |
getCapacity()
Returns the maximum size of the Simple TLV list managed by the handler. |
static ProactiveHandler |
getTheHandler()
Returns the single system instance of the ProactiveHandler class. |
void |
init(byte type,
byte qualifier,
byte dstDevice)
Initializes the next Proactive command with Command Details and Device Identities TLV. |
void |
initCloseChannel(byte bChannelIdentifier)
Builds a Close Channel Proactive command without sending the command The Comprehension Required flags are all set to 1. |
void |
initDisplayText(byte qualifier,
byte dcs,
byte[] buffer,
short offset,
short length)
Builds a Display Text Proactive command without sending the command. |
void |
initGetInkey(byte qualifier,
byte dcs,
byte[] buffer,
short offset,
short length)
Builds a Get Inkey Proactive command without sending the command. |
void |
initGetInput(byte qualifier,
byte dcs,
byte[] buffer,
short offset,
short length,
short minRespLength,
short maxRespLength)
Initialize the building of a Get Input Proactive command. |
byte |
send()
Sends the current Proactive command. |
Methods inherited from class sim.toolkit.EditHandler |
appendArray, appendTLV, appendTLV, appendTLV, appendTLV, clear |
Methods inherited from class sim.toolkit.ViewHandler |
compareValue, copy, copyValue, findAndCompareValue, findAndCompareValue, findAndCopyValue, findAndCopyValue, findTLV, getLength, getValueByte, getValueLength |
Methods inherited from class java.lang.Object |
equals |
Method Detail |
public static ProactiveHandler getTheHandler() throws ToolkitException
ToolkitException
- with the following reason codes: HANDLER_NOT_AVAILABLE
if the handler is busy.public void init(byte type, byte qualifier, byte dstDevice)
type
- the command typequalifier
- the command qualifierdstDevice
- the destination devicepublic byte send() throws javacard.framework.APDUException, ToolkitException
ToolkitException
- with the following reason codes: UNAVAILABLE_ELEMENT
if the Result Simple TLV is missing.
OUT_OF_TLV_BOUNDARIES
if the general result byte is missing in the Result Simple TLV.
COMMAND_NOT_ALLOWED
if the Proactive command to be sent or one of its parameterjavacard.framework.APDUException
- with the following reason code: BAD_LENGTH
if the resulting proactive command length is greater than 256.public void initDisplayText(byte qualifier, byte dcs, byte[] buffer, short offset, short length) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
Notes:
offset
or length
parameter is negative an ArrayIndexOutOfBoundsException
exception is thrown and no proactive command is build.
offset+length
is greater than buffer.length
, the length
of the buffer
array an ArrayIndexOutOfBoundsException
exception is thrown
and no proactive command is build.
qualifier
- Display Text command qualifierdcs
- data coding schemebuffer
- reference to the text string source bufferoffset
- offset of the text string in the source bufferlength
- length of the text string in the source buffer. If length is equal to zero,
then the Text String TLV inserted in the command is a null text string TLV
as defined in TS 11.14 [3].
java.lang.NullPointerException
- if buffer
is null
java.lang.ArrayIndexOutOfBoundsException
- if initDisplayText would cause access of data outside array bounds
ToolkitException
- with the following reason codes: HANDLER_OVERFLOW
if the ProactiveHandler buffer is to small to put the requested data public void initGetInkey(byte qualifier, byte dcs, byte[] buffer, short offset, short length) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
Notes:
offset
or length
parameter is negative an ArrayIndexOutOfBoundsException
exception is thrown and no proactive command is build.
offset+length
is greater than buffer.length
, the length
of the buffer
array an ArrayIndexOutOfBoundsException
exception is thrown
and no proactive command is build.
qualifier
- Get Inkey command qualifierdcs
- data coding schemebuffer
- reference to the displayed text string source bufferoffset
- offset of the displayed text string in the source bufferlength
- length of the displayed text string in the source buffer.If length is equal to zero,
then the Text String TLV inserted in the command is a null text string TLV as defined
in TS 11.14 [3].
java.lang.NullPointerException
- if buffer
is null
java.lang.ArrayIndexOutOfBoundsException
- if initGetInkey would cause access of data outside array bounds.
ToolkitException
- with the following reason codes: HANDLER_OVERFLOW
if the ProactiveHandler buffer is to small to put the requested datapublic void initGetInput(byte qualifier, byte dcs, byte[] buffer, short offset, short length, short minRespLength, short maxRespLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
Notes:
offset
or length
parameter is negative an ArrayIndexOutOfBoundsException
exception is thrown and no proactive command is build.
offset+length
is greater than buffer.length
, the length
of the buffer
array an ArrayIndexOutOfBoundsException
exception is thrown
and no proactive command is build.
qualifier
- Get Input command qualifierdcs
- data coding schemebuffer
- reference to the displayed text string source bufferoffset
- offset of the displayed text string in the source bufferlength
- length of the displayed text string in the source buffer. If length is equal to zero,
then the Text String TLV inserted in the command is a null text string TLV as defined
in TS 11.14 [3].minRespLength
- minimal length of the response text stringmaxRespLength
- maximal length of the response text string
java.lang.NullPointerException
- if buffer
is null
java.lang.ArrayIndexOutOfBoundsException
- if initGetInput would cause access of data outside array bounds.
ToolkitException
- with the following reason codes: HANDLER_OVERFLOW
if the ProactiveHandler buffer is to small to put the requested datapublic void initCloseChannel(byte bChannelIdentifier)
bChannelIdentifier
- the channel identifier of the channel to be closedpublic short getCapacity() throws ToolkitException
ToolkitException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |