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

#include <AbstractApduCommand.h>

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

Classes

class  StatusProperties
 

Public Member Functions

 AbstractApduCommand (const CardCommand &commandRef)
 
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 CardCommand &commandRef, const int statusWord) const
 
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)

(package-private)
Constructor

Parameters
commandRefThe command reference.
Since
2.0.1

Definition at line 59 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 62 of file AbstractApduCommand.cpp.

◆ buildCommandException()

const CalypsoApduCommandException keyple::card::calypso::AbstractApduCommand::buildCommandException ( const std::type_info &  exceptionClass,
const std::string &  message,
const CardCommand commandRef,
const int  statusWord 
) const
virtual

(package-private)
Builds a command exception.

This method should be override in subclasses in order to create specific exceptions.

Parameters
exceptionClassthe exception class.
messagethe message.
commandRefCardCommand the command reference.
statusWordthe status word.
Returns
A not null value
Since
2.0.1

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

Definition at line 108 of file AbstractApduCommand.cpp.

◆ checkStatus()

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

(package-private)
This method check the status word.
If status word is not referenced, then status is considered unsuccessful.

Exceptions
CalypsoApduCommandExceptionif status is not successful.
Since
2.0.1

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

Definition at line 137 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 84 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 97 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 68 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 73 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 160 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::CmdCardSvDebit, keyple::card::calypso::CmdCardSvGet, keyple::card::calypso::CmdCardSvReload, keyple::card::calypso::CmdCardSvUndebit, 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::CmdSamDigestAuthenticate, keyple::card::calypso::CmdSamDigestClose, keyple::card::calypso::CmdSamDigestInit, keyple::card::calypso::CmdSamDigestUpdate, keyple::card::calypso::CmdSamGetChallenge, keyple::card::calypso::CmdSamGiveRandom, keyple::card::calypso::CmdSamSelectDiversifier, keyple::card::calypso::CmdSamSvCheck, keyple::card::calypso::CmdSamSvPrepareDebit, keyple::card::calypso::CmdSamSvPrepareLoad, keyple::card::calypso::CmdSamSvPrepareUndebit, and keyple::card::calypso::CmdSamUnlock.

Definition at line 103 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.

Returns
A value
Since
2.0.1

Definition at line 130 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 78 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: