Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
CmdCardInvalidate.cpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2021 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 "CmdCardInvalidate.h"
14
15/* Keyple Card Calypso */
20
21/* Keyple Core Util */
22#include "ApduUtil.h"
23
24namespace keyple {
25namespace card {
26namespace calypso {
27
28using namespace keyple::core::util;
29
30const CalypsoCardCommand CmdCardInvalidate::mCommand = CalypsoCardCommand::INVALIDATE;
31const std::map<const int, const std::shared_ptr<StatusProperties>>
32 CmdCardInvalidate::STATUS_TABLE = initStatusTable();
33
35: AbstractCardCommand(mCommand)
36{
37 const uint8_t p1 = 0x00;
38 const uint8_t p2 = 0x00;
39
41 std::make_shared<ApduRequestAdapter>(
42 ApduUtil::build(calypsoCardClass.getValue(), mCommand.getInstructionByte(), p1, p2)));
43}
44
46{
47 return true;
48}
49
50const std::map<const int, const std::shared_ptr<StatusProperties>>
51 CmdCardInvalidate::initStatusTable()
52{
53 std::map<const int, const std::shared_ptr<StatusProperties>> m =
55
56 m.insert({0x6400,
57 std::make_shared<StatusProperties>("Too many modifications in session.",
59 m.insert({0x6700,
60 std::make_shared<StatusProperties>("Lc value not supported.",
61 typeid(CardDataAccessException))});
62 m.insert({0x6982,
63 std::make_shared<StatusProperties>("Security conditions not fulfilled (no session, " \
64 "wrong key).",
65 typeid(CardSecurityContextException))});
66 m.insert({0x6985,
67 std::make_shared<StatusProperties>("Access forbidden (DF context is invalid).",
68 typeid(CardAccessForbiddenException))});
69
70 return m;
71}
72
73const std::map<const int, const std::shared_ptr<StatusProperties>>&
75{
76 return STATUS_TABLE;
77}
78
79}
80}
81}
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 INVALIDATE
CmdCardInvalidate(const CalypsoCardClass calypsoCardClass)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override