Keyple Card Calypso C++ Library 2.2.2
Reference Terminal Reader API for C++
AbstractApduCommand.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2022 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 le);
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
179 virtual void setApduRequest(const std::shared_ptr<ApduRequestAdapter> apduRequest) final;
180
188 virtual const std::shared_ptr<ApduRequestAdapter> getApduRequest() const final;
189
199 const std::shared_ptr<ApduResponseApi> apduResponse);
200
208 virtual const std::shared_ptr<ApduResponseApi> getApduResponse() const final;
209
217 virtual const std::map<const int, const std::shared_ptr<StatusProperties>>& getStatusTable()
218 const;
219
230 const std::type_info& exceptionClass, const std::string& message) const = 0;
231
241 const std::string& message) const = 0;
242
251 virtual bool isSuccessful() const final;
252
263 virtual void checkStatus();
264
272 virtual const std::string getStatusInformation() const final;
273
274private:
278 const CardCommand& mCommandRef;
279
283 const int mLe;
284
288 std::string mName;
289
293 std::shared_ptr<ApduRequestAdapter> mApduRequest;
294
298 std::shared_ptr<ApduResponseApi> mApduResponse;
299
306 virtual const std::shared_ptr<StatusProperties> getStatusWordProperties() const;
307};
308
309}
310}
311}
virtual const std::string & getName() const final
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
virtual AbstractApduCommand & setApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse)
virtual void addSubName(const std::string &subName) final
AbstractApduCommand(const CardCommand &commandRef, const int le)
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
virtual const CalypsoApduCommandException buildCommandException(const std::type_info &exceptionClass, const std::string &message) const =0