FileDocCategorySizeDatePackage
SATApplet.javaAPI DocphoneME MR2 API (J2ME)3109Wed May 02 18:00:40 BST 2007com.sun.satsa.satapplet

SATApplet

public class SATApplet extends SATBaseApplet
An example SAT applet to demonstrate how an SAT applet can be written.

Fields Summary
private ToolkitRegistry
reg
Instance to toolkit registry which is used to register for events
Constructors Summary
private SATApplet()
Constructor.

        // have to call register before getting the toolkit registry 
        // object
        register();
        // EVENT_UNFORMATTED_SMS_PP_ENV
        // register to the SIM Toolkit Framework
        reg = ToolkitRegistry.getEntry();
        // register to the EVENT_UNFORMATTED_SMS_PP_ENV
        reg.setEvent(EVENT_UNFORMATTED_SMS_PP_ENV);
    
Methods Summary
public static voidinstall(byte[] bArray, short bOffset, byte bLength)
Applet's install method. Creates an instance of SATApplet.

param
bArray parameters array
param
bOffset offset in the parameters array
param
bLength length of parameters

        new SATApplet();
    
public voidprocessToolkit(byte event)
Process method called by GSMApplet when an evelope is received.

param
event Event which should be processed

        EnvelopeHandler          envHdlr = EnvelopeHandler.getTheHandler();
        EnvelopeResponseHandler  evpRspHdlr = 
                                    EnvelopeResponseHandler.getTheHandler();
        switch (event) {
            case EVENT_UNFORMATTED_SMS_PP_ENV:
                byte result = envHdlr.findTLV(TAG_SMS_TPDU, (byte)1);
                short length = envHdlr.getLength();
                byte[] rspBuffer = new byte[length];
                short rspLength = envHdlr.findAndCopyValue(TAG_SMS_TPDU, 
                                                    rspBuffer, (short)0);
                evpRspHdlr.appendArray(rspBuffer, (short)0, rspLength);
                evpRspHdlr.post(rspBuffer[(short)(length - 1)]);    
                break;
        }