Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Classes | Public Types | Public Member Functions | List of all members
keyple::core::seproxy::event::ObservableReader Class Referenceabstract

#include <ObservableReader.h>

Inherits keyple::core::seproxy::SeReader.

Inherited by keyple::core::seproxy::plugin::ObservableReaderNotifier [virtual], keyple::plugin::pcsc::PcscReader [virtual], and keyple::plugin::stub::StubReader [virtual].

Classes

class  NotificationMode
 
class  ReaderObserver
 

Public Types

enum  PollingMode { PollingMode::REPEATING, PollingMode::SINGLESHOT }
 

Public Member Functions

virtual ~ObservableReader ()=default
 
virtual void addObserver (const std::shared_ptr< ReaderObserver > observer)=0
 
virtual void removeObserver (const std::shared_ptr< ReaderObserver > observer)=0
 
virtual void clearObservers ()=0
 
virtual int countObservers () const =0
 
virtual void startSeDetection (const PollingMode pollingMode)=0
 
virtual void stopSeDetection ()=0
 
virtual void setDefaultSelectionRequest (std::shared_ptr< AbstractDefaultSelectionsRequest > defaultSelectionsRequest, const NotificationMode &notificationMode)=0
 
virtual void setDefaultSelectionRequest (std::shared_ptr< AbstractDefaultSelectionsRequest >defaultSelectionsRequest, const NotificationMode &notificationMode, const PollingMode pollingMode)=0
 
virtual void finalizeSeProcessing ()=0
 
- Public Member Functions inherited from keyple::core::seproxy::SeReader
virtual ~SeReader ()
 
virtual bool isSePresent ()=0
 
virtual void addSeProtocolSetting (std::shared_ptr< SeProtocol > seProtocol, const std::string &protocolRule)=0
 
virtual void setSeProtocolSetting (const std::map< std::shared_ptr< SeProtocol >, std::string > &protocolSetting)=0
 
virtual const TransmissionModegetTransmissionMode () const =0
 
virtual bool operator== (const SeReader &o) const
 
- Public Member Functions inherited from keyple::core::seproxy::ProxyElement
virtual ~ProxyElement ()=default
 
virtual const std::string & getName () const =0
 
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 > &parameters)
 

Detailed Description

The ObservableReader interface provides the API for observable readers.

Member Enumeration Documentation

◆ PollingMode

Indicates the action to be taken after processing a SE.

Enumerator
REPEATING 

continue waiting for the insertion of a next SE.

SINGLESHOT 

stop and wait for a restart signal.

Constructor & Destructor Documentation

◆ ~ObservableReader()

virtual keyple::core::seproxy::event::ObservableReader::~ObservableReader ( )
virtualdefault

Member Function Documentation

◆ addObserver()

virtual void keyple::core::seproxy::event::ObservableReader::addObserver ( const std::shared_ptr< ReaderObserver observer)
pure virtual

Add a reader observer.

The observer will receive all the events produced by this reader (card insertion, removal, etc.)

Parameters
observerthe observer object

◆ clearObservers()

virtual void keyple::core::seproxy::event::ObservableReader::clearObservers ( )
pure virtual

Remove all observers at once

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ countObservers()

virtual int keyple::core::seproxy::event::ObservableReader::countObservers ( ) const
pure virtual
Returns
the number of observers

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ finalizeSeProcessing()

virtual void keyple::core::seproxy::event::ObservableReader::finalizeSeProcessing ( )
pure virtual

Terminates the processing of the SE, in particular after an interruption by exception
Do nothing if the channel is already closed.
Channel closing is nominally managed by using the CLOSE_AFTER flag during the last transmission with the SE. However, there are cases where exchanges with the SE are interrupted by an exception, in which case it is necessary to explicitly close the channel using this method.

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ removeObserver()

virtual void keyple::core::seproxy::event::ObservableReader::removeObserver ( const std::shared_ptr< ReaderObserver observer)
pure virtual

Remove a reader observer.

The observer will nolonger receive any of the events produced by this reader.

Parameters
observerthe observer object

◆ setDefaultSelectionRequest() [1/2]

virtual void keyple::core::seproxy::event::ObservableReader::setDefaultSelectionRequest ( std::shared_ptr< AbstractDefaultSelectionsRequest defaultSelectionsRequest,
const NotificationMode notificationMode 
)
pure virtual

Defines the selection request to be processed when an SE is inserted. Depending on the SE and the notificationMode parameter, a SE_INSERTED, SE_MATCHED or no event at all will be notified to the application observers.

Parameters
defaultSelectionsRequestthe selection request to be operated
notificationModeindicates whether a SE_INSERTED event should be notified even if the selection has failed (ALWAYS) or whether the SE insertion should be ignored in this case (MATCHED_ONLY).

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ setDefaultSelectionRequest() [2/2]

virtual void keyple::core::seproxy::event::ObservableReader::setDefaultSelectionRequest ( std::shared_ptr< AbstractDefaultSelectionsRequest defaultSelectionsRequest,
const NotificationMode notificationMode,
const PollingMode  pollingMode 
)
pure virtual

A combination of defining the default selection request and starting the SE detection.

Parameters
defaultSelectionsRequestthe selection request to be operated
notificationModeindicates whether a SE_INSERTED event should be notified even if the selection has failed (ALWAYS) or whether the SE insertion should be ignored in this case (MATCHED_ONLY).
pollingModeindicates the action to be followed after processing the SE: if CONTINUE, the SE detection is restarted, if STOP, the SE detection is stopped until a new call to startSeDetection is made.

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ startSeDetection()

virtual void keyple::core::seproxy::event::ObservableReader::startSeDetection ( const PollingMode  pollingMode)
pure virtual

Starts the SE detection. Once activated, the application can be notified of the arrival of an SE.

Parameters
pollingModeindicates the action to be followed after processing the SE: if REPEATING, the SE detection is restarted, if SINGLESHOT, the SE detection is stopped until a new call to startSeDetection is made.

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.

◆ stopSeDetection()

virtual void keyple::core::seproxy::event::ObservableReader::stopSeDetection ( )
pure virtual

Stops the SE detection.

This method must be overloaded by readers depending on the particularity of their management of the start of SE detection.

Implemented in keyple::core::seproxy::plugin::AbstractObservableLocalReader.


The documentation for this class was generated from the following file: