public class SAM
extends java.lang.Object
Example Usage: List<SAM> connectedSAMList = samManager.enumerateSAMs(); SAM sam = connectedSAMList.get(0); SAMType samType = sam.getSamType(); SAMType SAMStatus = sam.getSamStatus(); sam.connect(); sam.transceive(byte[],short,boolean); sam.disconnect();
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the SAM.
|
void |
disconnect()
Disconnects from SAM.
|
int |
getSamIndex()
This method will return the slot index of the SAM.
|
SAMType |
getSamType()
This method will return the type of the SAM (i.e MIFARE, CALYPSO, FELICA)
|
byte[] |
getSmartCardATR()
Gets the SmartCard ATR.
|
boolean |
isConnected()
This method will return the current SAM status whether the SAM is connected or not.
|
int |
setSmartCardPPS(byte fd,
byte protocol)
Sets the SmartCard PPS (Protocol and Parameters Selection).
|
byte[] |
transceive(byte[] apdu,
short responseLength,
boolean userFormattedProtocolFrame)
The method will be used to send the APDUs to the SAM.
|
public void connect() throws SAMException
Example Usage: sam.connect();
SAMException
- The exception will thrown if the connection to the SAM fails.public void disconnect()
Example Usage: sam.disconnect();
public byte[] transceive(byte[] apdu, short responseLength, boolean userFormattedProtocolFrame) throws SAMException
Example Usage: sam.transceive(byte[],short,boolean);
apdu
- Command APDUresponseLength
- Length of expected response. Pass this parameter as 0, when expected response length is unknown while calling this API.userFormattedProtocolFrame
- This parameter applicable for only T1 protocol. Typically user will provide this parameter as false. true: User provides frame header, Command APDU (C-APDU) and trailer. false: User provides only Command APDU (C-APDU). Typically user will provide this parameter as false.SAMException
- Exception will be thrown if any error occurs while executing transceive callpublic boolean isConnected()
public SAMType getSamType()
public int getSamIndex()
public byte[] getSmartCardATR() throws SAMException
Example Usage: sam.getSmartCardATR();
SAMException
- Exception will be thrown if any error occurs while executing the API call.public int setSmartCardPPS(byte fd, byte protocol) throws SAMException
Example Usage: int result = sam.setSmartCardPPS(byte); if(result==0){ //Success }else{ //failure }
fd
- fd - Dividers for calculating the correct SAM clock.
fd= Fi/Di ratioSAMException