public class CardTerminal
extends java.lang.Object
Note that physical card readers with slots for multiple cards are
represented by one CardTerminal
object per such slot.
Modifier | Constructor and Description |
---|---|
protected |
CardTerminal(PCSC master,
int slotNumber)
Constructs a new CardTerminal object.
|
Modifier and Type | Method and Description |
---|---|
void |
bulkOUT(byte[] data)
Wrapper for bulkOUT request
USB communication is done in PCSC object
|
Card |
connect(java.lang.String cnxString)
Establishes a connection to the card.
|
byte[] |
createTestAPDU(int in,
int out)
Create a variable length APDU
|
ResponseAPDU |
getAPDU()
Get last APDU for this slot/card
|
ATR |
getATR()
Get ATR for this slot
|
java.lang.Boolean |
getCardValid()
get card state for this terminal (slot)
|
protected int |
getmSequenceNumber()
Get and post-increment current sequence number
|
java.lang.String |
getName()
mReader's name
|
android.hardware.usb.UsbDevice |
getReaderDevice()
Get current USB device linked to this object
|
int |
getSlotNumber()
Get linked slot
|
void |
getSlotStatus(byte slotNumber)
Get slot status
|
java.lang.Boolean |
isCardPresent()
Is the a card on this mReader (slot) ?
|
protected void |
powerDOWN(byte slotNumber)
Ask to power down the card
|
protected void |
powerUP(byte slotNumber)
Ask to power up the card
|
byte[] |
sendEscape(byte slotNumber,
byte[] data)
Send escape command to the terminal
|
void |
setAPDU(ResponseAPDU apdu)
Store APDU for this slot/card
|
protected void |
setATR(ATR atr)
Store ATR for this slot
|
protected void |
setCardState(boolean present)
Change card state for this terminal (slot)
|
protected void |
setCardValid(boolean present)
Change card state for this terminal (slot)
|
void |
waitAPDU()
Prepare to wait for an APDU transaction (ie a response from the card)
|
ResponseAPDU |
waitRAPDU()
Wait 'forever' for an APDU answer
|
protected CardTerminal(PCSC master, int slotNumber)
master
- caller's mContextslotNumber
- current terminal slotpublic android.hardware.usb.UsbDevice getReaderDevice()
protected void setCardValid(boolean present)
present
- card's statepublic java.lang.Boolean getCardValid()
protected void setCardState(boolean present)
present
- card's stateprotected void powerUP(byte slotNumber)
slotNumber
- slot numberprotected void powerDOWN(byte slotNumber)
slotNumber
- slot numberpublic void getSlotStatus(byte slotNumber)
slotNumber
- slot numberpublic byte[] sendEscape(byte slotNumber, byte[] data)
data
- Escape data to sendpublic int getSlotNumber()
protected int getmSequenceNumber()
public java.lang.String getName()
public Card connect(java.lang.String cnxString)
cnxString
- the protocol to use. "*" to
connect using any available protocol.protected void setATR(ATR atr)
atr
- new mATR to storepublic ATR getATR()
public void setAPDU(ResponseAPDU apdu)
apdu
- mAPDU to storepublic ResponseAPDU getAPDU()
public void bulkOUT(byte[] data)
data
- data to sendpublic java.lang.Boolean isCardPresent()
public void waitAPDU()
public ResponseAPDU waitRAPDU()
public byte[] createTestAPDU(int in, int out)
in
- size of data we want to receiveout
- size of data we send