Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
CmdCardRehabilitate.cpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2022 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
38: AbstractCardCommand(mCommand)
39{
40 const uint8_t p1 = 0x00;
41 const uint8_t p2 = 0x00;
42
44 std::make_shared<ApduRequestAdapter>(
45 ApduUtil::build(calypsoCardClass.getValue(),
46 mCommand.getInstructionByte(), p1, p2)));
47}
48
50{
51 return true;
52}
53
54const std::map<const int, const std::shared_ptr<StatusProperties>>
55 CmdCardRehabilitate::initStatusTable()
56{
57 std::map<const int, const std::shared_ptr<StatusProperties>> m =
59
60 m.insert({0x6400,
61 std::make_shared<StatusProperties>("Too many modifications in session.",
63 m.insert({0x6700,
64 std::make_shared<StatusProperties>("Lc value not supported.",
65 typeid(CardDataAccessException))});
66 m.insert({0x6982,
67 std::make_shared<StatusProperties>("Security conditions not fulfilled (no session, " \
68 "wrong key).",
69 typeid(CardSecurityContextException))});
70 m.insert({0x6985,
71 std::make_shared<StatusProperties>("Access forbidden (DF context is invalid).",
72 typeid(CardAccessForbiddenException))});
73
74 return m;
75}
76
77const std::map<const int, const std::shared_ptr<StatusProperties>>&
79{
80 return STATUS_TABLE;
81}
82
83}
84}
85}
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 CalypsoCardClass calypsoCardClass)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override