Keyple Card Calypso C++ Library 2.2.2
Reference Terminal Reader API for C++
Classes | Public Member Functions | Static Public Attributes | List of all members
keyple::card::calypso::AbstractApduCommand Class Referenceabstract

#include <AbstractApduCommand.h>

Inheritance diagram for keyple::card::calypso::AbstractApduCommand:
Inheritance graph
[legend]

Classes

class  StatusProperties
 

Public Member Functions

 AbstractApduCommand (const CardCommand &commandRef, const int le)
 
virtual void addSubName (const std::string &subName) final
 
virtual const CardCommandgetCommandRef () const
 
virtual const std::string & getName () const final
 
virtual void setApduRequest (const std::shared_ptr< ApduRequestAdapter > apduRequest) final
 
virtual const std::shared_ptr< ApduRequestAdaptergetApduRequest () const final
 
virtual AbstractApduCommandsetApduResponse (const std::shared_ptr< ApduResponseApi > apduResponse)
 
virtual const std::shared_ptr< ApduResponseApi > getApduResponse () const final
 
virtual const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable () const
 
virtual const CalypsoApduCommandException buildCommandException (const std::type_info &exceptionClass, const std::string &message) const =0
 
virtual const CalypsoApduCommandException buildUnexpectedResponseLengthException (const std::string &message) const =0
 
virtual bool isSuccessful () const final
 
virtual void checkStatus ()
 
virtual const std::string getStatusInformation () const final
 

Static Public Attributes

static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
 

Detailed Description

(package-private)
Generic APDU command.

It provides the generic getters to retrieve:

Since
2.0.1

Definition at line 48 of file AbstractApduCommand.h.

Constructor & Destructor Documentation

◆ AbstractApduCommand()

keyple::card::calypso::AbstractApduCommand::AbstractApduCommand ( const CardCommand commandRef,
const int  le 
)

(package-private)
Constructor

Parameters
commandRefThe command reference.
leThe value of the LE field.
Since
2.0.1

Definition at line 61 of file AbstractApduCommand.cpp.

Member Function Documentation

◆ addSubName()

void keyple::card::calypso::AbstractApduCommand::addSubName ( const std::string &  subName)
finalvirtual

(package-private)
Appends a string to the current name.

The sub name completes the name of the current command. This method must therefore only be invoked conditionally (log level >= debug).

Parameters
subNameThe string to append.
Exceptions
NullPointerExceptionIf the request is not set.
Since
2.0.1

Definition at line 64 of file AbstractApduCommand.cpp.

◆ buildCommandException()

virtual const CalypsoApduCommandException keyple::card::calypso::AbstractApduCommand::buildCommandException ( const std::type_info &  exceptionClass,
const std::string &  message 
) const
pure virtual

(package-private)
Builds a specific APDU command exception.

Parameters
messageThe message.
Returns
A not null reference.
A not null value
Since
2.0.1

Implemented in keyple::card::calypso::AbstractCardCommand, and keyple::card::calypso::AbstractSamCommand.

◆ buildUnexpectedResponseLengthException()

virtual const CalypsoApduCommandException keyple::card::calypso::AbstractApduCommand::buildUnexpectedResponseLengthException ( const std::string &  message) const
pure virtual

(package-private)
Builds a specific APDU command exception for the case of an unexpected response length.

Parameters
messageThe message.
Returns
A not null reference.
Since
2.1.1

Implemented in keyple::card::calypso::AbstractCardCommand, and keyple::card::calypso::AbstractSamCommand.

◆ checkStatus()

void keyple::card::calypso::AbstractApduCommand::checkStatus ( )
virtual

(package-private)
This method check the status word and if the length of the response is equal to the LE field in the request.
If status word is not referenced, then status is considered unsuccessful.

Exceptions
CalypsoApduCommandExceptionif status is not successful or if the length of the response is not equal to the LE field in the request.
Since
2.0.1

Reimplemented in keyple::card::calypso::AbstractCardCommand, keyple::card::calypso::AbstractSamCommand, and keyple::card::calypso::CmdSamDataCipher.

Definition at line 129 of file AbstractApduCommand.cpp.

◆ getApduRequest()

const std::shared_ptr< ApduRequestAdapter > keyple::card::calypso::AbstractApduCommand::getApduRequest ( ) const
finalvirtual

(package-private)
Gets the ApduRequestAdapter.

Returns
Null if the request is not set.
Since
2.0.1

Definition at line 86 of file AbstractApduCommand.cpp.

◆ getApduResponse()

const std::shared_ptr< ApduResponseApi > keyple::card::calypso::AbstractApduCommand::getApduResponse ( ) const
finalvirtual

(package-private)
Gets ApduResponseApi

Returns
Null if the response is not set.
Since
2.0.1

Definition at line 99 of file AbstractApduCommand.cpp.

◆ getCommandRef()

const CardCommand & keyple::card::calypso::AbstractApduCommand::getCommandRef ( ) const
virtual

(package-private)
Gets CardCommand the current command identification

Returns
A not null reference.
Since
2.0.1

Reimplemented in keyple::card::calypso::AbstractCardCommand, and keyple::card::calypso::AbstractSamCommand.

Definition at line 70 of file AbstractApduCommand.cpp.

◆ getName()

const std::string & keyple::card::calypso::AbstractApduCommand::getName ( ) const
finalvirtual

(package-private)
Gets the name of this APDU command.

Returns
A not empty string.
Since
2.0.1

Definition at line 75 of file AbstractApduCommand.cpp.

◆ getStatusInformation()

const std::string keyple::card::calypso::AbstractApduCommand::getStatusInformation ( ) const
finalvirtual

(package-private)
Gets the ASCII message from the statusTable for the current status word.

Returns
A nullable value
Since
2.0.1

Definition at line 159 of file AbstractApduCommand.cpp.

◆ getStatusTable()

const std::map< const int, const std::shared_ptr< StatusProperties > > & keyple::card::calypso::AbstractApduCommand::getStatusTable ( ) const
virtual

(package-private)
Returns the internal status table

Returns
A not null reference
Since
2.0.1

Reimplemented in keyple::card::calypso::AbstractSamCommand, keyple::card::calypso::CmdCardAppendRecord, keyple::card::calypso::CmdCardChangeKey, keyple::card::calypso::CmdCardChangePin, keyple::card::calypso::CmdCardCloseSession, keyple::card::calypso::CmdCardGetDataEfList, keyple::card::calypso::CmdCardGetDataFci, keyple::card::calypso::CmdCardGetDataFcp, keyple::card::calypso::CmdCardGetDataTraceabilityInformation, keyple::card::calypso::CmdCardIncreaseOrDecrease, keyple::card::calypso::CmdCardIncreaseOrDecreaseMultiple, keyple::card::calypso::CmdCardInvalidate, keyple::card::calypso::CmdCardOpenSession, keyple::card::calypso::CmdCardReadBinary, keyple::card::calypso::CmdCardReadRecordMultiple, keyple::card::calypso::CmdCardReadRecords, keyple::card::calypso::CmdCardRehabilitate, keyple::card::calypso::CmdCardSearchRecordMultiple, keyple::card::calypso::CmdCardSelectFile, keyple::card::calypso::CmdCardSvDebitOrUndebit, keyple::card::calypso::CmdCardSvGet, keyple::card::calypso::CmdCardSvReload, keyple::card::calypso::CmdCardUpdateOrWriteBinary, keyple::card::calypso::CmdCardUpdateRecord, keyple::card::calypso::CmdCardVerifyPin, keyple::card::calypso::CmdCardWriteRecord, keyple::card::calypso::CmdSamCardCipherPin, keyple::card::calypso::CmdSamCardGenerateKey, keyple::card::calypso::CmdSamDataCipher, keyple::card::calypso::CmdSamDigestAuthenticate, keyple::card::calypso::CmdSamDigestClose, keyple::card::calypso::CmdSamDigestInit, keyple::card::calypso::CmdSamDigestUpdate, keyple::card::calypso::CmdSamDigestUpdateMultiple, keyple::card::calypso::CmdSamGetChallenge, keyple::card::calypso::CmdSamGiveRandom, keyple::card::calypso::CmdSamPsoComputeSignature, keyple::card::calypso::CmdSamPsoVerifySignature, keyple::card::calypso::CmdSamReadCeilings, keyple::card::calypso::CmdSamReadEventCounter, keyple::card::calypso::CmdSamReadKeyParameters, keyple::card::calypso::CmdSamSelectDiversifier, keyple::card::calypso::CmdSamSvCheck, keyple::card::calypso::CmdSamSvPrepareDebitOrUndebit, keyple::card::calypso::CmdSamSvPrepareLoad, keyple::card::calypso::CmdSamUnlock, and keyple::card::calypso::CmdSamWriteKey.

Definition at line 105 of file AbstractApduCommand.cpp.

◆ isSuccessful()

bool keyple::card::calypso::AbstractApduCommand::isSuccessful ( ) const
finalvirtual

(package-private)
Gets true if the status is successful from the statusTable according to the current status code and if the length of the response is equal to the LE field in the request.

Returns
A value
Since
2.0.1

Definition at line 119 of file AbstractApduCommand.cpp.

◆ setApduRequest()

void keyple::card::calypso::AbstractApduCommand::setApduRequest ( const std::shared_ptr< ApduRequestAdapter apduRequest)
finalvirtual

(package-private)
Sets the command ApduRequestAdapter.

Parameters
apduRequestThe APDU request.
Since
2.0.1

Definition at line 80 of file AbstractApduCommand.cpp.

◆ setApduResponse()

AbstractApduCommand & keyple::card::calypso::AbstractApduCommand::setApduResponse ( const std::shared_ptr< ApduResponseApi >  apduResponse)
virtual

Member Data Documentation

◆ STATUS_TABLE

const std::map< const int, const std::shared_ptr< StatusProperties > > keyple::card::calypso::AbstractApduCommand::STATUS_TABLE
static
Initial value:
= {
{0x9000, std::make_shared<StatusProperties>("Success")},
}

(package-private)
This Map stores expected status that could be by default initialized with sw1=90 and sw2=00 (Success)

Since
2.0.1

Definition at line 129 of file AbstractApduCommand.h.


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