Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CmdCardGetDataTraceabilityInformation.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
14
15/* Keyple Card Calypso */
17
18/* Keyple Core Util */
19#include "ApduUtil.h"
20
21namespace keyple {
22namespace card {
23namespace calypso {
24
25using namespace keyple::core::util;
26
27const CalypsoCardCommand CmdCardGetDataTraceabilityInformation::mCommand =
29const std::map<const int, const std::shared_ptr<StatusProperties>>
30 CmdCardGetDataTraceabilityInformation::STATUS_TABLE = initStatusTable();
31
33 const std::shared_ptr<CalypsoCardAdapter> calypsoCard)
34: AbstractCardCommand(mCommand, -1, calypsoCard)
35{
36 buildCommand(calypsoCard->getCardClass());
37}
38
40 const CalypsoCardClass calypsoCardClass)
41: AbstractCardCommand(mCommand, -1, nullptr)
42{
43 buildCommand(calypsoCardClass);
44}
45
46
47void CmdCardGetDataTraceabilityInformation::buildCommand(const CalypsoCardClass calypsoCardClass)
48{
49 // APDU Case 2 - always outside secure session
51 std::make_shared<ApduRequestAdapter>(
52 ApduUtil::build(
53 calypsoCardClass.getValue(),
54 mCommand.getInstructionByte(),
55 0x01,
56 0x85,
57 0x00)));
58}
59
61{
62 return false;
63}
64
66 const std::shared_ptr<ApduResponseApi> apduResponse)
67{
69
70 getCalypsoCard()->setTraceabilityInformation(apduResponse->getDataOut());
71}
72
73const std::map<const int, const std::shared_ptr<StatusProperties>>
74 CmdCardGetDataTraceabilityInformation::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({0x6B00,
84 std::make_shared<StatusProperties>("P1 or P2 value not supported.",
85 typeid(CardDataAccessException))});
86
87 return m;
88}
89
90const std::map<const int, const std::shared_ptr<StatusProperties>>&
92{
93 return STATUS_TABLE;
94}
95
96}
97}
98}
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
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
CmdCardGetDataTraceabilityInformation(const std::shared_ptr< CalypsoCardAdapter > calypsoCard)
void parseApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse) override