Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
CalypsoSamAdapter.h
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#pragma once
14
15#include <memory>
16
17/* Calypsonet Terminal Calypso */
18#include "CalypsoSam.h"
19
20/* Calypsonet Terminal Card */
21#include "CardSelectionResponseApi.h"
22#include "SmartCardSpi.h"
23
24/* Keyple Card Calypso */
26
27/* Keyple Core Util */
28#include "LoggerFactory.h"
29
30namespace keyple {
31namespace card {
32namespace calypso {
33
34using namespace calypsonet::terminal::calypso::sam;
35using namespace calypsonet::terminal::card;
36using namespace calypsonet::terminal::card::spi;
37using namespace keyple::core::util::cpp;
38
45class KEYPLECARDCALYPSO_API CalypsoSamAdapter final : public CalypsoSam, public SmartCardSpi {
46public:
55 CalypsoSamAdapter(const std::shared_ptr<CardSelectionResponseApi> cardSelectionResponse);
56
64 static uint8_t getClassByte(const CalypsoSam::ProductType type);
65
73 uint8_t getClassByte() const;
74
82 int getMaxDigestDataLength() const;
83
90 const std::vector<uint8_t> getSelectApplicationResponse() const override;
91
97 const std::string& getPowerOnData() const override;
98
104 CalypsoSam::ProductType getProductType() const final;
105
111 const std::string getProductInfo() const override;
112
118 const std::vector<uint8_t>& getSerialNumber() const final;
119
125 uint8_t getPlatform() const final;
126
132 uint8_t getApplicationType() const final;
133
139 uint8_t getApplicationSubType() const final;
140
146 uint8_t getSoftwareIssuer() const final;
147
153 uint8_t getSoftwareVersion() const final;
154
160 uint8_t getSoftwareRevision() const final;
161
162private:
166 const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(CalypsoSamAdapter));
167
171 std::string mPowerOnData;
172
176 CalypsoSam::ProductType mSamProductType;
177
181 std::vector<uint8_t> mSerialNumber;
182
186 uint8_t mPlatform;
187
191 uint8_t mApplicationType;
192
196 uint8_t mApplicationSubType;
197
201 uint8_t mSoftwareIssuer;
202
206 uint8_t mSoftwareVersion;
207
211 uint8_t mSoftwareRevision;
212};
213
214}
215}
216}
#define KEYPLECARDCALYPSO_API
CalypsoSam::ProductType ProductType