#include <AbstractLocalReader.h>
Inherits keyple::core::seproxy::plugin::AbstractReader.
Inherited by keyple::core::seproxy::plugin::AbstractObservableLocalReader.
|
| AbstractLocalReader (const std::string &pluginName, const std::string &readerName) |
|
virtual | ~AbstractLocalReader ()=default |
|
bool | isSePresent () override |
|
virtual bool | isLogicalChannelOpen () const final |
|
void | addSeProtocolSetting (std::shared_ptr< SeProtocol > seProtocol, const std::string &protocolRule) override |
|
virtual void | setSeProtocolSetting (const std::map< std::shared_ptr< SeProtocol >, std::string > &protocolSetting) override |
|
virtual std::shared_ptr< SelectionStatus > | openLogicalChannel (std::shared_ptr< SeSelector > seSelector) |
|
std::shared_ptr< SelectionStatus > | openLogicalChannelAndSelect (std::shared_ptr< SeSelector > seSelector) |
|
virtual std::vector< std::shared_ptr< SeResponse > > | processSeRequests (const std::vector< std::shared_ptr< SeRequest >> &seRequests, const MultiSeRequestProcessing &multiSeRequestProcessing, const ChannelControl &channelControl) override |
|
virtual std::shared_ptr< SeResponse > | processSeRequest (const std::shared_ptr< SeRequest > seRequest, const ChannelControl &channelControl) override |
|
virtual void | terminateSeCommunication ()=0 |
|
std::vector< std::shared_ptr< SeResponse > > | transmitSeRequests (const std::vector< std::shared_ptr< SeRequest >> &seRequests, const MultiSeRequestProcessing &multiSeRequestProcessing, const ChannelControl &channelControl) override |
|
std::shared_ptr< SeResponse > | transmitSeRequest (std::shared_ptr< SeRequest > seRequest, const ChannelControl &channelControl) override |
|
const std::string & | getPluginName () const |
|
const std::string & | getName () const override |
|
| AbstractSeProxyComponent (const std::string &name) |
|
virtual | ~AbstractSeProxyComponent ()=default |
|
const std::string & | getName () const |
|
void | setParameters (const std::map< const std::string, const std::string > ¶meters) |
|
virtual void | setParameter (const std::string &key, const std::string &value)=0 |
|
virtual | ~ProxyReader () |
|
virtual | ~SeReader () |
|
virtual const TransmissionMode & | getTransmissionMode () const =0 |
|
virtual bool | operator== (const SeReader &o) const |
|
virtual | ~ProxyElement ()=default |
|
virtual const std::map< const std::string, const std::string > & | getParameters () const =0 |
|
virtual void | setParameter (const std::string &key, const std::string &value)=0 |
|
virtual void | setParameters (const std::map< const std::string, const std::string > ¶meters) |
|
|
static bool | startsWith (const std::vector< uint8_t > &source, const std::vector< uint8_t > &match) |
|
Manage the loop processing for SeRequest transmission in a set and for SeResponse reception in a set
◆ AbstractLocalReader()
keyple::core::seproxy::plugin::AbstractLocalReader::AbstractLocalReader |
( |
const std::string & |
pluginName, |
|
|
const std::string & |
readerName |
|
) |
| |
Reader constructor
Force the definition of a name through the use of super method.
Initialize the time measurement
- Parameters
-
pluginName | the name of the plugin that instantiated the reader |
readerName | the name of the reader |
◆ ~AbstractLocalReader()
virtual keyple::core::seproxy::plugin::AbstractLocalReader::~AbstractLocalReader |
( |
| ) |
|
|
virtualdefault |
◆ addSeProtocolSetting()
void keyple::core::seproxy::plugin::AbstractLocalReader::addSeProtocolSetting |
( |
std::shared_ptr< SeProtocol > |
seProtocol, |
|
|
const std::string & |
protocolRule |
|
) |
| |
|
overridevirtual |
Defines the protocol setting Map to allow SE to be differentiated according to their communication protocol.
- Parameters
-
seProtocol | the protocol key identifier to be added to the plugin internal list |
protocolRule | a string use to define how to identify the protocol |
Implements keyple::core::seproxy::SeReader.
◆ checkSePresence()
virtual bool keyple::core::seproxy::plugin::AbstractLocalReader::checkSePresence |
( |
| ) |
|
|
protectedpure virtual |
Wrapper for the native method of the plugin specific local reader to verify the presence of the SE.
This method must be implemented by the ProxyReader plugin (e.g. Pcsc reader plugin).
This method is invoked by isSePresent.
- Returns
- true if the SE is present
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implemented in keyple::plugin::stub::StubReaderImpl, and keyple::plugin::pcsc::PcscReaderImpl.
◆ closeLogicalAndPhysicalChannels()
void keyple::core::seproxy::plugin::AbstractLocalReader::closeLogicalAndPhysicalChannels |
( |
| ) |
|
|
protected |
Close both logical and physical channels
◆ closeLogicalChannel()
void keyple::core::seproxy::plugin::AbstractLocalReader::closeLogicalChannel |
( |
| ) |
|
|
protected |
Close the logical channel.
◆ closePhysicalChannel()
virtual void keyple::core::seproxy::plugin::AbstractLocalReader::closePhysicalChannel |
( |
| ) |
|
|
protectedpure virtual |
◆ getATR()
virtual const std::vector<uint8_t>& keyple::core::seproxy::plugin::AbstractLocalReader::getATR |
( |
| ) |
|
|
protectedpure virtual |
◆ getProtocolsMap()
const std::map< std::shared_ptr< SeProtocol >, std::string > & keyple::core::seproxy::plugin::AbstractLocalReader::getProtocolsMap |
( |
| ) |
const |
|
protected |
- Returns
- the Map containing the protocol definitions set by addSeProtocolSetting and setSeProtocolSetting
◆ isLogicalChannelOpen()
bool keyple::core::seproxy::plugin::AbstractLocalReader::isLogicalChannelOpen |
( |
| ) |
const |
|
finalvirtual |
Tells if a logical channel is open
- Returns
- true if the logical channel is open
◆ isPhysicalChannelOpen()
virtual bool keyple::core::seproxy::plugin::AbstractLocalReader::isPhysicalChannelOpen |
( |
| ) |
|
|
protectedpure virtual |
◆ isSePresent()
bool keyple::core::seproxy::plugin::AbstractLocalReader::isSePresent |
( |
| ) |
|
|
overridevirtual |
Check the presence of a SE
This method is recommended for non-observable readers.
When the card is not present the logical and physical channels status may be refreshed through a call to the cardRemoved method.
- Returns
- true if the SE is present
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implements keyple::core::seproxy::SeReader.
Reimplemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.
◆ openLogicalChannel()
std::shared_ptr< SelectionStatus > keyple::core::seproxy::plugin::AbstractLocalReader::openLogicalChannel |
( |
std::shared_ptr< SeSelector > |
seSelector | ) |
|
|
virtual |
Build a select application command, transmit it to the SE and deduct the SelectionStatus.
- Parameters
-
seSelector | the targeted application SE selector |
- Returns
- the SelectionStatus containing the actual selection result (ATR and/or FCI and the matching status flag).
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
◆ openLogicalChannelAndSelect()
std::shared_ptr< SelectionStatus > keyple::core::seproxy::plugin::AbstractLocalReader::openLogicalChannelAndSelect |
( |
std::shared_ptr< SeSelector > |
seSelector | ) |
|
Open (if needed) a physical channel and try to establish a logical channel.
The logical opening is done either by sending a Select Application command (AID based selection) or by checking the current ATR received from the SE (ATR based selection).
If the selection is successful, the logical channel is considered open. On the contrary, if the selection fails, the logical channel remains closed.
- Parameters
-
seSelector | the SE Selector: either the AID of the application to select or an ATR selection regular expression |
- Returns
- a keyple::core::seproxy::message::SelectionStatus object containing the SE ATR, the SE FCI and a flag giving the selection process result. When ATR or FCI are not available, they are set to null but they can't be both null at the same time.
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
◆ openPhysicalChannel()
virtual void keyple::core::seproxy::plugin::AbstractLocalReader::openPhysicalChannel |
( |
| ) |
|
|
protectedpure virtual |
This abstract method must be implemented by the derived class in order to provide a selection and ATR filtering mechanism.
The Selector provided in argument holds all the needed data to handle the Application Selection and ATR matching process and build the resulting SelectionStatus.
- Parameters
-
seSelector | the SE selector |
- Returns
- the SelectionStatus Attempts to open the physical channel
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implemented in keyple::plugin::stub::StubReaderImpl, and keyple::plugin::pcsc::PcscReaderImpl.
◆ processApduRequest()
std::shared_ptr< ApduResponse > keyple::core::seproxy::plugin::AbstractLocalReader::processApduRequest |
( |
std::shared_ptr< ApduRequest > |
apduRequest | ) |
|
|
protected |
Transmits an ApduRequest and receives the ApduResponse
The time measurement is carried out and logged with the detailed information of the exchanges (TRACE level).
- Parameters
-
- Returns
- APDU response
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
◆ processSeRequest()
std::shared_ptr< SeResponse > keyple::core::seproxy::plugin::AbstractLocalReader::processSeRequest |
( |
const std::shared_ptr< SeRequest > |
seRequest, |
|
|
const ChannelControl & |
channelControl |
|
) |
| |
|
overridevirtual |
Executes a request made of one or more Apdus and receives their answers. The selection of the application is handled.
The physical channel is closed if requested.
- Parameters
-
seRequest | the SeRequest |
channelControl | indicates if the channel has to be closed at the end of the processing |
- Returns
- the SeResponse to the SeRequest
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
/!\ C++ vs. Java: this function is protected in Java
Implements keyple::core::seproxy::plugin::AbstractReader.
◆ processSeRequests()
Do the transmission of all requests according to the protocol flag selection logic.
The received responses are returned as list of keyple::core::seproxy::message::SeResponse The requests are ordered at application level and the responses match this order.
When a request is not matching the current PO, the response responses pushed in the response List object is set to null.
- Parameters
-
seRequests | the request list |
multiSeRequestProcessing | the multi se processing mode |
channelControl | indicates if the channel has to be closed at the end of the processing |
- Returns
- the response list
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
/!\ C++ vs. Java: this function is protected in Java
Implements keyple::core::seproxy::plugin::AbstractReader.
◆ protocolFlagMatches()
virtual bool keyple::core::seproxy::plugin::AbstractLocalReader::protocolFlagMatches |
( |
const std::shared_ptr< SeProtocol > |
protocolFlag | ) |
|
|
protectedpure virtual |
Test if the current protocol matches the provided protocol flag.
The method must be implemented by the ProxyReader plugin.
The protocol flag is used to retrieve from the protocolsMap the String used to differentiate this particular protocol. (e.g. in PC/SC the only way to identify the SE protocol is to analyse the ATR returned by the reader [ISO SE and memory card SE have specific ATR], in Android Nfc the SE protocol can be deduced with the TagTechnology interface).
- Parameters
-
protocolFlag | the protocol flag |
- Returns
- true if the current protocol matches the provided protocol flag
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implemented in keyple::plugin::stub::StubReaderImpl, and keyple::plugin::pcsc::PcscReaderImpl.
◆ setForceGetDataFlag()
void keyple::core::seproxy::plugin::AbstractLocalReader::setForceGetDataFlag |
( |
bool |
forceGetDataFlag | ) |
|
|
protectedvirtual |
Set the flag that enables the execution of the Get Data hack to get the FCI
This method should called by the reader plugins that need this specific behavior (ex. OMAPI)
The default value for the forceGetDataFlag is false, thus only specific readers plugins should call this method.
- Parameters
-
forceGetDataFlag | true or false |
◆ setSeProtocolSetting()
void keyple::core::seproxy::plugin::AbstractLocalReader::setSeProtocolSetting |
( |
const std::map< std::shared_ptr< SeProtocol >, std::string > & |
protocolSetting | ) |
|
|
overridevirtual |
Complete the current setting map with the provided map
- Parameters
-
protocolSetting | Alex: removed that function to avoid using a shared_ptr to SeProtocol (astract class, therefore cannot be used in a set/map) |
Implements keyple::core::seproxy::SeReader.
◆ startsWith()
bool keyple::core::seproxy::plugin::AbstractLocalReader::startsWith |
( |
const std::vector< uint8_t > & |
source, |
|
|
const std::vector< uint8_t > & |
match |
|
) |
| |
|
staticprotected |
Indicates whether this array of bytes starts with this other one
- Parameters
-
source | the byte array to examine |
match | the byte array to compare in source |
- Returns
- true if the starting bytes of
source
equal match
◆ terminateSeCommunication()
virtual void keyple::core::seproxy::plugin::AbstractLocalReader::terminateSeCommunication |
( |
| ) |
|
|
pure virtual |
◆ transmitApdu()
virtual std::vector<uint8_t> keyple::core::seproxy::plugin::AbstractLocalReader::transmitApdu |
( |
const std::vector< uint8_t > & |
apduIn | ) |
|
|
protectedpure virtual |
Transmits a single APDU and receives its response.
This abstract method must be implemented by the ProxyReader plugin (e.g. Pcsc, Nfc). The implementation must handle the case where the SE response is 61xy and execute the appropriate get response command.
- Parameters
-
apduIn | byte buffer containing the ingoing data |
- Returns
- apduResponse byte buffer containing the outgoing data.
- Exceptions
-
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implemented in keyple::plugin::stub::StubReaderImpl, and keyple::plugin::pcsc::PcscReaderImpl.
The documentation for this class was generated from the following files: