FileDocCategorySizeDatePackage
Handle.javaAPI DocphoneME MR2 API (J2ME)3319Wed May 02 18:00:38 BST 2007com.sun.midp.io.j2me.apdu

Handle

public class Handle extends Object
This class represents a handle for APDU connection.

Fields Summary
int
slot
Slot number.
public int
channel
Logical channel number.
Slot
cardSlot
Slot object.
boolean
opened
Is this connection opened?
public com.sun.midp.security.SecurityToken
token
Security token used by this connection.
byte[]
FCI
FCI received from selected application.
public int
cardSessionId
Unique identifier of card session (period of time between card power up and powerdown) during which the connection was created.
int
handleInstance
Unique identifier of Handle instance. It is used for debugging purposes.
private static int
instanceNo
Counter for handleInstance generation. It is used for debugging purposes.
Constructors Summary
Handle(int slot, int channel, com.sun.midp.security.SecurityToken token)
Creates a new handle with specified parameters.

param
slot slot number
param
channel channel number
param
token security token

    
                            
          

        this.slot = slot;
        this.channel = channel;
        this.token = token;
        this.cardSlot = APDUManager.slots[slot];
        this.FCI = cardSlot.FCI;
        this.opened = true;
        this.cardSessionId = cardSlot.cardSessionId;
        this.handleInstance = instanceNo++;
    
Methods Summary
public byte[]getATR()
Returns ATR of the card.

return
ATR.

        return APDUManager.getATR(slot);
    
public intgetCardSessionId()
Returns current cardSessionId of the slot.

return
cardSessionId.

        return cardSlot.cardSessionId;
    
public byte[]getFCI()
Returns FCI of the selected application.

return
FCI.

        if (FCI != null && opened && cardSlot.powered && 
                cardSessionId == cardSlot.cardSessionId) {
            int len = FCI.length;
            byte[] result = new byte[len];
            System.arraycopy(FCI, 0, result, 0, len);
            return result;
        }
        return null;