Keyple Card Calypso C++ Library 2.1.0
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
138 AbstractApduCommand(const CardCommand& commandRef);
139
151 virtual void addSubName(const std::string& subName) final;
152
160 virtual const CardCommand& getCommandRef() const;
161
169 virtual const std::string& getName() const final;
170
178 virtual void setApduRequest(const std::shared_ptr<ApduRequestAdapter> apduRequest) final;
179
187 virtual const std::shared_ptr<ApduRequestAdapter> getApduRequest() const final;
188
198 const std::shared_ptr<ApduResponseApi> apduResponse);
199
207 virtual const std::shared_ptr<ApduResponseApi> getApduResponse() const final;
208
216 virtual const std::map<const int, const std::shared_ptr<StatusProperties>>& getStatusTable()
217 const;
218
233 const std::type_info& exceptionClass,
234 const std::string& message,
235 const CardCommand& commandRef,
236 const int statusWord) const;
237
246 virtual bool isSuccessful() const final;
247
256 virtual void checkStatus();
257
265 virtual const std::string getStatusInformation() const final;
266
267private:
271 const CardCommand& mCommandRef;
272
276 std::string mName;
277
281 std::shared_ptr<ApduRequestAdapter> mApduRequest;
282
286 std::shared_ptr<ApduResponseApi> mApduResponse;
287
294 virtual const std::shared_ptr<StatusProperties> getStatusWordProperties() const;
295};
296
297}
298}
299}
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
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 buildCommandException(const std::type_info &exceptionClass, const std::string &message, const CardCommand &commandRef, const int statusWord) const
AbstractApduCommand(const CardCommand &commandRef)