Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Public Attributes | List of all members
keyple::plugin::stub::StubPoolPluginImpl Class Reference

#include <StubPoolPluginImpl.h>

Inherits keyple::plugin::stub::StubPoolPlugin.

Public Member Functions

 StubPoolPluginImpl (const std::string &pluginName)
 
const std::string & getName () const override
 
std::set< std::string > getReaderGroupReferences () override
 
std::shared_ptr< SeReaderplugStubPoolReader (const std::string &groupReference, const std::string &readerName, std::shared_ptr< StubSecureElement > se) override
 
void unplugStubPoolReader (const std::string &groupReference) override
 
std::shared_ptr< SeReaderallocateReader (const std::string &groupReference) override
 
void releaseReader (std::shared_ptr< SeReader > seReader) override
 
const std::map< const std::string, const std::string > & listAllocatedReaders ()
 
const std::set< std::string > getReaderNames () const override
 
ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & getReaders () override
 
const std::shared_ptr< SeReadergetReader (const std::string &name) override
 
const std::map< const std::string, const std::string > & getParameters () const override
 
void setParameter (const std::string &key, const std::string &value) override
 
void setParameters (const std::map< const std::string, const std::string > &parameters) override
 
- Public Member Functions inherited from keyple::core::seproxy::ReaderPlugin
virtual ~ReaderPlugin ()=default
 
- Public Member Functions inherited from keyple::core::seproxy::ProxyElement
virtual ~ProxyElement ()=default
 

Public Attributes

std::shared_ptr< StubPluginImplmStubPlugin
 
std::map< const std::string, std::shared_ptr< StubReaderImpl > > mReaderPool
 
std::map< const std::string, const std::string > mAllocatedReader
 

Detailed Description

Simulates a keyple::core::seproxy::ReaderPoolPlugin with keyple::core::seproxy::protocol::TransmissionMode and keyple::plugin::stub::StubSecureElement. Manages allocation readers by group reference, Limitations :

Constructor & Destructor Documentation

◆ StubPoolPluginImpl()

keyple::plugin::stub::StubPoolPluginImpl::StubPoolPluginImpl ( const std::string &  pluginName)
explicit

Member Function Documentation

◆ allocateReader()

std::shared_ptr< SeReader > keyple::plugin::stub::StubPoolPluginImpl::allocateReader ( const std::string &  groupReference)
overridevirtual

Allocate a reader if available by groupReference

Parameters
groupReferencethe reference of the group to which the reader belongs (may be null depending on the implementation made)
Returns
seReader if available, null otherwise
Exceptions
KeypleAllocationReaderExceptionif the allocation failed due to a technical error
KeypleAllocationNoReaderExceptionif the allocation failed due to lack of available reader

Implements keyple::core::seproxy::ReaderPoolPlugin.

◆ getName()

const std::string & keyple::plugin::stub::StubPoolPluginImpl::getName ( ) const
overridevirtual

C++ vs. Java: hack to avoid linker issues. Should be removed in 1.0

Returns
the unique name of the item

Implements keyple::core::seproxy::ProxyElement.

◆ getParameters()

const std::map< const std::string, const std::string > & keyple::plugin::stub::StubPoolPluginImpl::getParameters ( ) const
overridevirtual

Gets the parameters

Returns
the configuration of the item

Implements keyple::core::seproxy::ProxyElement.

◆ getReader()

const std::shared_ptr< SeReader > keyple::plugin::stub::StubPoolPluginImpl::getReader ( const std::string &  name)
overridevirtual

Gets the reader whose name is provided as an argument

Parameters
nameof the reader
Returns
the SeReader object.
Exceptions
KeypleReaderNotFoundExceptionif the wanted reader is not found

Implements keyple::core::seproxy::ReaderPlugin.

◆ getReaderGroupReferences()

std::set< std::string > keyple::plugin::stub::StubPoolPluginImpl::getReaderGroupReferences ( )
overridevirtual

Gets a list of group references that will be used as an argument to allocateReader.

