24#include "IllegalStateException.h"
30using namespace keyple::core::util;
31using namespace keyple::core::util::cpp;
33const int CmdCardGetDataEfList::DESCRIPTORS_OFFSET = 2;
34const int CmdCardGetDataEfList::DESCRIPTOR_DATA_OFFSET = 2;
35const int CmdCardGetDataEfList::DESCRIPTOR_DATA_SFI_OFFSET = 2;
36const int CmdCardGetDataEfList::DESCRIPTOR_TAG_LENGTH = 8;
37const int CmdCardGetDataEfList::DESCRIPTOR_DATA_LENGTH = 6;
39const std::map<const int, const std::shared_ptr<StatusProperties>>
40 CmdCardGetDataEfList::STATUS_TABLE = initStatusTable();
46 std::make_shared<ApduRequestAdapter>(
47 ApduUtil::build(calypsoCardClass.
getValue(),
59const std::map<const int, const std::shared_ptr<StatusProperties>>
60 CmdCardGetDataEfList::initStatusTable()
62 std::map<const int, const std::shared_ptr<StatusProperties>> m =
66 std::make_shared<StatusProperties>(
"Data object not found (optional mode not " \
70 std::make_shared<StatusProperties>(
"P1 or P2 value not supported.",
71 typeid(CardDataAccessException))});
76const std::map<const int, const std::shared_ptr<StatusProperties>>&
82const std::map<const std::shared_ptr<FileHeaderAdapter>,
const uint8_t>
86 std::map<const std::shared_ptr<FileHeaderAdapter>,
const uint8_t> fileHeaderToSfiMap;
87 const int nbFiles = rawList[1] / DESCRIPTOR_TAG_LENGTH;
89 for (
int i = 0; i < nbFiles; i++) {
90 fileHeaderToSfiMap.insert({
94 DESCRIPTORS_OFFSET + (i * DESCRIPTOR_TAG_LENGTH) + DESCRIPTOR_DATA_OFFSET,
96 + (i * DESCRIPTOR_TAG_LENGTH)
97 + DESCRIPTOR_DATA_OFFSET
98 + DESCRIPTOR_DATA_LENGTH)),
101 + (i * DESCRIPTOR_TAG_LENGTH)
102 + DESCRIPTOR_DATA_OFFSET
103 + DESCRIPTOR_DATA_SFI_OFFSET]});
106 return fileHeaderToSfiMap;
109const std::shared_ptr<FileHeaderAdapter> CmdCardGetDataEfList::createFileHeader(
110 const std::vector<uint8_t>& efDescriptorByteArray)
const
112 ElementaryFile::Type efType;
115 efType = ElementaryFile::Type::LINEAR;
117 efType = ElementaryFile::Type::CYCLIC;
119 efType = ElementaryFile::Type::COUNTERS;
121 efType = ElementaryFile::Type::BINARY;
123 efType = ElementaryFile::Type::SIMULATED_COUNTERS;
125 throw IllegalStateException(
"Unexpected EF type");
129 ->lid(efDescriptorByteArray[0] << 8 | (efDescriptorByteArray[1] & 0xFF))
131 .recordSize(efDescriptorByteArray[4])
132 .recordsNumber(efDescriptorByteArray[5])
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const CalypsoCardCommand GET_DATA
uint8_t getInstructionByte() const
static const int EF_TYPE_CYCLIC
static const int EF_TYPE_LINEAR
static const int EF_TYPE_SIMULATED_COUNTERS
static const int EF_TYPE_BINARY
static const int EF_TYPE_COUNTERS
bool isSessionBufferUsed() const override
CmdCardGetDataEfList(const CalypsoCardClass calypsoCardClass)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
const std::map< const std::shared_ptr< FileHeaderAdapter >, const uint8_t > getEfHeaders() const