Methods Summary |
---|
public boolean | checkSlotNumber(int slot)Checks if the global slot number belongs to the device.
return ((slot >= this.startSlotNumber) &&
(slot < this.startSlotNumber + getSlotCount()));
|
public abstract void | close()Closes the device.
No exceptions thrown to avoid mess in exception handlers trying
to clean up and close the device.
|
public void | closeSlot(int slot)Close the specified slot. This is for situations when slot closure
requires additional actions. By default doing nothing but this is
not an abstract method becuase most devices don't need it.
|
public void | cmdPowerDown()Performs 'POWER DOWN' command. By default does nothing.
|
protected abstract int | cmdReset(byte[] atr)Performs reset of device.
Returns ATR into provided buffer
|
protected abstract int | cmdXfer(byte[] request, byte[] response)Performs data transfer to the device.
|
public byte[] | getATR()Gets Answer-To-Reset bytes from the device.
return ATR;
|
public int | getSlotCount()Gets number of slots on a device. Default implementation returns 1 which
is ok for most devices.
return 1;
|
public int | getStartSlotNumber()Gets start slot number in the global slot numbering scheme.
return this.startSlotNumber;
|
public abstract void | init()Initializes the device.
|
public abstract boolean | isCardChanged()Checks if the card in the selected slot was changed
since last call or since last reset.
Called after any transfer operation, so
implementation can check and store that status during
this operation.
|
public boolean | isSatSlot(int slotNumber)Checks if this slot is SAT slot. Default implementation returns true
if slotNumber is 0.
return slotNumber == DEFAULT_SAT_SLOT;
|
public abstract void | lock()Performs platform lock of the device. This is intended to make
sure that no other native application
uses the same device during a transaction.
|
public void | openSlot(int slot, SecurityToken token)Open the specified slot. This is for situations when slot creation
requires additional actions. By default doing nothing but this is
not an abstract method because most devices don't need it.
|
public void | reset()Resets the device. Wrapper method for
cmdReset .
int bytes_read;
byte[] r = new byte[255];
bytes_read = cmdReset(r);
if (bytes_read > 0) {
ATR = new byte[bytes_read];
System.arraycopy(r, 0, ATR, 0, bytes_read);
} else
throw new IOException("Empty ATR");
|
public abstract void | selectSlot(int slot)Selects the current slot for the subsequent transfer operations.
For the one-slot devices the default slot number is 0.
|
public void | setStartSlotNumber(int slot)Stores start slot number.
this.startSlotNumber = slot;
|
public abstract void | unlock()Unlocks the device.
|
public int | xfer(byte[] request, byte[] response)Performs data transfer to the device. Wrapper
method for cmdXfer .
return cmdXfer(request, response);
|