Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CmdCardGetDataFcp.cpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2023 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional information regarding *
5 * copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the terms of the Eclipse *
8 * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 *
9 * *
10 * SPDX-License-Identifier: EPL-2.0 *
11 **************************************************************************************************/
12
13#include "CmdCardGetDataFcp.h"
14
15/* Keyple Card Calypso */
16#include "CmdCardSelectFile.h"
18
19/* Keyple Core Util */
20#include "ApduUtil.h"
21#include "BerTlvUtil.h"
22#include "IllegalStateException.h"
23#include "KeypleAssert.h"
24
25namespace keyple {
26namespace card {
27namespace calypso {
28
29using namespace keyple::core::util;
30using namespace keyple::core::util::cpp::exception;
31
32const CalypsoCardCommand CmdCardGetDataFcp::mCommand = CalypsoCardCommand::GET_DATA;
33const int CmdCardGetDataFcp::TAG_PROPRIETARY_INFORMATION = 0x85;
34const std::map<const int, const std::shared_ptr<StatusProperties>>
35 CmdCardGetDataFcp::STATUS_TABLE = initStatusTable();
36
37CmdCardGetDataFcp::CmdCardGetDataFcp(const std::shared_ptr<CalypsoCardAdapter> calypsoCard)
38: AbstractCardCommand(mCommand, -1, calypsoCard)
39{
40 buildCommand(calypsoCard->getCardClass());
41}
42
44: AbstractCardCommand(mCommand, -1, nullptr)
45{
46 buildCommand(calypsoCardClass);
47}
48
49void CmdCardGetDataFcp::buildCommand(const CalypsoCardClass calypsoCardClass)
50{
51 // APDU Case 2 - always outside secure session
53 std::make_shared<ApduRequestAdapter>(
54 ApduUtil::build(calypsoCardClass.getValue(),
55 mCommand.getInstructionByte(),
56 0x00,
57 0x62,
58 0x00)));
59}
60
61void CmdCardGetDataFcp::parseApduResponse(const std::shared_ptr<ApduResponseApi> apduResponse)
62{
64
66}
67
69{
70 return false;
71}
72
73const std::map<const int, const std::shared_ptr<StatusProperties>>
74 CmdCardGetDataFcp::initStatusTable()
75{
76 std::map<const int, const std::shared_ptr<StatusProperties>> m =
78
79 m.insert({0x6A88,
80 std::make_shared<StatusProperties>("Data object not found (optional mode not " \
81 "available).",
82 typeid(CardDataAccessException))});
83 m.insert({0x6A82,
84 std::make_shared<StatusProperties>("File not found.",
85 typeid(CardDataAccessException))});
86 m.insert({0x6B00,
87 std::make_shared<StatusProperties>("P1 or P2 value not supported.",
88 typeid(CardDataAccessException))});
89
90 return m;
91}
92
93const std::map<const int, const std::shared_ptr<StatusProperties>>&
95{
96 return STATUS_TABLE;
97}
98
99}
100}
101}
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
void parseApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse) override
std::shared_ptr< CalypsoCardAdapter > getCalypsoCard() const
static const CalypsoCardCommand GET_DATA
void parseApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse) override
CmdCardGetDataFcp(const std::shared_ptr< CalypsoCardAdapter > calypsoCard)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
static void parseProprietaryInformation(const std::vector< uint8_t > &dataOut, const std::shared_ptr< CalypsoCardAdapter > calypsoCard)