Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CmdCardRehabilitate.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 "CmdCardRehabilitate.h"
14
15#include <sstream>
16
17/* Keyple Card Calypso */
22
23/* Keyple Cre Util */
24#include "ApduUtil.h"
25
26namespace keyple {
27namespace card {
28namespace calypso {
29
30using namespace keyple::core::util;
31using namespace keyple::core::util::cpp;
32
33const CalypsoCardCommand CmdCardRehabilitate::mCommand = CalypsoCardCommand::REHABILITATE;
34const std::map<const int, const std::shared_ptr<StatusProperties>>
35 CmdCardRehabilitate::STATUS_TABLE = initStatusTable();
36
37CmdCardRehabilitate::CmdCardRehabilitate(const std::shared_ptr<CalypsoCardAdapter> calypsoCard)
38: AbstractCardCommand(mCommand, 0, calypsoCard)
39{
40 const uint8_t p1 = 0x00;
41 const uint8_t p2 = 0x00;
42
43 // APDU Case 1
45 std::make_shared<ApduRequestAdapter>(
46 ApduUtil::build(calypsoCard->getCardClass().getValue(),
47 mCommand.getInstructionByte(),
48 p1,
49 p2,
50 0x00)));
51}
52
54{
55 return true;
56}
57
58const std::map<const int, const std::shared_ptr<StatusProperties>>
59 CmdCardRehabilitate::initStatusTable()
60{
61 std::map<const int, const std::shared_ptr<StatusProperties>> m =
63
64 m.insert({0x6400,
65 std::make_shared<StatusProperties>("Too many modifications in session.",
67 m.insert({0x6700,
68 std::make_shared<StatusProperties>("Lc value not supported.",
69 typeid(CardDataAccessException))});
70 m.insert({0x6982,
71 std::make_shared<StatusProperties>("Security conditions not fulfilled (no session, " \
72 "wrong key).",
73 typeid(CardSecurityContextException))});
74 m.insert({0x6985,
75 std::make_shared<StatusProperties>("Access forbidden (DF context is invalid).",
76 typeid(CardAccessForbiddenException))});
77
78 return m;
79}
80
81const std::map<const int, const std::shared_ptr<StatusProperties>>&
83{
84 return STATUS_TABLE;
85}
86
87}
88}
89}
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const CalypsoCardCommand REHABILITATE
CmdCardRehabilitate(const std::shared_ptr< CalypsoCardAdapter > calypsoCard)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override