public interface ICardChannel
Interface to a (logical) channel of a smart card. A channel object is used to send commands to and to receive answers from a smartcard. This is done by sneding so called A-PDUs ICommandApduto smartcard. A smartcard returns a IResponseApdu An ICardChannel object can be obtained by calling the method ICard.openBasicChannel() or ICard.openLogicalChannel().
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this ICardChannel.
|
ICard |
getCard()
Returns the Card this channel is associated with.
|
int |
getChannelNumber()
Returns the channel number of this CardChannel.
|
int |
getMaxMessageLength()
Max length of APDU body in bytes.
|
int |
getMaxResponseLength()
Max length of an APDU response.
|
boolean |
isExtendedLengthSupported()
Identify whether a channel supports APDU extended length commands and
appropriate responses
|
IResponseApdu |
transmit(ICommandApdu command)
Transmits the specified ICommandApdu to the associated smartcard and returns the
IResponseApdu.
|
ICard getCard()
Returns the Card this channel is associated with.
int getChannelNumber()
Returns the channel number of this CardChannel. A channel number of 0 indicates the basic channel.
java.lang.IllegalStateException - if this channel has been closed or
if the corresponding Card has been disconnected.boolean isExtendedLengthSupported()
Identify whether a channel supports APDU extended length commands and appropriate responses
int getMaxMessageLength()
Max length of APDU body in bytes.
int getMaxResponseLength()
Max length of an APDU response.
IResponseApdu transmit(ICommandApdu command) throws CardException
Transmits the specified ICommandApdu to the associated smartcard and returns the IResponseApdu.
The CLA byte of the ICommandApdu is automatically adjusted to match the channel number of this card channel since the channel number is coded into CLA byte of a command APDU according to ISO 7816-4.
Note that this method should be used to transmit MANAGE CHANNEL APDUs in order to open or
close logical channels. Logical channels should be managed using the
ICard.openLogicalChannel() and CardChannel.close() methods.
Implementations should transparently handle artifacts of the transmission protocol.
The ResponseAPDU returned by this method is the result after this processing has been performed.
command - the command APDU to be send to the smartcardjava.lang.IllegalStateException - if this channel has been closed or if the corresponding Card has been disconnected.java.lang.NullPointerException - if command is nullCardException - if the card operation failedvoid close()
throws CardException
Closes this ICardChannel. The logical channel is closed by issuing a MANAGE CHANNEL command that should use the format
[xx 70 80 0n] where n is the channel number of this channel and xx is the CLA byte that encodes this
logical channel and has all other bits set to 0. After this method returns, calling other methods in this class will raise an IllegalStateException.
Note: the basic channel cannot be closed using this method. It can be closed by calling ICard.disconnect(boolean).
CardException - if the card operation failedjava.lang.IllegalStateException - if this CardChannel represents a connection the basic logical channel