A group reference can represent a family of SeReader with all the same characteristics (e.g. SAM with identical key sets).

Returns
a list of String

Implements keyple::core::seproxy::ReaderPoolPlugin.

◆ getReaderNames()

const std::set< std::string > keyple::plugin::stub::StubPoolPluginImpl::getReaderNames ( ) const
overridevirtual

Gets the list of names of all readers

Returns
a list of String

Implements keyple::core::seproxy::ReaderPlugin.

◆ getReaders()

ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & keyple::plugin::stub::StubPoolPluginImpl::getReaders ( )
overridevirtual

Gets the readers.

Returns
the map of this plugin's connected reader's name and instance, can be an empty list, can not be null;

Implements keyple::core::seproxy::ReaderPlugin.

◆ listAllocatedReaders()

const std::map< const std::string, const std::string > & keyple::plugin::stub::StubPoolPluginImpl::listAllocatedReaders ( )

◆ plugStubPoolReader()

std::shared_ptr< SeReader > keyple::plugin::stub::StubPoolPluginImpl::plugStubPoolReader ( const std::string &  groupReference,
const std::string &  readerName,
std::shared_ptr< StubSecureElement se 
)
overridevirtual

Plug synchronously a new keyple::core::seproxy::protocol::TransmissionMode in Pool with groupReference and a StubSE. A READER_CONNECTED event will be raised.

Parameters
groupReference: group refence of the new stub reader
readerName: name of the new stub reader
se: insert a se at creation (can be null)
Returns
created StubReader

Implements keyple::plugin::stub::StubPoolPlugin.

◆ releaseReader()

void keyple::plugin::stub::StubPoolPluginImpl::releaseReader ( std::shared_ptr< SeReader seReader)
overridevirtual

Release a reader

Parameters
seReaderthe SeReader to be released.

Remove and Re-insert SE to reset logical channel

Implements keyple::core::seproxy::ReaderPoolPlugin.

◆ setParameter()

void keyple::plugin::stub::StubPoolPluginImpl::setParameter ( const std::string &  key,
const std::string &  value 
)
overridevirtual

Allows to define a proprietary setting for a reader or a plugin (contactless protocols polling sequence, baud rate, … etc.).

Parameters
keythe parameter key
valuethe parameter value
Exceptions
IllegalArgumentExceptionif the parameter or the value is not supported
KeypleReaderIOExceptionif the communication with the reader or the SE has failed

Implements keyple::core::seproxy::ProxyElement.

◆ setParameters()

void keyple::plugin::stub::StubPoolPluginImpl::setParameters ( const std::map< const std::string, const std::string > &  parameters)
overridevirtual

allows to define a set of proprietary settings for a reader or a plugin (contactless protocols polling sequence, baud rate, … etc.).

Parameters
parametersParameters to setup
Exceptions
IllegalArgumentExceptionif the parameters or the values is not supported
KeypleExceptionif the parameter fails to be set up

Reimplemented from keyple::core::seproxy::ProxyElement.

◆ unplugStubPoolReader()

void keyple::plugin::stub::StubPoolPluginImpl::unplugStubPoolReader ( const std::string &  groupReference)
overridevirtual

Unplug synchronously a new reader by groupReference. A READER_DISCONNECTED event will be raised.

Parameters
groupReferencegroupReference of the reader to be unplugged

Implements keyple::plugin::stub::StubPoolPlugin.

Member Data Documentation

◆ mAllocatedReader

std::map<const std::string, const std::string> keyple::plugin::stub::StubPoolPluginImpl::mAllocatedReader

Can have only one reader

◆ mReaderPool

std::map<const std::string, std::shared_ptr<StubReaderImpl> > keyple::plugin::stub::StubPoolPluginImpl::mReaderPool

groupReference, seReader = limitation each

◆ mStubPlugin

std::shared_ptr<StubPluginImpl> keyple::plugin::stub::StubPoolPluginImpl::mStubPlugin

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