Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
Public Member Functions | List of all members
keyple::card::calypso::CmdCardSvReload Class Referencefinal

#include <CmdCardSvReload.h>

Inheritance diagram for keyple::card::calypso::CmdCardSvReload:
Inheritance graph
[legend]
Collaboration diagram for keyple::card::calypso::CmdCardSvReload:
Collaboration graph
[legend]

Public Member Functions

 CmdCardSvReload (const std::shared_ptr< CalypsoCardAdapter > calypsoCard, const int amount, const std::vector< uint8_t > &date, const std::vector< uint8_t > &time, const std::vector< uint8_t > &free, const bool isSessionOpen, const bool isExtendedModeAllowed)
 
void finalizeCommand (const std::vector< uint8_t > &reloadComplementaryData)
 
const std::vector< uint8_t > getSvReloadData () const
 
bool isSessionBufferUsed () const override
 
void parseApduResponse (const std::shared_ptr< ApduResponseApi > apduResponse) override
 
const std::vector< uint8_t > getSignatureLo () const
 
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable () const override
 
- Public Member Functions inherited from keyple::card::calypso::AbstractCardCommand
 AbstractCardCommand (const CalypsoCardCommand &commandRef, const int expectedResponseLength, const std::shared_ptr< CalypsoCardAdapter > calypsoCard)
 
const CalypsoCardCommandgetCommandRef () const override
 
const CalypsoApduCommandException buildCommandException (const std::type_info &exceptionClass, const std::string &message) const final
 
const CalypsoApduCommandException buildUnexpectedResponseLengthException (const std::string &message) const final
 
std::shared_ptr< CalypsoCardAdaptergetCalypsoCard () const
 
void parseApduResponse (const std::shared_ptr< ApduResponseApi > apduResponse, const std::shared_ptr< CalypsoCardAdapter > calypsoCard)
 
- Public Member Functions inherited from keyple::card::calypso::AbstractApduCommand
 AbstractApduCommand (const CardCommand &commandRef, const int expectedResponseLength)
 
virtual void addSubName (const std::string &subName) final
 
virtual const std::string & getName () const final
 
virtual void setExpectedResponseLength (const int expectedResponseLength) final
 
virtual void setApduRequest (const std::shared_ptr< ApduRequestAdapter > apduRequest) final
 
virtual const std::shared_ptr< ApduRequestAdaptergetApduRequest () const final
 
virtual const std::shared_ptr< ApduResponseApi > getApduResponse () const final
 
virtual bool isSuccessful () const final
 
virtual const std::string getStatusInformation () const final
 

Additional Inherited Members

- Static Public Attributes inherited from keyple::card::calypso::AbstractApduCommand
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
 

Detailed Description

(package-private)
Builds the SV Reload command.

See specs: Calypso Stored Value balance (signed binaries' coding based on the two's complement method)

balance - 3 bytes signed binary - Integer from -8,388,608 to 8,388,607

amount for reload, 3 bytes signed binary - Integer from -8,388,608 to 8,388,607

-8,388,608           %10000000.00000000.00000000
-8,388,607           %10000000.00000000.00000001
-8,388,606           %10000000.00000000.00000010

-3           %11111111.11111111.11111101
-2           %11111111.11111111.11111110
-1           %11111111.11111111.11111111
0           %00000000.00000000.00000000
1           %00000000.00000000.00000001
2           %00000000.00000000.00000010
3           %00000000.00000000.00000011

8,388,605           %01111111.11111111.11111101
8,388,606           %01111111.11111111.11111110
8,388,607           %01111111.11111111.11111111
Since
2.0.1

Definition at line 62 of file CmdCardSvReload.h.

Constructor & Destructor Documentation

◆ CmdCardSvReload()

keyple::card::calypso::CmdCardSvReload::CmdCardSvReload ( const std::shared_ptr< CalypsoCardAdapter calypsoCard,
const int  amount,
const std::vector< uint8_t > &  date,
const std::vector< uint8_t > &  time,
const std::vector< uint8_t > &  free,
const bool  isSessionOpen,
const bool  isExtendedModeAllowed 
)

(package-private)
Instantiates a new CmdCardSvReload.

The process is carried out in two steps: first to check and store the card and application data, then to create the final APDU with the data from the SAM (see finalizeCommand).

Parameters
calypsoCardThe Calypso card.
amountamount to debit (signed integer from -8388608 to 8388607).
datedebit date (not checked by the card).
timedebit time (not checked by the card).
free2 free bytes stored in the log but not processed by the card.
isExtendedModeAllowedTrue if the extended mode is allowed.
Exceptions
IllegalArgumentExceptionIf the command is inconsistent
Since
2.0.1

Definition at line 46 of file CmdCardSvReload.cpp.

Member Function Documentation

◆ finalizeCommand()

void keyple::card::calypso::CmdCardSvReload::finalizeCommand ( const std::vector< uint8_t > &  reloadComplementaryData)

(package-private)
Complete the construction of the APDU to be sent to the card with the elements received from the SAM:

4-byte SAM id

3-byte challenge

3-byte transaction number

5 or 10 byte signature (hi part)

Parameters
reloadComplementaryDatathe sam id and the data out from the SvPrepareReload SAM command.
Since
2.0.1

Definition at line 92 of file CmdCardSvReload.cpp.

◆ getSignatureLo()

const std::vector< uint8_t > keyple::card::calypso::CmdCardSvReload::getSignatureLo ( ) const

(package-private)
Gets the SV signature.
The signature can be empty here in the case of a secure session where the transmission of the signature is postponed until the end of the session.

Returns
A byte array containing the signature
Since
2.0.1

Definition at line 185 of file CmdCardSvReload.cpp.

◆ getStatusTable()

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

(package-private)
Returns the internal status table

Returns
A not null reference
Since
2.0.1

Since
2.0.1

Reimplemented from keyple::card::calypso::AbstractApduCommand.

Definition at line 221 of file CmdCardSvReload.cpp.

◆ getSvReloadData()

const std::vector< uint8_t > keyple::card::calypso::CmdCardSvReload::getSvReloadData ( ) const

(package-private)
Gets the SV Reload part of the data to include in the SAM SV Prepare Load command

Returns
a byte array containing the SV reload data
Since
2.0.1

Definition at line 148 of file CmdCardSvReload.cpp.

◆ isSessionBufferUsed()

bool keyple::card::calypso::CmdCardSvReload::isSessionBufferUsed ( ) const
overridevirtual

(package-private)
Indicates if the session buffer is used when executing this command.Allows the management of the overflow of this buffer.

Returns
True if this command uses the session buffer
Since
2.0.1

Returns
True
Since
2.0.1

Implements keyple::card::calypso::AbstractCardCommand.

Definition at line 166 of file CmdCardSvReload.cpp.

◆ parseApduResponse()

void keyple::card::calypso::CmdCardSvReload::parseApduResponse ( const std::shared_ptr< ApduResponseApi >  apduResponse)
overridevirtual

(package-private)
Parses the response ApduResponseApi and check the status word.

Parameters
apduResponseThe APDU response.
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
Since
2.0.1

The permitted lengths are 0 (in session), 3 (not 3.2) or 6 (3.2)

Exceptions
IllegalStateExceptionIf the length is incorrect.
Since
2.0.1

Reimplemented from keyple::card::calypso::AbstractCardCommand.

Definition at line 171 of file CmdCardSvReload.cpp.


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