Keypop Reader C++ API 2.0.0
Reference Reader API for C++
Public Member Functions | List of all members
keypop::reader::selection::CardSelectionManager Class Referenceabstract

#include <CardSelectionManager.hpp>

Public Member Functions

virtual ~CardSelectionManager ()=default
 
virtual void setMultipleSelectionMode ()=0
 
virtual int prepareSelection (const std::shared_ptr< CardSelector > cardSelector, const std::shared_ptr< spi::CardSelectionExtension > cardSelectionExtension)=0
 
virtual void prepareReleaseChannel ()=0
 
virtual const std::string exportCardSelectionScenario () const =0
 
virtual int importCardSelectionScenario (const std::string &cardSelectionScenario)=0
 
virtual const std::shared_ptr< CardSelectionResultprocessCardSelectionScenario (std::shared_ptr< CardReader > reader)=0
 
virtual void scheduleCardSelectionScenario (std::shared_ptr< ObservableCardReader > observableCardReader, const ObservableCardReader::NotificationMode notificationMode)=0
 
virtual std::shared_ptr< calypsonet::reader::selection::CardSelectionResult > parseScheduledCardSelectionsResponse (const std::shared_ptr< ScheduledCardSelectionsResponse > scheduledCardSelectionsResponse) const =0
 
virtual const std::string & exportProcessedCardSelectionScenario () const =0
 
virtual const std::shared_ptr< CardSelectionResultimportProcessedCardSelectionScenario (const std::string &processedCardSelectionScenario) const =0
 

Detailed Description

Service dedicated to card selection, based on the preparation of a card selection scenario.

A card selection scenario consists of one or more selection cases based on a CardSelectionExtension.
A card selection case targets a specific card.
Optionally, additional commands can be defined to be executed after the successful selection of the card.

If a card selection case fails, the service will try with the next card selection case defined in the scenario, until there are no further card selection cases available.

If a card selection case succeeds:

