|
Keypop Reader C++ API - 2.1.0
Component of the Keypop C++ API
|
Card reader able to observe the insertion/removal of cards. More...
#include <keypop/reader/ObservableCardReader.hpp>


Public Types | |
| enum | DetectionMode { REPEATING , SINGLESHOT } |
| Card detection management options to be applied after processing a card. More... | |
| enum | NotificationMode { ALWAYS , MATCHED_ONLY } |
| The options that apply when a card is detected. More... | |
Public Member Functions | |
| virtual void | setReaderObservationExceptionHandler (std::shared_ptr< CardReaderObservationExceptionHandlerSpi > exceptionHandler)=0 |
| Sets the exception handler. More... | |
| virtual void | addObserver (std::shared_ptr< CardReaderObserverSpi > observer)=0 |
| Registers a new observer to be notified when a reader event occurs. More... | |
| virtual void | removeObserver (const std::shared_ptr< CardReaderObserverSpi > observer)=0 |
| Unregisters a reader observer. More... | |
| virtual void | clearObservers ()=0 |
| Unregisters all observers at once. More... | |
| virtual int | countObservers () const =0 |
| Provides the current number of registered observers. More... | |
| virtual void | startCardDetection (const DetectionMode detectionMode)=0 |
| Starts the card detection. More... | |
| virtual void | stopCardDetection ()=0 |
| Stops the card detection. More... | |
| virtual void | finalizeCardProcessing ()=0 |
| Notifies the observation process that the processing of the card has been completed in order to ensure that the card monitoring cycle runs properly. More... | |
Public Member Functions inherited from keypop::reader::CardReader | |
| virtual | ~CardReader ()=default |
| virtual const std::string & | getName () const =0 |
| Returns the name of the reader. More... | |
| virtual bool | isContactless ()=0 |
| Checks if the card communication mode is contactless. More... | |
| virtual bool | isCardPresent ()=0 |
| Checks if the card is present. More... | |
Card reader able to observe the insertion/removal of cards.
Definition at line 33 of file ObservableCardReader.hpp.
Card detection management options to be applied after processing a card.
| Enumerator | |
|---|---|
| REPEATING | Continue waiting for the insertion of a next card.
|
| SINGLESHOT | Stop and wait for a restart signal.
|
Definition at line 40 of file ObservableCardReader.hpp.
The options that apply when a card is detected.
Definition at line 61 of file ObservableCardReader.hpp.
|
pure virtual |
Registers a new observer to be notified when a reader event occurs.
The provided observer must implement the CardReaderObserverSpi interface to be able to receive the events produced by this reader (card insertion, removal, etc.)
| observer | An observer object implementing the required interface (should be not null). |
| IllegalArgumentException | If the provided observer is null. |
|
pure virtual |
Unregisters all observers at once.
|
pure virtual |
Provides the current number of registered observers.
|
pure virtual |
Notifies the observation process that the processing of the card has been completed in order to ensure that the card monitoring cycle runs properly.
This method has no effect if the physical communication channel has already been closed.
It is mandatory to invoke this method when the physical communication channel with the card could not be closed properly.
The channel closing is nominally managed during the last transmission with the card. However, there are cases where exchanges with the card are interrupted (e.g. by an exception), in which case it is necessary to explicitly close the channel using this method.
In practice, it is recommended to invoke this method in all cases (e.g. in a "finally" statement) at the end of a card processing whatever the result.
|
pure virtual |
Unregisters a reader observer.
The observer will no longer receive any of the events produced by this reader.
| observer | The observer object to be removed (should be not null). |
| IllegalArgumentException | If the provided observer is null. |
|
pure virtual |
Sets the exception handler.
The invocation of this method is mandatory when the reader has to be observed.
In case of a fatal error during the observation, the handler will receive a notification.
| exceptionHandler | The exception handler implemented by the application. |
| IllegalArgumentException | If the provided handler is null. |
|
pure virtual |
Starts the card detection.
Once activated, the application can be notified of the arrival of a card.
The DetectionMode indicates the action to be followed after processing the card.
| detectionMode | The card detection mode. |
| IllegalArgumentException | If the provided detection mode is null. |
|
pure virtual |
Stops the card detection.