The Cad class maintains the context for the client (terminal) side
of the terminal CAD connection. This class is responsible for sending
APDUs to the card, receiving back the responses and automatically
receiving a response if status '61 XX' is received from the
card.
Inner Class :class TempByteArray
Field Summary
boolean
SIMPresent Indicates if slot is the SAT slot and a SIM is installed on it.
Constructor Summary
Cad(int slot, SecurityToken securityToken) Constructor for CADClient.
closeChannel(int channel) This method is used to close connection with the card.
byte[]
exchangeApdu(Handle h, byte[] commandAPDU) Exchange an Apdu with a CAD.
Parameters: h - Handle of the connection. Parameters: commandAPDU - APDU data in byte array form.
getATR() This method returns the ATR received from the card that this
CadClient object is used to communicate with.
ATR information received from the card at startup orreset.
isAlive() Checks if the the connection is still live or not.
int
selectApplication(boolean forSAT, byte[] selectAPDU) This method is called when there is a connection creation is
in progress
and specifically card application selection is required.
This method also does the channel management part.
Indicates if slot is the SAT slot and a SIM is installed on it.
This flag is set in Cad.selectApplication.
It is cleared when Cad.isAlive detects the death of connection or
Cad.getATR is not able to reset the card.
Constructor for CADClient.
Parameters: slot - Global slot number Parameters: securityToken - Security token for this class throws: IOException - if there any problems in opening the socket orstreams or powering up the card.
This method is used to close connection with the card. If the
channel number passed to this method is for basic channel then
the basic channel is marked as available and nothing is
communicated with the card.
If the channel is not the basic channel, a request to close the
channel is sent to the card.
Parameters: channel - channel number exception: IOException - if a communication error happens
Exchange an Apdu with a CAD.
Parameters: h - Handle of the connection. Parameters: commandAPDU - APDU data in byte array form. response APDU data in byte array form. exception: InterruptedIOException - if connection was closed in theother thread. exception: IOException - if a communication error happens whilecommunicating with the CAD.
This method returns the ATR received from the card that this
CadClient object is used to communicate with.
ATR information received from the card at startup orreset. In case of I/O troubles returns null.
Checks if the the connection is still live or not.
true if the connection is alive
selectApplication
int selectApplication(boolean forSAT, byte[] selectAPDU) throws IOException(Code)
This method is called when there is a connection creation is
in progress
and specifically card application selection is required.
This method also does the channel management part. If basic channel
is available for use, this method tries to select the target
application
on the basic channel. Otherwise, it requests the card for the channel
and attempts to select the application on that particular channel.
If the selection is
successful, this method returns the logical channel reserved for
communicating with the selected card application.
Parameters: forSAT - true if selection is made for SAT connection Parameters: selectAPDU - byte encoded selection APDU exception: ConnectionNotFoundException - when selection is not successful exception: IOException - if no channel is available for communicationestablishment or there are communication problems. exception: IllegalArgumentException - if bad APDU provided. response apdu from the select application request