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

#include <StubPluginImpl.h>

Inherits keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin, and keyple::plugin::stub::StubPlugin.

Public Member Functions

 StubPluginImpl (const std::string &pluginName)
 
const std::map< const std::string, const std::string > & getParameters () const override
 
void setParameter (const std::string &key, const std::string &value) override
 
void plugStubReader (const std::string &readerName, bool synchronous) override
 
void plugStubReader (const std::string &readerName, TransmissionMode transmissionMode, bool synchronous) override
 
void plugStubReaders (const std::set< std::string > &readerNames, const bool synchronous) override
 
void unplugStubReader (const std::string &readerName, const bool synchronous) override
 
void unplugStubReaders (const std::set< std::string > &readerNames, const bool synchronous) override
 
const std::set< std::string > & fetchNativeReadersNames () override
 
const std::string & getName () const override
 
void setParameters (const std::map< const std::string, const std::string > &parameters)
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin
void addObserver (const std::shared_ptr< ObservablePlugin::PluginObserver > observer) final
 
void removeObserver (const std::shared_ptr< ObservablePlugin::PluginObserver > observer) final
 
void clearObservers () final
 
virtual ~AbstractThreadedObservablePlugin ()
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::AbstractObservablePlugin
virtual int countObservers () const final
 
virtual void notifyObservers (const std::shared_ptr< PluginEvent > event) final
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::AbstractPlugin
virtual ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & getReaders () override
 
virtual const std::set< std::string > getReaderNames () const override
 
const std::shared_ptr< SeReadergetReader (const std::string &name) final
 
const std::string & getName () const
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::AbstractSeProxyComponent
 AbstractSeProxyComponent (const std::string &name)
 
virtual ~AbstractSeProxyComponent ()=default
 
const std::string & getName () const
 
void setParameters (const std::map< const std::string, const std::string > &parameters)
 
- Public Member Functions inherited from keyple::core::seproxy::ReaderPlugin
virtual ~ReaderPlugin ()=default
 
- Public Member Functions inherited from keyple::core::seproxy::ProxyElement
virtual ~ProxyElement ()=default
 
virtual void setParameters (const std::map< const std::string, const std::string > &parameters)
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::ObservablePluginNotifier
virtual ~ObservablePluginNotifier ()=default
 
- Public Member Functions inherited from keyple::core::seproxy::event::ObservablePlugin
virtual ~ObservablePlugin ()=default
 
virtual void addObserver (const std::shared_ptr< PluginObserver > observer)=0
 
virtual void removeObserver (const std::shared_ptr< PluginObserver > observer)=0
 

Protected Member Functions

ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & initNativeReaders () override
 
std::shared_ptr< SeReaderfetchNativeReader (const std::string &readerName) override
 
- Protected Member Functions inherited from keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin
 AbstractThreadedObservablePlugin (const std::string &name)
 
bool isMonitoring ()
 
- Protected Member Functions inherited from keyple::core::seproxy::plugin::AbstractObservablePlugin
 AbstractObservablePlugin (const std::string &name)
 
virtual ~AbstractObservablePlugin ()=default
 
- Protected Member Functions inherited from keyple::core::seproxy::plugin::AbstractPlugin
 AbstractPlugin (const std::string &name)
 
virtual ~AbstractPlugin ()=default
 

Additional Inherited Members

- Protected Attributes inherited from keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin
long long mThreadWaitTimeout = SETTING_THREAD_TIMEOUT_DEFAULT
 
- Protected Attributes inherited from keyple::core::seproxy::plugin::AbstractPlugin
ConcurrentMap< const std::string, std::shared_ptr< SeReader > > mNativeReaders
 

Detailed Description

This plugin allows to simulate Secure Element communication by creating keyple::core::seproxy::protocol::TransmissionMode and keyple::plugin::stub::StubSecureElement. Plug a new StubReader with plugStubReader() and insert an implementation of your own of keyple::plugin::stub::StubSecureElement to start simulation communication. This class is a singleton, use StubPlugin::getInstance to access it

Constructor & Destructor Documentation

◆ StubPluginImpl()

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

Constructor

Parameters
pluginName: custom name for the plugin

Member Function Documentation

◆ fetchNativeReader()

std::shared_ptr< SeReader > keyple::plugin::stub::StubPluginImpl::fetchNativeReader ( const std::string &  readerName)
overrideprotectedvirtual

Fetch the reader whose name is provided as an argument. Returns the current reader if it is already listed. Creates and returns a new reader if not.

Throw an exception if the wanted reader is not found.

Parameters
readerNamename of the reader
Returns
the reader object

Implements keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin.

◆ fetchNativeReadersNames()

const std::set< std::string > & keyple::plugin::stub::StubPluginImpl::fetchNativeReadersNames ( )
overridevirtual

Fetch the list of connected native reader (from a simulated list) and returns their names (or id)

Returns
connected readers' name list

Implements keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin.

◆ getName()

const std::string& keyple::plugin::stub::StubPluginImpl::getName ( ) const
inlineoverridevirtual

C++ vs. Java: have to override the method here to link ProxyElement interface to actual implementation

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

◆ getParameters()

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

Gets the single instance of StubPlugin.

Returns
single instance of StubPlugin

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

◆ initNativeReaders()

ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & keyple::plugin::stub::StubPluginImpl::initNativeReaders ( )
overrideprotectedvirtual

Init native Readers to empty Set

Returns
the map of SeReader objects.
Exceptions
KeypleReaderExceptionif a reader error occurs

Implements keyple::core::seproxy::plugin::AbstractPlugin.

◆ plugStubReader() [1/2]

void keyple::plugin::stub::StubPluginImpl::plugStubReader ( const std::string &  name,
bool  synchronous 
)
overridevirtual

Plug a Stub Reader

Parameters
name: name of the created reader
synchronous: should the stubreader added synchronously (without waiting for the observation thread)

Implements keyple::plugin::stub::StubPlugin.

◆ plugStubReader() [2/2]

void keyple::plugin::stub::StubPluginImpl::plugStubReader ( const std::string &  name,
TransmissionMode  transmissionMode,
bool  synchronous 
)
overridevirtual

Plug a Stub Reader

Parameters
name: name of the created reader
transmissionMode: transmissionMode of the created reader
synchronous: should the stubreader added synchronously (without waiting for the observation thread)

Implements keyple::plugin::stub::StubPlugin.

◆ plugStubReaders()

void keyple::plugin::stub::StubPluginImpl::plugStubReaders ( const std::set< std::string > &  names,
const bool  synchronous 
)
overridevirtual

Plug a list of stub Reader at once

Parameters
names: names of readers to be connected
synchronous: should the stubreader be added synchronously (without waiting for the observation thread). An READER_CONNECTED event is raised in both cases

Implements keyple::plugin::stub::StubPlugin.

◆ setParameter()

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

This method has to be implemented by the reader plugin.
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::plugin::AbstractSeProxyComponent.

◆ setParameters()

void keyple::core::seproxy::plugin::AbstractSeProxyComponent::setParameters

Sets at once a set of parameters for a reader

See setParameter() for more details

Parameters
parametersa Map <String, String> parameter set
Exceptions
KeypleBaseExceptionif one of the parameters could not be set up

◆ unplugStubReader()

void keyple::plugin::stub::StubPluginImpl::unplugStubReader ( const std::string &  name,
const bool  synchronous 
)
overridevirtual

Unplug a Stub Reader

Parameters
namethe name of the reader
Exceptions
KeypleReaderExceptionin case of a reader exception
Parameters
synchronous: should the stubreader be removed synchronously (without waiting for the observation thread). An READER_DISCONNECTED event is raised in both cases

Implements keyple::plugin::stub::StubPlugin.

◆ unplugStubReaders()

void keyple::plugin::stub::StubPluginImpl::unplugStubReaders ( const std::set< std::string > &  names,
const bool  synchronous 
)
overridevirtual

Unplug a list of readers

Parameters
names: names of the reader to be unplugged
synchronous: should the stubreader removed synchronously (without waiting for the observation thread). An READER_DISCONNECTED event is raised in both cases

Implements keyple::plugin::stub::StubPlugin.


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