Fields Summary |
---|
static final short | MAX_BUFFER_LENGTHMaximum length of in and out buffers |
static final byte | MAX_LISTENERSMaximum number of listeners allowed |
short | outDataSizeSize used by the GSM applet to send data when
responding to GET RESPONSE |
public byte[] | inBufferBuffer that holds the data received from the terminal. |
public byte[] | outBufferBuffer that holds the data to be sent to the terminal. |
private byte[] | apduBufferBuffer that holds the APDU data. |
private short | apduBufferLengthLength of APDU buffer. |
public sim.toolkit.ToolkitInterface[] | tiListA list of listeners for EVENT_SMS_PP_DATA_DOWNLOAD. |
Methods Summary |
---|
public void | clearEventListener(javacard.framework.AID aid)Removes the event listener from the list of listeners.
ToolkitInterface ti = (ToolkitInterface)
JCSystem.getAppletShareableInterfaceObject(aid, (byte)0);
if (ti == null) {
return;
}
byte index = findListener(ti);
if (index != (byte)-1) {
// remove listener
tiList[index] = null;
}
|
private byte | findListener(sim.toolkit.ToolkitInterface ti)Finds a listener in the list of listener
for (byte i = 0; i < MAX_LISTENERS; i++) {
if (tiList[i] != null) {
if (tiList[i].equals(ti))
return i;
}
}
return (byte)-1;
|
public byte[] | getAPDUBuffer()Returns the APDUBuffer.
return apduBuffer;
|
public byte | getAPDUBufferByte(short index)Gets one byte from the APDUBuffer.
if (index >= MAX_BUFFER_LENGTH || index >= apduBufferLength) {
return (byte)0;
} else {
return apduBuffer[index];
}
|
public short | getAPDUBufferLength()Gets the length of the APDUBuffer.
return apduBufferLength;
|
public short | getAPDUBufferMax()Gets the maximum length of the APDUBuffer.
return MAX_BUFFER_LENGTH;
|
public short | getOutDataLength()Returns the length of Data that has been set in the out buffer.
return outDataSize;
|
public boolean | isEventListenerSet(javacard.framework.AID aid)Returns true if the applet corresponding to the AID passed to this
method is found in the list of listeners.
ToolkitInterface ti = (ToolkitInterface)
JCSystem.getAppletShareableInterfaceObject(aid, (byte)0);
if (ti == null) {
return false;
}
byte index = findListener(ti);
if (index != (byte)-1) {
return true;
}
return false;
|
void | resetBuffers()Resets the buffers and fields when a new envelope is received
Util.arrayFillNonAtomic(inBuffer, (short)0,
MAX_BUFFER_LENGTH, (byte)0);
Util.arrayFillNonAtomic(outBuffer, (short)0,
MAX_BUFFER_LENGTH, (byte)0);
outDataSize = (short)0;
apduBufferLength = (short)0;
|
public void | setAPDUBuffer(byte[] buffer, short length)Sets the APDUBuffer.
Util.arrayCopyNonAtomic(buffer, (short)0, apduBuffer, (short)0, length);
Util.arrayCopyNonAtomic(buffer, (short)0, inBuffer, (short)0, length);
apduBufferLength = length;
|
public void | setAPDUBufferByte(short index, byte value)Sets one byte from the APDUBuffer.
if (index < MAX_BUFFER_LENGTH) {
if (index > apduBufferLength) {
apduBufferLength = index;
}
apduBuffer[index] = value;
}
|
public void | setEventListener(javacard.framework.AID aid)Sets the event listener applet.
ToolkitInterface ti = (ToolkitInterface)
JCSystem.getAppletShareableInterfaceObject(aid, (byte)0);
if (ti == null) {
ToolkitException.throwIt(ToolkitException.BAD_INPUT_PARAMETER);
}
// if listener hasn't already registered, register it for this event
if (findListener(ti) == (byte)-1) {
for (short i = 0; i < MAX_LISTENERS; i++) {
if (tiList[i] == null) {
tiList[i] = ti;
break;
}
}
}
|
public void | setOutBufferData(short length)Sets the data in the out buffer.
byte[] buffer = apduBuffer;
outDataSize = Util.arrayCopy(buffer, (short)0,
outBuffer,
outDataSize,
length);
// restore the bytes from the original command APDU in
// the APDU buffer because the data recieved in the
// envelope is suppose to be available while
// in processToolkit method
Util.arrayCopy(inBuffer, (short)0, buffer,
(short)0, (short)length);
|
public void | setOutgoingAPDU()This method is called by GSMApplet to set the data in the APDU buffer
so that it can be sent to the terminal in response to a
GET RESPONSE APDU.
// this will be called when there is data to be sent
byte[] buffer = apduBuffer;
Util.arrayCopy(outBuffer, (short)0, buffer, (short)0, outDataSize);
|