| This interface must be implemented by a Toolkit applet (which extends
the javacard.framework.Applet class) so that it can be
triggered by the Toolkit Handler according to the registration information.
The Toolkit applet will have to implement the processToolkit shared method
so that it can be notified of the following events :
EVENT_PROFILE_DOWNLOAD
EVENT_FORMATTED_SMS_PP_ENV
EVENT_FORMATTED_SMS_PP_UPD
EVENT_UNFORMATTED_SMS_PP_ENV
EVENT_UNFORMATTED_SMS_PP_UPD
EVENT_UNFORMATTED_SMS_CB
EVENT_MENU_SELECTION
EVENT_MENU_SELECTION_HELP_REQUEST
EVENT_CALL_CONTROL_BY_SIM
EVENT_MO_SHORT_MESSAGE_CONTROL_BY_SIM
EVENT_TIMER_EXPIRATION
EVENT_EVENT_DOWNLOAD_MT_CALL
EVENT_EVENT_DOWNLOAD_CALL_CONNECTED
EVENT_EVENT_DOWNLOAD_CALL_DISCONNECTED
EVENT_EVENT_DOWNLOAD_LOCATION_STATUS
EVENT_EVENT_DOWNLOAD_USER_ACTIVITY
EVENT_EVENT_DOWNLOAD_IDLE_SCREEN_AVAILABLE
EVENT_EVENT_DOWNLOAD_CARD_READER_STATUS
EVENT_STATUS_COMMAND
EVENT_UNRECOGNIZED_ENVELOPE
Toolkit applet example :
import javacard.framework.*;
import sim.toolkit.*;
//
// The HelloWorld class is a simple Toolkit applet, which may be used as an
// example to show how such an applet will be installed and registered and
// how it will be triggered.
//
public class HelloWorld extends Applet implements
ToolkitInterface,ToolkitConstants {
// data fields
private static final byte CMD_QUALIFIER = (byte)0x80;
private byte[] menuEntry = {'S','e','r','v','i','c','e','1'};
private byte[] textBuf = {'H','e','l','l','o',' ',
'w','o','r','l','d',' ','!'};
private ToolkitRegistry reg;
//
// Constructor of applet
//
public HelloWorld() {
// get a Registry object...
// ...and initialize it according to the applet characteristics
reg.initMenuEntry(menuEntry, (short)0, (short)menuEntry.length,
PRO_CMD_DISPLAY_TEXT, false, 0, 0);
}
//
// 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
HelloWorld HelloWorldApplet = new HelloWorld();
HelloWorldApplet.register();
}
//
// Process toolkit events
// *param event the type of event to be processed
// *exception ToolkitException
//
public void processToolkit(byte event) throws ToolkitException {
// get the ProactiveHandler system instance
ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
if (event == EVENT_MENU_SELECTION) {
// prepare a Display Text command
proHdlr.init((byte) PRO_CMD_DISPLAY_TEXT,
(byte)CMD_QUALIFIER, (byte)0x02);
proHdlr.appendTLV((byte)(TAG_TEXT_STRINGTAG_SET_CR), textBuf,
(short)0, (short)textBuf.length);
proHdlr.send();
}
}
}
version: 8.3.0 See Also: ToolkitRegistry See Also: ToolkitException See Also: ToolkitConstants |