Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
AbstractApduCommand.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 <map>
16#include <memory>
17#include <string>
18
19/* Keyple Card Calypso */
20#include "ApduRequestAdapter.h"
22#include "CardCommand.h"
23
24/* Calypsonet Terminal Card */
25#include "ApduResponseApi.h"
26
27namespace keyple {
28namespace card {
29namespace calypso {
30
31using namespace calypsonet::terminal::card;
32
49public:
57 public:
65 StatusProperties(const std::string& information);
66
76 StatusProperties(const std::string& information, const std::type_info& exceptionClass);
77
85 const std::string& getInformation() const;
86
94 bool isSuccessful() const;
95
103 const std::type_info& getExceptionClass() const;
104
105 private:
109 const std::string mInformation;
110
114 const bool mSuccessful;
115
119 const std::type_info& mExceptionClass;
120 };
121
129 static const std::map<const int, const std::shared_ptr<StatusProperties>> STATUS_TABLE;
130
139 AbstractApduCommand(const CardCommand& commandRef, const int expectedResponseLength);
140
152 virtual void addSubName(const std::string& subName) final;
153
161 virtual const CardCommand& getCommandRef() const;
162
170 virtual const std::string& getName() const final;
171
177 virtual void setExpectedResponseLength(const int expectedResponseLength) final;
178
186 virtual void setApduRequest(const std::shared_ptr<ApduRequestAdapter> apduRequest) final;
187
195 virtual const std::shared_ptr<ApduRequestAdapter> getApduRequest() const final;
196
206 virtual void parseApduResponse(
207 const std::shared_ptr<ApduResponseApi> apduResponse);
208
216 virtual const std::shared_ptr<ApduResponseApi> getApduResponse() const final;
217
225 virtual const std::map<const int, const std::shared_ptr<StatusProperties>>& getStatusTable()
226 const;
227
238 const std::type_info& exceptionClass, const std::string& message) const = 0;
239
249 const std::string& message) const = 0;
250
259 virtual bool isSuccessful() const final;
260
268 virtual const std::string getStatusInformation() const final;
269
270private:
274 const CardCommand& mCommandRef;
275
279 int mExpectedResponseLength;
280
284 std::string mName;
285
289 std::shared_ptr<ApduRequestAdapter> mApduRequest;
290
294 std::shared_ptr<ApduResponseApi> mApduResponse;
295
302 virtual const std::shared_ptr<StatusProperties> getStatusWordProperties() const;
303
313 virtual void checkStatus();
314};
315
316}
317}
318}
virtual const std::string & getName() const final
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual void addSubName(const std::string &subName) final
virtual const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const
virtual const std::string getStatusInformation() const final
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual const std::shared_ptr< ApduRequestAdapter > getApduRequest() const final
virtual const CardCommand & getCommandRef() const
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
virtual const CalypsoApduCommandException buildUnexpectedResponseLengthException(const std::string &message) const =0
AbstractApduCommand(const CardCommand &commandRef, const int expectedResponseLength)
virtual void setExpectedResponseLength(const int expectedResponseLength) final
virtual const CalypsoApduCommandException buildCommandException(const std::type_info &exceptionClass, const std::string &message) const =0
virtual void parseApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse)