public interface ProxyReader extends Reader
Reader
for communicating with cards.
Exchanges are made using CardSelectionRequest
/CardRequest
which in return
result in CardSelectionResponse
/CardResponse
.
The CardSelectionRequest
includes the card selection data and an optional APDU list.
The CardSelectionRequest
contains the result of the selection and the optional responses
to the APDUs.
The CardRequest
are transmitted individually (transmitCardRequest(CardRequest,
ChannelControl)
or by a list transmitCardSelectionRequests(List,
MultiSelectionProcessing, ChannelControl)
allowing applications to provide several selection
patterns with various options.
releaseChannel()
is used to control the closing of logical and physical channels
taking into account the observation mechanisms potentially in progress.
Modifier and Type | Method and Description |
---|---|
void |
releaseChannel()
Release the communication channel previously established with the card.
|
CardResponse |
transmitCardRequest(CardRequest cardRequest,
ChannelControl channelControl)
Transmits a single
CardRequest passed as an argument and returns a CardResponse . |
java.util.List<CardSelectionResponse> |
transmitCardSelectionRequests(java.util.List<CardSelectionRequest> cardSelectionRequests,
MultiSelectionProcessing multiSelectionProcessing,
ChannelControl channelControl)
Transmits the list of
CardSelectionRequest and gets in return a list of CardSelectionResponse . |
activateProtocol, deactivateProtocol, getName, isCardPresent, isContactless
java.util.List<CardSelectionResponse> transmitCardSelectionRequests(java.util.List<CardSelectionRequest> cardSelectionRequests, MultiSelectionProcessing multiSelectionProcessing, ChannelControl channelControl)
CardSelectionRequest
and gets in return a list of CardSelectionResponse
.
The actual processing of each CardSelectionRequest
is similar to that performed by
transmitCardRequest(CardRequest, ChannelControl)
(see this method for further
explanation of how the process works).
If the multiSelectionProcessing parameter equals to MultiSelectionProcessing.FIRST_MATCH
, the iteration over the CardSelectionRequest
list
is interrupted at the first processing that leads to an open logical channel state. In this
case, the list of CardSelectionResponse
may be shorter than the list of CardSelectionRequest
provided as input.
If it equals to MultiSelectionProcessing.PROCESS_ALL
, all the CardSelectionRequest
are processed and the logical channel is closed after each process.
The physical channel is managed by the ChannelControl parameter as in transmitCardRequest(CardRequest, ChannelControl)
.
In the case of a selection specifying a card protocol, it is imperative to activate it
previously with the method Reader.activateProtocol(String, String)
. An
IllegalStateException exception will be thrown in case of inconsistency.
cardSelectionRequests
- A not empty list of CardSelectionRequest
.multiSelectionProcessing
- The multi card processing flag (must be not null).channelControl
- indicates if the physical channel has to be closed at the end of the
processing (must be not null).KeypleReaderIOException
- if the communication with the reader or the card has failedjava.lang.IllegalArgumentException
- if one of the arguments is null.java.lang.IllegalStateException
- in case of configuration inconsistency or reader is not
registered.CardResponse transmitCardRequest(CardRequest cardRequest, ChannelControl channelControl)
CardRequest
passed as an argument and returns a CardResponse
.
The process includes the following steps:
CardRequest
contains a non null CardSelector
. The 3 following
operations are performed in this order:
CardRequest
contains a list of APDUs to send (ApduRequest
) then
each APDU is sent to the card and its response (ApduResponse
is added to a new
list.
ChannelControl
is ChannelControl.CLOSE_AFTER
.
CardResponse
containing:
CardSelector
not null) a SelectionStatus
object containing the elements resulting from the selection.
KeypleReaderIOException
exception is thrown. Responses to previous APDUs are attached to this exception.CardRequest
.cardRequest
- The CardRequest
to be processed (must be not null).channelControl
- indicates if the physical channel has to be closed at the end of the
processing (must be not null).CardResponse
.KeypleReaderIOException
- if the communication with the reader or the card has failedjava.lang.IllegalArgumentException
- if one of the arguments is null or reader is not registered.void releaseChannel()
If the ProxyReader is not observable the logical and physical channels must be closed
instantly.
If the ProxyReader is observable, the closure of both channels must be the result of the
completion of a removal sequence.
TODO check how to make this conditional on the WAIT_FOR_SE_PROCESSING state.