Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
keyple::core::command::AbstractApduResponseParser Class Reference

#include <AbstractApduResponseParser.h>

Inherited by keyple::calypso::command::po::AbstractPoResponseParser, and keyple::calypso::command::sam::AbstractSamResponseParser.

Classes

class  StatusProperties
 

Public Member Functions

 AbstractApduResponseParser (const std::shared_ptr< ApduResponse > response, AbstractApduCommandBuilder *builder)
 
 AbstractApduResponseParser (const AbstractApduResponseParser &aarp)=default
 
virtual ~AbstractApduResponseParser ()=default
 
void setApduResponse (const std::shared_ptr< ApduResponse > &response)
 
const std::shared_ptr< ApduResponsegetApduResponse () const
 
virtual AbstractApduCommandBuildergetBuilder () const
 
virtual bool isSuccessful () const
 
std::string getStatusInformation () const
 
virtual void checkStatus () const
 

Protected Member Functions

virtual const KeypleSeCommandException buildCommandException (const std::type_info &exceptionClass, const std::string &message, const std::shared_ptr< SeCommand > commandRef, const int statusCode) const
 
virtual const std::map< int, std::shared_ptr< StatusProperties > > & getStatusTable () const
 
virtual const std::shared_ptr< SeCommandgetCommandRef () const
 

Protected Attributes

std::shared_ptr< ApduResponsemResponse
 
AbstractApduCommandBuildermBuilder
 

Static Protected Attributes

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

Detailed Description

Base class for parsing APDU

Constructor & Destructor Documentation

◆ AbstractApduResponseParser() [1/2]

keyple::core::command::AbstractApduResponseParser::AbstractApduResponseParser ( const std::shared_ptr< ApduResponse response,
AbstractApduCommandBuilder builder 
)

the generic abstract constructor to build a parser of the APDU response.

Parameters
responseresponse to parse
builderthe reference of the builder that created the parser

◆ AbstractApduResponseParser() [2/2]

keyple::core::command::AbstractApduResponseParser::AbstractApduResponseParser ( const AbstractApduResponseParser aarp)
default

Copy constructor

Required by macOS/CLang...

◆ ~AbstractApduResponseParser()

virtual keyple::core::command::AbstractApduResponseParser::~AbstractApduResponseParser ( )
virtualdefault

Member Function Documentation

◆ buildCommandException()

const KeypleSeCommandException keyple::core::command::AbstractApduResponseParser::buildCommandException ( const std::type_info &  exceptionClass,
const std::string &  message,
const std::shared_ptr< SeCommand commandRef,
const int  statusCode 
) const
protectedvirtual

Build a command exception.
This method should be override in subclasses in order to create specific exceptions.

Parameters
exceptionClassthe exception class
messagethe message
commandRefthe command reference
statusCodethe status code
Returns
a new instance not null

Reimplemented in keyple::calypso::command::sam::AbstractSamResponseParser, and keyple::calypso::command::po::AbstractPoResponseParser.

◆ checkStatus()

void keyple::core::command::AbstractApduResponseParser::checkStatus ( ) const
virtual

This method check the status code.
If status code is not referenced, then status is considered unsuccessful.

Exceptions
KeypleSeCommandExceptionif status is not successful.

Reimplemented in keyple::calypso::command::sam::AbstractSamResponseParser, and keyple::calypso::command::po::AbstractPoResponseParser.

◆ getApduResponse()

const std::shared_ptr< ApduResponse > keyple::core::command::AbstractApduResponseParser::getApduResponse ( ) const

Gets the apdu response.

Returns
the APDU response.

◆ getBuilder()

AbstractApduCommandBuilder * keyple::core::command::AbstractApduResponseParser::getBuilder ( ) const
virtual

◆ getCommandRef()

const std::shared_ptr< SeCommand > keyple::core::command::AbstractApduResponseParser::getCommandRef ( ) const
protectedvirtual

Gets the associated command reference.
By default, the command reference is retrieved from the associated builder.

Returns
a nullable command reference

◆ getStatusInformation()

std::string keyple::core::command::AbstractApduResponseParser::getStatusInformation ( ) const
Returns
the ASCII message from the statusTable for the current status code.

