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

#include <AbstractIso7816CommandBuilder.h>

Inherits keyple::core::command::AbstractApduCommandBuilder.

Inherited by keyple::calypso::command::po::AbstractPoCommandBuilder< AbstractOpenSessionRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< AppendRecordRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< ChangeKeyRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< CloseSessionRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< DecreaseRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< GetDataFciRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< GetDataTraceRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< IncreaseRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< InvalidateRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< PoGetChallengeRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< ReadRecordsRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< RehabilitateRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< SelectFileRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< SvDebitRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< SvGetRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< SvReloadRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< SvUndebitRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< UpdateRecordRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< VerifyPinRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< WriteRecordRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< CardCipherPinRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< CardGenerateKeyRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< DigestAuthenticateRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< DigestCloseRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< DigestInitRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< DigestUpdateMultipleRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< DigestUpdateRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< GiveRandomRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SamGetChallengeRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SamReadCeilingsRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SamReadEventCounterRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SamReadKeyParametersRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SamWriteKeyRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SelectDiversifierRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SvCheckRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< SvPrepareOperationRespPars >, keyple::calypso::command::sam::AbstractSamCommandBuilder< UnlockRespPars >, keyple::calypso::command::po::AbstractPoCommandBuilder< T >, and keyple::calypso::command::sam::AbstractSamCommandBuilder< T >.

Public Member Functions

 AbstractIso7816CommandBuilder (const std::shared_ptr< SeCommand > commandReference, const std::shared_ptr< ApduRequest > request)
 
 AbstractIso7816CommandBuilder (const std::string &name, const std::shared_ptr< ApduRequest > request)
 
virtual ~AbstractIso7816CommandBuilder ()=default
 
- Public Member Functions inherited from keyple::core::command::AbstractApduCommandBuilder
 AbstractApduCommandBuilder (const std::shared_ptr< SeCommand > commandRef, const std::shared_ptr< ApduRequest > request)
 
 AbstractApduCommandBuilder (const std::string &name, const std::shared_ptr< ApduRequest > request)
 
virtual ~AbstractApduCommandBuilder ()=default
 
virtual void addSubName (const std::string &subName)
 
virtual const std::shared_ptr< SeCommandgetCommandRef () const
 
virtual const std::string & getName () const
 
virtual const std::shared_ptr< ApduRequestgetApduRequest () const
 

Protected Member Functions

virtual std::shared_ptr< ApduRequestsetApduRequest (const uint8_t cla, const SeCommand &command, const uint8_t p1, const uint8_t p2, const std::vector< uint8_t > &dataIn)
 
virtual std::shared_ptr< ApduRequestsetApduRequest (const uint8_t cla, const SeCommand &command, const uint8_t p1, const uint8_t p2, const uint8_t le)
 
virtual std::shared_ptr< ApduRequestsetApduRequest (const uint8_t cla, const SeCommand &command, const uint8_t p1, const uint8_t p2, const std::vector< uint8_t > &dataIn, const uint8_t le)
 

Additional Inherited Members

- Protected Attributes inherited from keyple::core::command::AbstractApduCommandBuilder
const std::shared_ptr< SeCommandmCommandRef
 
std::shared_ptr< ApduRequestmRequest
 

Detailed Description

Iso7816 APDU command builder.

It has to be extended by all PO and SAM command builder classes.

It provides, through the AbstractApduCommandBuilder superclass, the generic getters to retrieve:

Constructor & Destructor Documentation

◆ AbstractIso7816CommandBuilder() [1/2]

keyple::core::command::AbstractIso7816CommandBuilder::AbstractIso7816CommandBuilder ( const std::shared_ptr< SeCommand commandReference,
const std::shared_ptr< ApduRequest request 
)

Abstract constructor to build a command with a command reference and an keyple::core::seproxy::message::ApduRequest.

Parameters
commandReferencecommand reference
requestApduRequest

◆ AbstractIso7816CommandBuilder() [2/2]

