Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CalypsoSamAdapter.h
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#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 override;
105
111 const std::string getProductInfo() const override;
112
118 const std::vector<uint8_t>& getSerialNumber() const override;
119
125 uint8_t getPlatform() const override;
126
132 uint8_t getApplicationType() const override;
133
139 uint8_t getApplicationSubType() const override;
140
146 uint8_t getSoftwareIssuer() const override;
147
153 uint8_t getSoftwareVersion() const override;
154
160 uint8_t getSoftwareRevision() const override;
161
170 void putEventCounter(const int eventCounterNumber, const int eventCounterValue);
171
180 void putEventCeiling(const int eventCeilingNumber, const int eventCeilingValue);
181
182 // /**
183 // * {@inheritDoc}
184 // *
185 // * @since 2.2.3
186 // */
187 // std::shared_ptr<int> getEventCounter(const int eventCounterNumber) const; // override;
188
189 // /**
190 // * {@inheritDoc}
191 // *
192 // * @since 2.2.3
193 // */
194 // const std::map<int, int>& getEventCounters() const; // override;
195
196 // /**
197 // * {@inheritDoc}
198 // *
199 // * @since 2.2.3
200 // */
201 // std::shared_ptr<int> getEventCeiling(const int eventCeilingNumber) const; // override;
202
203 // /**
204 // * {@inheritDoc}
205 // *
206 // * @since 2.2.3
207 // */
208 // const std::map<int, int>& getEventCeilings() const; // override;
209
210private:
214 const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(CalypsoSamAdapter));
215
219 std::string mPowerOnData;
220
224 CalypsoSam::ProductType mSamProductType;
225
229 std::vector<uint8_t> mSerialNumber;
230
234 uint8_t mPlatform;
235
239 uint8_t mApplicationType;
240
244 uint8_t mApplicationSubType;
245
249 uint8_t mSoftwareIssuer;
250
254 uint8_t mSoftwareVersion;
255
259 uint8_t mSoftwareRevision;
260
264 std::map<int, int> mEventCounters;
265
269 std::map<int, int> mEventCeilings;
270};
271
272}
273}
274}
#define KEYPLECARDCALYPSO_API
CalypsoSam::ProductType ProductType