◆ getStatusTable()

const std::map< int, std::shared_ptr< StatusProperties > > & keyple::core::command::AbstractApduResponseParser::getStatusTable ( ) const
protectedvirtual
Returns
the internal status table

Reimplemented in keyple::calypso::command::sam::parser::security::UnlockRespPars, keyple::calypso::command::sam::parser::security::SvPrepareOperationRespPars, keyple::calypso::command::sam::parser::security::SvCheckRespPars, keyple::calypso::command::sam::parser::security::SelectDiversifierRespPars, keyple::calypso::command::sam::parser::security::SamWriteKeyRespPars, keyple::calypso::command::sam::parser::security::SamReadKeyParametersRespPars, keyple::calypso::command::sam::parser::security::SamReadEventCounterRespPars, keyple::calypso::command::sam::parser::security::SamReadCeilingsRespPars, keyple::calypso::command::sam::parser::security::SamGetChallengeRespPars, keyple::calypso::command::sam::parser::security::GiveRandomRespPars, keyple::calypso::command::sam::parser::security::DigestUpdateRespPars, keyple::calypso::command::sam::parser::security::DigestUpdateMultipleRespPars, keyple::calypso::command::sam::parser::security::DigestInitRespPars, keyple::calypso::command::sam::parser::security::DigestCloseRespPars, keyple::calypso::command::sam::parser::security::DigestAuthenticateRespPars, keyple::calypso::command::sam::parser::security::CardGenerateKeyRespPars, keyple::calypso::command::sam::parser::security::CardCipherPinRespPars, keyple::calypso::command::sam::AbstractSamResponseParser, keyple::calypso::command::po::parser::WriteRecordRespPars, keyple::calypso::command::po::parser::UpdateRecordRespPars, keyple::calypso::command::po::parser::storedvalue::SvUndebitRespPars, keyple::calypso::command::po::parser::storedvalue::SvReloadRespPars, keyple::calypso::command::po::parser::storedvalue::SvGetRespPars, keyple::calypso::command::po::parser::storedvalue::SvDebitRespPars, keyple::calypso::command::po::parser::SelectFileRespPars, keyple::calypso::command::po::parser::security::VerifyPinRespPars, keyple::calypso::command::po::parser::security::RehabilitateRespPars, keyple::calypso::command::po::parser::security::InvalidateRespPars, keyple::calypso::command::po::parser::security::CloseSessionRespPars, keyple::calypso::command::po::parser::security::ChangeKeyRespPars, keyple::calypso::command::po::parser::security::AbstractOpenSessionRespPars, keyple::calypso::command::po::parser::ReadRecordsRespPars, keyple::calypso::command::po::parser::IncreaseRespPars, keyple::calypso::command::po::parser::GetDataTraceRespPars, keyple::calypso::command::po::parser::GetDataFciRespPars, keyple::calypso::command::po::parser::DecreaseRespPars, and keyple::calypso::command::po::parser::AppendRecordRespPars.

◆ isSuccessful()

bool keyple::core::command::AbstractApduResponseParser::isSuccessful ( ) const
virtual
Returns
true if the status is successful from the statusTable according to the current status code.

◆ setApduResponse()

void keyple::core::command::AbstractApduResponseParser::setApduResponse ( const std::shared_ptr< ApduResponse > &  response)

Sets the Apdu response to parse

Parameters
responsethe apdu response

Member Data Documentation

◆ mBuilder

AbstractApduCommandBuilder* keyple::core::command::AbstractApduResponseParser::mBuilder
protected

Parsers are usually created by their associated builder. The CalypsoSam field maintains a link between the builder and the parser in order to allow the parser to access the builder parameters that were used to create the command (e.g. SFI, registration number, etc.).

◆ mResponse

std::shared_ptr<ApduResponse> keyple::core::command::AbstractApduResponseParser::mResponse
protected

The byte array APDU response

◆ STATUS_TABLE

const std::map< int, std::shared_ptr< StatusProperties > > keyple::core::command::AbstractApduResponseParser::STATUS_TABLE
staticprotected
Initial value:
= {
{
0x9000,
std::make_shared<StatusProperties>(
"Success")
}
}

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