Interface ProxyReaderApi
-
public interface ProxyReaderApi
Reader able to transmit card requests and having control over the physical channel.Backside of the org.calypsonet.terminal.reader.CardReader interface present in the Terminal Reader API.
An adapter of this interface must also implement CardReader.
To use this API, simply cast a CardReader as a ProxyReaderApi.
- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
releaseChannel()
Releases the communication channel previously established with the card.CardResponseApi
transmitCardRequest(CardRequestSpi cardRequest, ChannelControl channelControl)
Transmits aCardRequestSpi
, applies the providedChannelControl
policy and returns aCardResponseApi
.
-
-
-
Method Detail
-
transmitCardRequest
CardResponseApi transmitCardRequest(CardRequestSpi cardRequest, ChannelControl channelControl) throws ReaderBrokenCommunicationException, CardBrokenCommunicationException, UnexpectedStatusWordException
Transmits aCardRequestSpi
, applies the providedChannelControl
policy and returns aCardResponseApi
.The APDUs (
ApduRequestSpi
) contained in theCardRequestSpi
are sent to the card, their responses (ApduResponseApi
) are added to a new list (CardResponseApi
).Note: in case of an error when sending an APDU (communication error, unexpected status word), an
AbstractApduException
exception is thrown. Any responses from previously transmitted APDU commands are attached to this exception.
This allows the calling application to be tolerant to card tearing and to retrieve the partial response to theCardRequestSpi
or to have strict control over the APDUs sent to the card (seeCardRequestSpi.stopOnUnsuccessfulStatusWord()
).- Parameters:
cardRequest
- The card request.channelControl
- The channel control policy to apply.- Returns:
- A not null reference.
- Throws:
java.lang.IllegalArgumentException
- If one of the provided parameters is null.ReaderBrokenCommunicationException
- If the communication with the reader has failed.CardBrokenCommunicationException
- If the communication with the card has failed.UnexpectedStatusWordException
- If any of the APDUs returned an unexpected status word and the card request specified the need to check them.- Since:
- 1.0.0
-
releaseChannel
void releaseChannel() throws ReaderBrokenCommunicationException
Releases the communication channel previously established with the card.- Throws:
ReaderBrokenCommunicationException
- If the communication with the reader has failed.- Since:
- 1.0.0
-
-