Keyple Card Calypso C++ Library 2.2.2
Reference Terminal Reader API for C++
CmdSamDigestClose.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 "CmdSamDigestClose.h"
14
15/* Keyple Card Calypso */
17#include "SamUtilAdapter.h"
18
19/* Keyple Core Util */
20#include "ApduUtil.h"
21#include "IllegalArgumentException.h"
22
23namespace keyple {
24namespace card {
25namespace calypso {
26
27using namespace keyple::core::util;
28
29const CalypsoSamCommand CmdSamDigestClose::mCommand = CalypsoSamCommand::DIGEST_CLOSE;
30
31const std::map<const int, const std::shared_ptr<StatusProperties>>
32 CmdSamDigestClose::STATUS_TABLE = initStatusTable();
33
35 const int expectedResponseLength)
36: AbstractSamCommand(mCommand, expectedResponseLength)
37{
39 std::make_shared<ApduRequestAdapter>(
40 ApduUtil::build(SamUtilAdapter::getClassByte(productType),
41 mCommand.getInstructionByte(),
42 0,
43 0,
44 static_cast<uint8_t>(expectedResponseLength))));
45}
46
47const std::vector<uint8_t> CmdSamDigestClose::getSignature() const
48{
49 return isSuccessful() ? getApduResponse()->getDataOut() : std::vector<uint8_t>();
50}
51
52const std::map<const int, const std::shared_ptr<StatusProperties>>
53 CmdSamDigestClose::initStatusTable()
54{
55 std::map<const int, const std::shared_ptr<StatusProperties>> m =
57
58 m.insert({0x6985,
59 std::make_shared<StatusProperties>("Preconditions not satisfied.",
61
62 return m;
63}
64
65const std::map<const int, const std::shared_ptr<StatusProperties>>&
67{
68 return STATUS_TABLE;
69}
70
71}
72}
73}
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
static const CalypsoSamCommand DIGEST_CLOSE
CmdSamDigestClose(const CalypsoSam::ProductType productType, const int expectedResponseLength)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
const std::vector< uint8_t > getSignature() const
static uint8_t getClassByte(const ProductType productType)
CalypsoSam::ProductType ProductType