Keyple C++
0.9.0
Keyple, an Open Source SDK for Ticketing
|
#include <PcscReaderImpl.h>
Inherits keyple::core::seproxy::plugin::AbstractObservableLocalReader, keyple::plugin::pcsc::PcscReader, keyple::core::seproxy::plugin::SmartInsertionReader, and keyple::core::seproxy::plugin::SmartRemovalReader.
Public Member Functions | |
PcscReaderImpl (const std::string &pluginName, const PcscTerminal &terminal) | |
~PcscReaderImpl () | |
void | setParameter (const std::string &name, const std::string &value) override |
const std::map< const std::string, const std::string > & | getParameters () const override |
const TransmissionMode & | getTransmissionMode () const override |
std::shared_ptr< ObservableReaderStateService > | initStateService () override |
virtual const std::string & | getName () const final |
virtual void | setParameters (const std::map< const std::string, const std::string > ¶meters) final |
![]() | |
AbstractObservableLocalReader (const std::string &pluginName, const std::string &readerName) | |
virtual | ~AbstractObservableLocalReader ()=default |
bool | isSePresent () override |
void | startSeDetection (const ObservableReader::PollingMode pollingMode) final |
void | stopSeDetection () final |
void | setDefaultSelectionRequest (std::shared_ptr< AbstractDefaultSelectionsRequest > defaultSelectionsRequest, const ObservableReader::NotificationMode ¬ificationMode) final |
void | setDefaultSelectionRequest (std::shared_ptr< AbstractDefaultSelectionsRequest > defaultSelectionsRequest, const ObservableReader::NotificationMode ¬ificationMode, const ObservableReader::PollingMode pollingMode) final |
virtual std::shared_ptr< ReaderEvent > | processSeInserted () |
bool | isSePresentPing () |
void | processSeRemoved () |
const ObservableReader::PollingMode & | getPollingMode () const |
const MonitoringState & | getCurrentMonitoringState () const |
void | switchState (const MonitoringState stateId) |
void | addObserver (const std::shared_ptr< ObservableReader::ReaderObserver > observer) final |
void | removeObserver (const std::shared_ptr< ObservableReader::ReaderObserver > observer) final |
void | notifyObservers (const std::shared_ptr< ReaderEvent > event) final |
int | countObservers () const final |
void | clearObservers () final |
void | terminateSeCommunication () override |
void | finalizeSeProcessing () override |
void | onEvent (const InternalEvent event) |
![]() | |
AbstractLocalReader (const std::string &pluginName, const std::string &readerName) | |
virtual | ~AbstractLocalReader ()=default |
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 |
![]() | |
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 |
![]() | |
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 | ~SeReader () |
virtual bool | operator== (const SeReader &o) const |
![]() | |
virtual | ~ProxyElement ()=default |
![]() | |
ObservableReaderNotifier () | |
virtual | ~ObservableReaderNotifier () |
![]() | |
virtual | ~ObservableReader ()=default |
virtual void | addObserver (const std::shared_ptr< ReaderObserver > observer)=0 |
virtual void | removeObserver (const std::shared_ptr< ReaderObserver > observer)=0 |
![]() | |
virtual | ~SmartInsertionReader () |
![]() | |
virtual | ~SmartRemovalReader () |
Protected Member Functions | |
void | closePhysicalChannel () override |
bool | checkSePresence () override |
bool | waitForCardPresent () override |
void | stopWaitForCard () override |
bool | waitForCardAbsentNative () override |
void | stopWaitForCardRemoval () override |
std::vector< uint8_t > | transmitApdu (const std::vector< uint8_t > &apduIn) override |
bool | protocolFlagMatches (const std::shared_ptr< SeProtocol > protocolFlag) override |
const std::vector< uint8_t > & | getATR () override |
bool | isPhysicalChannelOpen () override |
void | openPhysicalChannel () override |
![]() | |
void | closeLogicalAndPhysicalChannels () |
virtual void | setForceGetDataFlag (bool forceGetDataFlag) |
void | closeLogicalChannel () |
std::shared_ptr< ApduResponse > | processApduRequest (std::shared_ptr< ApduRequest > apduRequest) |
const std::map< std::shared_ptr< SeProtocol >, std::string > & | getProtocolsMap () const |
![]() | |
AbstractReader (const std::string &pluginName, const std::string &name) | |
virtual | ~AbstractReader ()=default |
Additional Inherited Members | |
![]() | |
enum | PollingMode { PollingMode::REPEATING, PollingMode::SINGLESHOT } |
![]() | |
std::atomic< bool > | mShuttingDown |
![]() | |
static const std::string | SETTING_KEY_TRANSMISSION_MODE |
static const std::string | SETTING_TRANSMISSION_MODE_CONTACTS = "contacts" |
static const std::string | SETTING_TRANSMISSION_MODE_CONTACTLESS |
static const std::string | SETTING_KEY_PROTOCOL = "protocol" |
static const std::string | SETTING_PROTOCOL_T0 = "T0" |
static const std::string | SETTING_PROTOCOL_T1 = "T1" |
static const std::string | SETTING_PROTOCOL_T_CL = "TCL" |
static const std::string | SETTING_PROTOCOL_TX = "Tx" |
static const std::string | SETTING_KEY_MODE = "mode" |
static const std::string | SETTING_MODE_EXCLUSIVE = "exclusive" |
static const std::string | SETTING_MODE_SHARED = "shared" |
static const std::string | SETTING_KEY_DISCONNECT = "disconnect" |
static const std::string | SETTING_DISCONNECT_RESET = "reset" |
static const std::string | SETTING_DISCONNECT_UNPOWER = "unpower" |
static const std::string | SETTING_DISCONNECT_LEAVE = "leave" |
static const std::string | SETTING_DISCONNECT_EJECT = "eject" |
![]() | |
static bool | startsWith (const std::vector< uint8_t > &source, const std::vector< uint8_t > &match) |
![]() | |
std::shared_ptr< ObservableReaderStateService > | mStateService |
![]() | |
std::shared_ptr< DefaultSelectionsRequest > | mDefaultSelectionsRequest |
ObservableReader::NotificationMode | mNotificationMode |
keyple::plugin::pcsc::PcscReaderImpl::PcscReaderImpl | ( | const std::string & | pluginName, |
const PcscTerminal & | terminal | ||
) |
This constructor should only be called by PcscPlugin PCSC reader parameters are initialized with their default values as defined in setParameter. See setParameter() for more details
pluginName | the name of the plugin |
terminal | the PC/SC terminal |
keyple::plugin::pcsc::PcscReaderImpl::~PcscReaderImpl | ( | ) |
|
overrideprotectedvirtual |
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.
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overrideprotectedvirtual |
Closes the current physical channel.
This method must be implemented by the ProxyReader plugin (e.g. Pcsc/Nfc/Omapi Reader).
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overrideprotectedvirtual |
This abstract method must be implemented by the derived class in order to provide the SE ATR when available.
Gets the SE Answer to reset
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
inlinefinalvirtual |
C++ vs. Java: temp hack
Reimplemented from keyple::core::seproxy::plugin::AbstractReader.
|
overridevirtual |
Gets the parameters
Implements keyple::core::seproxy::ProxyElement.
|
overridevirtual |
The transmission mode can set with setParameter(SETTING_KEY_TRANSMISSION_MODE, )
When the transmission mode has not explicitly set, it is deduced from the protocol:
Implements keyple::core::seproxy::SeReader.
|
overridevirtual |
Initialize the ObservableReaderStateService with the possible states and their implementation. ObservableReaderStateService define the initial state.
Make sure to initialize the stateService in your reader constructor with stateService = initStateService()
Implements keyple::core::seproxy::plugin::AbstractObservableLocalReader.
|
overrideprotectedvirtual |
Tells if a physical channel is open
This status may be wrong if the card has been removed.
The caller should test the card presence with isSePresent before calling this method.
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overrideprotectedvirtual |
Opens a physical channel
The card access may be set to 'Exclusive' through the reader's settings.
In this case be aware that on some platforms (ex. Windows 8+), the exclusivity is granted for a limited time (ex. 5 seconds). After this delay, the card is automatically resetted.
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overrideprotectedvirtual |
Tells if the current SE protocol matches the provided protocol flag. If the protocol flag is not defined (null), we consider here that it matches. An exception is returned when the provided protocolFlag is not found in the current protocolMap.
protocolFlag | the protocol flag |
KeypleReaderIOException | if the communication with the reader or the SE has failed |
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overridevirtual |
Set a parameter.
These are the parameters you can use with their associated values:
name | Parameter name |
value | Parameter value |
KeypleReaderIOException | if the communication with the reader or the SE has failed, when disabling the exclusive mode as it's executed instantly |
Implements keyple::core::seproxy::plugin::AbstractSeProxyComponent.
|
inlinefinalvirtual |
C++ vs Java: temp hack
Reimplemented from keyple::core::seproxy::ProxyElement.
|
overrideprotectedvirtual |
Interrupts the waiting of a SE
Reimplemented from keyple::core::seproxy::plugin::SmartInsertionReader.
|
overrideprotectedvirtual |
Interrupts the waiting of the removal of the SE
Reimplemented from keyple::core::seproxy::plugin::SmartRemovalReader.
|
overrideprotectedvirtual |
Transmission of single APDU
apduIn | APDU in buffer |
KeypleIOReaderException | if the transmission failed |
Implements keyple::core::seproxy::plugin::AbstractLocalReader.
|
overrideprotectedvirtual |
Wait for the card absent event from smartcard.io
Implements keyple::core::seproxy::plugin::SmartRemovalReader.
|
overrideprotectedvirtual |
Waits for a SE. Returns true if a SE is detected before the end of the provided timeout.
This method must be implemented by the plugin's reader class when it implements the keyple::core::seproxy::plugin::SmartInsertionReader interface.
Returns false if no SE is detected
KeypleReaderIOException | if the communication with the reader or the SE has failed (disconnection) |
Implements keyple::core::seproxy::plugin::SmartInsertionReader.