The logical channel established with the card can be left open (default) or closed after card selection (by using the CardSelectionManager#prepareReleaseChannel() method).

This service allows to:

An instance of this interface can be obtained via the method ReaderApiFactory#createCardSelectionManager().

Since
1.0.0

Definition at line 70 of file CardSelectionManager.hpp.

Constructor & Destructor Documentation

◆ ~CardSelectionManager()

virtual keypop::reader::selection::CardSelectionManager::~CardSelectionManager ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ exportCardSelectionScenario()

virtual const std::string keypop::reader::selection::CardSelectionManager::exportCardSelectionScenario ( ) const
pure virtual

Exports the current prepared card selection scenario to a string in string format.

This string can be imported into the same or another card selection manager via the method importCardSelectionScenario(const std::string&).

Returns
A non-null string.
See also
importCardSelectionScenario(const std::string&)
Since
1.1.0

◆ exportProcessedCardSelectionScenario()

virtual const std::string & keypop::reader::selection::CardSelectionManager::exportProcessedCardSelectionScenario ( ) const
pure virtual

Exports the content of the previously processed card selection scenario in string format.

This string can be imported into the same or another card selection manager via the method importProcessedCardSelectionScenario(const std::string&).

Prerequisite: the card selection scenario must first have been processed via the processCardSelectionScenario(const std::shared_ptr<CardReader>) or parseScheduledCardSelectionsResponse(const std::shared_ptr<ScheduledCardSelectionsResponse>) method.

Caution: if the local environment does not have the card extensions involved in the selection scenario, then methods processCardSelectionScenario(const std::shared_ptr<CardReader>) and parseScheduledCardSelectionsResponse(const std::shared_ptr<ScheduledCardSelectionsResponse>) will not be able to interpret the content of the result, and consequently, the content of the result object CardSelectionResult will not contain any active selection. It will then be necessary to export the processed scenario in order to import it and interpret it correctly by a card selection manager that has all the card extensions involved in the selection scenario.

Returns
A non-null string.
Exceptions
IllegalStateExceptionIf the card selection scenario has not yet been processed or has failed.
See also
importProcessedCardSelectionScenario(const std::string&)
Since
1.3.0

◆ importCardSelectionScenario()

virtual int keypop::reader::selection::CardSelectionManager::importCardSelectionScenario ( const std::string &  cardSelectionScenario)
pure virtual

Imports a card selection scenario provided as a string in string format.

The string must have been exported from a card selection manager via the method exportCardSelectionScenario().

Parameters
cardSelectionScenarioThe string containing the exported card selection scenario.
Returns
The index of the last imported selection in the card selection scenario.
Exceptions
IllegalArgumentExceptionIf the string is null or malformed.
See also
exportCardSelectionScenario()
Since
1.1.0

◆ importProcessedCardSelectionScenario()

virtual const std::shared_ptr< CardSelectionResult > keypop::reader::selection::CardSelectionManager::importProcessedCardSelectionScenario ( const std::string &  processedCardSelectionScenario) const
pure virtual

Imports a previously exported processed card selection scenario in string format and returns the card selection result.

Prerequisites:

  • the string must have been exported from a card selection manager via the method exportProcessedCardSelectionScenario(),
  • the local environment must have the card extensions involved in the card selection scenario,
  • the current manager must first be configured with the same card selection scenario as the manager that was used to export the processed card selection scenario.
Parameters
processedCardSelectionScenarioThe string containing the exported processed card selection scenario.
Returns
A non-null reference.
Exceptions
IllegalArgumentExceptionIf the string is null, malformed or contains more card selection cases than the current card selection scenario.
InvalidCardResponseExceptionIf the data returned by the card could not be interpreted.
See also
exportProcessedCardSelectionScenario()
Since
1.3.0

◆ parseScheduledCardSelectionsResponse()

virtual std::shared_ptr< calypsonet::reader::selection::CardSelectionResult > keypop::reader::selection::CardSelectionManager::parseScheduledCardSelectionsResponse ( const std::shared_ptr< ScheduledCardSelectionsResponse scheduledCardSelectionsResponse) const
pure virtual

Analyzes the responses provided by a calypsonet::terminal::reader::CardReaderEvent following the insertion of a card and the execution of the card selection scenario.

Parameters
scheduledCardSelectionsResponseThe card selection scenario execution response.
Returns
A non-null reference.
Exceptions
IllegalArgumentExceptionIf the provided card selection response is null.
InvalidCardResponseExceptionIf the data returned by the card could not be interpreted.
Since
1.0.0

◆ prepareReleaseChannel()

virtual void keypop::reader::selection::CardSelectionManager::prepareReleaseChannel ( )
pure virtual

Requests the closing of the physical channel at the end of the execution of the card selection request.

It is thus possible to chain several selections on the same card selection scenario by restarting the card connection sequence.

Since
1.0.0

◆ prepareSelection()

virtual int keypop::reader::selection::CardSelectionManager::prepareSelection ( const std::shared_ptr< CardSelector >  cardSelector,
const std::shared_ptr< spi::CardSelectionExtension cardSelectionExtension 
)
pure virtual

Appends a card selection case to the card selection scenario.

The method returns the index giving the current position of the selection in the selection scenario (0 for the first application, 1 for the second, etc.). This index will be used to retrieve the corresponding result in the CardSelectionResult object.

Parameters
cardSelectorThe card selector containing the filters to be used to select the card.
cardSelectionExtensionThe card selection extension to be used to parse the card selection response.
Returns
A non-negative int.
Exceptions
IllegalArgumentExceptionIf the provided card selector or card selection extension is null.
Since
2.0.0

◆ processCardSelectionScenario()

virtual const std::shared_ptr< CardSelectionResult > keypop::reader::selection::CardSelectionManager::processCardSelectionScenario ( std::shared_ptr< CardReader reader)
pure virtual

Explicitely executes a previously prepared card selection scenario and returns the card selection result.

Parameters
readerThe reader to communicate with the card.
Returns
A non-null reference.
Exceptions
IllegalArgumentExceptionIf the provided reader is null.
ReaderCommunicationExceptionIf the communication with the reader has failed.
CardCommunicationExceptionIf communication with the card has failed or if the status word check is enabled in the card request and the card has returned an unexpected code.
InvalidCardResponseExceptionIf the card returned invalid data during the selection process.
Since
1.0.0

◆ scheduleCardSelectionScenario()

virtual void keypop::reader::selection::CardSelectionManager::scheduleCardSelectionScenario ( std::shared_ptr< ObservableCardReader observableCardReader,
const ObservableCardReader::NotificationMode  notificationMode 
)
pure virtual

Schedules the execution of the prepared card selection scenario as soon as a card is presented to the provided ObservableCardReader.

calypsonet::terminal::reader::CardReaderEvent are pushed to the observer according to the specified notification mode.

The result of the scenario execution will be analyzed by parseScheduledCardSelectionsResponse(ScheduledCardSelectionsResponse).

Parameters
observableCardReaderThe reader with which the card communication is carried out.
notificationModeThe card notification mode to use when a card is detected.
Exceptions
IllegalArgumentExceptionIf one of the parameters is null.
Since
1.0.0

◆ setMultipleSelectionMode()

virtual void keypop::reader::selection::CardSelectionManager::setMultipleSelectionMode ( )
pure virtual

Sets the multiple selection mode to process all selection cases even in case of a successful selection.

The multiple selection mode is disabled by default.

Since
1.0.0

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