21#include "BerTlvUtil.h"
22#include "ByteArrayUtil.h"
23#include "IllegalStateException.h"
24#include "KeypleAssert.h"
30using namespace calypsonet::terminal::calypso;
31using namespace keyple::core::util;
32using namespace keyple::core::util::cpp::exception;
34const int CmdCardSelectFile::TAG_PROPRIETARY_INFORMATION = 0x85;
36const std::map<const int, const std::shared_ptr<StatusProperties>>
37 CmdCardSelectFile::STATUS_TABLE = initStatusTable();
40 const SelectFileControl selectFileControl)
43 const uint8_t cla = calypsoCardClass.
getValue();
46 const std::vector<uint8_t> selectData = {0x00, 0x00};
48 switch (selectFileControl) {
49 case SelectFileControl::FIRST_EF:
53 case SelectFileControl::NEXT_EF:
57 case SelectFileControl::CURRENT_DF:
63 throw IllegalStateException(
"Unsupported selectFileControl parameter " \
64 "FIXME: selectFileControl.name()");
68 std::make_shared<ApduRequestAdapter>(
72 addSubName(
"SELECTIONCONTROL FIXME: selectFileControl");
88 productType == CalypsoCard::ProductType::PRIME_REVISION_2) {
96 const std::vector<uint8_t> dataIn = {
static_cast<uint8_t
>((lid >> 8) & 0xFF),
97 static_cast<uint8_t
>(lid & 0xFF)};
100 std::make_shared<ApduRequestAdapter>(
101 ApduUtil::build(calypsoCardClass.
getValue(),
108 addSubName(
"LID=" + ByteArrayUtil::toHex(dataIn));
118 if (mProprietaryInformation.empty()) {
119 const std::map<const int, const std::vector<uint8_t>> tags =
122 const auto it = tags.find(TAG_PROPRIETARY_INFORMATION);
123 if (it == tags.end()) {
124 throw new IllegalStateException(
"Proprietary information: tag not found.");
127 mProprietaryInformation = it->second;
128 Assert::getInstance().isEqual(mProprietaryInformation.size(), 23,
"proprietaryInformation");
131 return mProprietaryInformation;
134const std::map<const int, const std::shared_ptr<StatusProperties>>
135 CmdCardSelectFile::initStatusTable()
137 std::map<const int, const std::shared_ptr<StatusProperties>> m =
141 std::make_shared<StatusProperties>(
"Lc value not supported.",
144 std::make_shared<StatusProperties>(
"File not found.",
145 typeid(CardDataAccessException))});
147 std::make_shared<StatusProperties>(
"Correct execution (ISO7816 T=0).",
153const std::map<const int, const std::shared_ptr<StatusProperties>>&
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual void addSubName(const std::string &subName) final
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const CalypsoCardClass LEGACY
static const CalypsoCardCommand SELECT_FILE
uint8_t getInstructionByte() const
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
const std::vector< uint8_t > & getProprietaryInformation()
CmdCardSelectFile(const CalypsoCardClass calypsoCardClass, const SelectFileControl selectFileControl)
bool isSessionBufferUsed() const override
CalypsoSam::ProductType ProductType