keyple::core::command::AbstractIso7816CommandBuilder::AbstractIso7816CommandBuilder ( const std::string &  name,
const std::shared_ptr< ApduRequest request 
)

Abstract constructor to build a command with a command name and an keyple::core::seproxy::message::ApduRequest

Parameters
namename of command
requestApduRequest

◆ ~AbstractIso7816CommandBuilder()

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

Member Function Documentation

◆ setApduRequest() [1/3]

std::shared_ptr< ApduRequest > keyple::core::command::AbstractIso7816CommandBuilder::setApduRequest ( const uint8_t  cla,
const SeCommand command,
const uint8_t  p1,
const uint8_t  p2,
const std::vector< uint8_t > &  dataIn 
)
protectedvirtual

Helper method to create an ApduRequest from separated elements.

The ISO7816-4 case for data in a command-response pair is determined from the provided arguments:

  • dataIn  = null, le  = null  →   case 1: no command data, no response data expected.
  • dataIn  = null, le != null  →   case 2: no command data, expected response data.
  • dataIn != null, le  = null  →   case 3: command data, no response data expected.
  • dataIn != null, le  = 0      →  case 4: command data, expected response data.

If dataIn is not null and Le > 0 an IllegalArgumentException is thrown

Parameters
claclass of instruction
commandinstruction code
p1instruction parameter 1
p2instruction parameter 2
dataInbytes sent in the data field of the command. dataIn.limit will be Lc (Number of bytes present in the data field of the command)
Returns
an ApduRequest

◆ setApduRequest() [2/3]

std::shared_ptr< ApduRequest > keyple::core::command::AbstractIso7816CommandBuilder::setApduRequest ( const uint8_t  cla,
const SeCommand command,
const uint8_t  p1,
const uint8_t  p2,
const std::vector< uint8_t > &  dataIn,
const uint8_t  le 
)
protectedvirtual

Helper method to create an ApduRequest from separated elements.

The ISO7816-4 case for data in a command-response pair is determined from the provided arguments:

  • dataIn  = null, le  = null  →   case 1: no command data, no response data expected.
  • dataIn  = null, le != null  →   case 2: no command data, expected response data.
  • dataIn != null, le  = null  →   case 3: command data, no response data expected.
  • dataIn != null, le  = 0      →  case 4: command data, expected response data.

If dataIn is not null and Le > 0 an IllegalArgumentException is thrown

Parameters
claclass of instruction
commandinstruction code
p1instruction parameter 1
p2instruction parameter 2
dataInbytes sent in the data field of the command. dataIn.limit will be Lc (Number of bytes present in the data field of the command)
lemaximum number of bytes expected in the data field of the response to the command (set to 0 is the case where ingoing and outgoing are present. Let the lower layer to handle the actual length [case4])
Returns
an ApduRequest

◆ setApduRequest() [3/3]

std::shared_ptr< ApduRequest > keyple::core::command::AbstractIso7816CommandBuilder::setApduRequest ( const uint8_t  cla,
const SeCommand command,
const uint8_t  p1,
const uint8_t  p2,
const uint8_t  le 
)
protectedvirtual

Helper method to create an ApduRequest from separated elements.

The ISO7816-4 case for data in a command-response pair is determined from the provided arguments:

  • dataIn  = null, le  = null  →   case 1: no command data, no response data expected.
  • dataIn  = null, le != null  →   case 2: no command data, expected response data.
  • dataIn != null, le  = null  →   case 3: command data, no response data expected.
  • dataIn != null, le  = 0      →  case 4: command data, expected response data.

If dataIn is not null and Le > 0 an IllegalArgumentException is thrown

Parameters
claclass of instruction
commandinstruction code
p1instruction parameter 1
p2instruction parameter 2
lemaximum number of bytes expected in the data field of the response to the command (set to 0 is the case where ingoing and outgoing are present. Let the lower layer to handle the actual length [case4])
Returns
an ApduRequest

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