|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sim.toolkit.ToolkitRegistry
The ToolkitRegistry
class offers basic services and methods to allow
any Toolkit applet to register its configuration (supported events) during
the install phase and possibly to change it during all the applet life time.
Each toolkit applet will get a reference to its registry entry with the static
method getEntry
. The initial state of all the events is cleared.
Note: the constants related to the events are defined in the ToolkitConstants
interface.
Example of use:
public class MyToolkitApplet extends Applet implements ToolkitInterface, ToolkitConstants {
// data fields
private ToolkitRegistry reg;
private byte[] menuEntry = { ... };
private byte menuId;
//
// Constructor of applet
//
public MyToolkitApplet() {
// get the reference of the applet ToolkitRegistry object ...
reg = ToolkitRegistry.getEntry();
// ...and initialize it according to the applet characteristics
menuId = reg.initMenuEntry(menuEntry, (short)0, (short)menuEntry.length,
PRO_CMD_SET_UP_CALL, false, 0, 0);
reg.disableMenuEntry(menuId);
reg.setEvent(EVENT_FORMATTED_SMS_PP_ENV);
reg.setEvent(EVENT_CALL_CONTROL_BY_SIM);
}
//
// Install method
// *param bArray the array containing installation parameters
// *param bOffset the starting offset in bArray
// *param bLength the length in bytes of the parameter data in bArray
//
public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
// create and register applet
MyToolkitApplet applet = new MyToolkitApplet();
applet.register();
}
//
// Process toolkit events
// *param event the type of event to be processed
// *exception ToolkitException
//
public void processToolkit(byte event) throws ToolkitException {
if (event == EVENT_FORMATTED_SMS_PP_ENV) {
reg.enableMenuEntry(menuId);
} else if (event == EVENT_MENU_SELECTION) {
//...
}
}
}
ToolkitInterface
,
ToolkitException
,
ToolkitConstants
Method Summary | |
byte |
allocateTimer()
Asks the Toolkit framework to allocate a Timer that the applet can manage. |
void |
changeMenuEntry(byte id,
byte[] menuEntry,
short offset,
short length,
byte nextAction,
boolean helpSupported,
byte iconQualifier,
short iconIdentifier)
Changes the value of a menu entry. |
void |
clearEvent(byte event)
Clears an event in the Toolkit Registry entry of the applet. |
void |
disableMenuEntry(byte id)
Disables a menu entry. |
void |
enableMenuEntry(byte id)
Enables a menu entry. |
static ToolkitRegistry |
getEntry()
This method is used by the Toolkit applet to get a reference to its Toolkit Registry entry, so that it can handle its registration state to the toolkit events. |
short |
getPollInterval()
Returns the number of seconds of the adjusted duration for the calling toolkit applet. |
byte |
initMenuEntry(byte[] menuEntry,
short offset,
short length,
byte nextAction,
boolean helpSupported,
byte iconQualifier,
short iconIdentifier)
Initialises the next menu entry allocated at loading. |
boolean |
isEventSet(byte event)
Allows to know if an event is set in the Toolkit Registry entry of the applet. |
void |
releaseTimer(byte timerIdentifier)
Release a Timer that has been allocated to the calling applet. |
void |
requestPollInterval(short duration)
Requests a duration for the EVENT_STATUS_COMMAND event of the registering toolkit applet. |
void |
setEvent(byte event)
Sets an event in the Toolkit Registry entry of the applet. |
void |
setEventList(byte[] eventList,
short offset,
short length)
Sets an event list in the Toolkit Registry entry of the applet. |
Methods inherited from class java.lang.Object |
equals |
Method Detail |
public static ToolkitRegistry getEntry() throws ToolkitException
public void setEvent(byte event) throws ToolkitException
event
- value of the new event to register (between -128 and 127)public void setEventList(byte[] eventList, short offset, short length) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
eventList
- buffer containing the list of the new events to registeroffset
- offset in the eventlist buffer for event registrationlength
- length in the eventlist buffer for event registrationeventlist
is null
offset
or length
or both would cause access outside array boundspublic void clearEvent(byte event) throws ToolkitException
event
- the value of the event to unregister (between -128 and 127)public boolean isEventSet(byte event)
event
- the value of the event (between -128 and 127)public void disableMenuEntry(byte id) throws ToolkitException
id
- the menu entry identifier supplied by the initMenuEntry()
methodpublic void enableMenuEntry(byte id) throws ToolkitException
id
- the menu entry identifier supplied by the initMenuEntry()
methodpublic byte initMenuEntry(byte[] menuEntry, short offset, short length, byte nextAction, boolean helpSupported, byte iconQualifier, short iconIdentifier) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
helpSupported
boolean parameter
defines the registration status of the applet to the event
EVENT_MENU_SELECTION_HELP_REQUEST. The applet is registered to
the EVENT_MENU_SELECTION. The icon identifier provided will be added to
the icon identifier list of the item icon identifier list Simple TLV if
all the applets registered to the EVENT_MENU_SELECTION provide it.
The Icon list qualifier transmitted to the ME will be 'icon is not self
explanatory' if one of the applet registered prefers this qualifier.
This method shall be called by the applet in the same order than the
order of the item parameters defined at the applet loading if the applet
has several menu entries. The applet shall initialise all its loaded
menu entries during its installation.menuEntry
- a reference on a byte array, containing the menu entry stringoffset
- offset of the menu entry string in the bufferlength
- length of the menu entry stringnextAction
- a byte coding the next action indicator for the menu entry (or 0)helpSupported
- equals true if help is available for the menu entryiconQualifier
- the preferred value for the icon list qualifiericonIdentifier
- the icon identifier for the menu entry (0 means no icon)menuEntry
is null
offset
or length
or both would cause access outside array boundspublic void changeMenuEntry(byte id, byte[] menuEntry, short offset, short length, byte nextAction, boolean helpSupported, byte iconQualifier, short iconIdentifier) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitException
helpSupported
boolean
parameter defines the registration status of the EVENT_MENU_SELECTION_HELP_REQUEST
event. The icon identifier provided will be added to the icon identifier list
of the item icon identifier list Simple TLV if all the applets registered
to the EVENT_MENU_SELECTION provide it.
The Icon list qualifier transmitted to the ME will be 'icon is not self
explanatory' if one of the applet registered prefers this qualifier.
After the invocation of this method, during the current card session, the SIM Toolkit Framework
shall dynamically update the menu stored in the ME.id
- the menu entry identifier supplied by the initMenuEntry()
methodmenuEntry
- a reference on a byte array, containing the menu entry stringoffset
- the position of the menu entry string in the bufferlength
- the length of the menu entry stringnextAction
- a byte coding the next action indicator for the menu entry (or 0)helpSupported
- equals true if help is available for the menu entryiconQualifier
- the preferred value for the icon list qualifiericonIdentifier
- the icon identifier for the menu entry (0 means no icon)menuEntry
is null
offset
or length
or both would cause access outside array boundspublic byte allocateTimer() throws ToolkitException
public void releaseTimer(byte timerIdentifier) throws ToolkitException
timerIdentifier
- the identifier of the Timer to be releasedpublic void requestPollInterval(short duration) throws ToolkitException
duration
- specifies the number of seconds requested for proactive polling.
The maximum value of duration
is 15300
(255 minutes).
If duration is equal to POLL_NO_DURATION
,
the calling applet deregisters from EVENT_STATUS_COMMAND, and
the SIM Toolkit Framework may issue the POLLING OFF proactive command.
If duration is equal to POLL_SYSTEM_DURATION
,
the calling applet registers to the EVENT_STATUS_COMMAND and let
the SIM Toolkit Framework define the duration.- Throws:
- ToolkitException - with the following reason codes:
- REGISTRY_ERROR if
duration
is greater than the maximum value.
public short getPollInterval()
POLL_NO_DURATION, the toolkit
applet is not registered to EVENT_STATUS_COMMAND event.
The returned duration may :
- be a multiple of the real adjusted poll interval time at the ME.
- differ from the requested duration due to request of other toolkit
applets or due to restrictions of the current ME.
- be changed during the card session due requests from other toolkit applets.
- be wrong due to direct generation of the proactive command POLL INTERVAL or POLLING OFF.
- not correspond to the ellasped time due to additional STATUS commands send by the ME.
- Returns:
- the number of seconds of the adjusted duration for the applet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |