Keyple C++
0.9.0
Keyple, an Open Source SDK for Ticketing
|
#include <SamResourceManager.h>
Inherited by keyple::calypso::transaction::SamResourceManagerDefault, and keyple::calypso::transaction::SamResourceManagerPool.
Classes | |
class | ManagedSamResource |
Public Types | |
enum | AllocationMode { AllocationMode::BLOCKING, AllocationMode::NON_BLOCKING } |
Public Member Functions | |
virtual | ~SamResourceManager ()=default |
virtual std::shared_ptr< SeResource< CalypsoSam > > | allocateSamResource (const AllocationMode allocationMode, const std::shared_ptr< SamIdentifier > samIdentifier)=0 |
virtual void | freeSamResource (const SeResource< CalypsoSam > &samResource)=0 |
Protected Member Functions | |
virtual std::shared_ptr< ManagedSamResource > | createSamResource (std::shared_ptr< SeReader > samReader) |
Management of SAM resources:
Provides methods fot the allocation/deallocation of SAM resources
|
virtualdefault |
|
pure virtual |
Allocate a SAM resource from the specified SAM group.
In the case where the allocation mode is BLOCKING, this method will wait until a SAM resource becomes free and then return the reference to the allocated resource. However, the BLOCKING mode will wait a maximum time defined in milliseconds by MAX_BLOCKING_TIME.
In the case where the allocation mode is NON_BLOCKING and no SAM resource is available, this method will return an exception.
If the samGroup argument is null, the first available SAM resource will be selected and returned regardless of its group.
allocationMode | the blocking/non-blocking mode |
samIdentifier | the targeted SAM identifier |
CalypsoNoSamResourceAvailableException | if no resource is available |
KeypleReaderException | if a reader error occurs |
KeypleAllocationReaderException | if reader allocation fails |
Implemented in keyple::calypso::transaction::SamResourceManagerPool, and keyple::calypso::transaction::SamResourceManagerDefault.
|
protectedvirtual |
Create a SAM resource from the provided SAM reader.
Proceed with the SAM selection and combine the SAM reader and the Calypso SAM resulting from the selection.
samReader | the SAM reader with which the APDU exchanges will be done. |
CalypsoNoSamResourceAvailableException | if an error occurs while doing the selection |
|
pure virtual |
Free a previously allocated SAM resource.
samResource | the SAM resource reference to free |
Implemented in keyple::calypso::transaction::SamResourceManagerPool, and keyple::calypso::transaction::SamResourceManagerDefault.