Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CmdCardReadRecords.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 <cstdint>
16#include <map>
17#include <memory>
18#include <vector>
19
20/* Keyple Card Calypso */
21#include "AbstractApduCommand.h"
22#include "AbstractCardCommand.h"
23#include "CalypsoCardAdapter.h"
24#include "CalypsoCardClass.h"
25#include "CalypsoCardCommand.h"
26
27/* Keyple Core Util */
28#include "LoggerFactory.h"
29
30namespace keyple {
31namespace card {
32namespace calypso {
33
34using namespace keyple::core::util::cpp;
35
37
45public:
52 enum class ReadMode {
57
62 };
63
76 CmdCardReadRecords(const std::shared_ptr<CalypsoCardAdapter> calypsoCard,
77 const int sfi,
78 const int firstRecordNumber,
79 const ReadMode readMode,
80 const int expectedLength);
81
94 CmdCardReadRecords(const CalypsoCardClass calypsoCardClass,
95 const uint8_t sfi,
96 const uint8_t firstRecordNumber,
97 const ReadMode readMode,
98 const int expectedLength);
99
106 bool isSessionBufferUsed() const override;
107
113 const std::map<const int, const std::shared_ptr<StatusProperties>>& getStatusTable() const
114 override;
115
121 void parseApduResponse(const std::shared_ptr<ApduResponseApi> apduResponse) override;
122
129 uint8_t getSfi() const;
130
137 uint8_t getFirstRecordNumber() const;
138
145 int getRecordSize() const;
146
153 ReadMode getReadMode() const;
154
162 const std::map<const uint8_t, const std::vector<uint8_t>>& getRecords() const;
163
167 friend std::ostream& operator<<(std::ostream& os, const ReadMode rm);
168
169private:
173 const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(CmdCardReadRecords));
174
178 static const CalypsoCardCommand mCommand;
179
183 int mSfi = 0;
184
188 int mRecordSize = 0;
189
193 int mFirstRecordNumber = 0;
194
195
199 ReadMode mReadMode = ReadMode::ONE_RECORD;
200
204 static const std::map<const int, const std::shared_ptr<StatusProperties>> STATUS_TABLE;
205
209 static const std::map<const int, const std::shared_ptr<StatusProperties>> initStatusTable();
210
222 void buildCommand(const CalypsoCardClass calypsoCardClass,
223 const int sfi,
224 const int firstRecordNumber,
225 const ReadMode readMode,
226 const int expectedLength);
227
228};
229
230}
231}
232}
friend std::ostream & operator<<(std::ostream &os, const ReadMode rm)
CmdCardReadRecords(const std::shared_ptr< CalypsoCardAdapter > calypsoCard, const int sfi, const int firstRecordNumber, const ReadMode readMode, const int expectedLength)
const std::map< const uint8_t, const std::vector< uint8_t > > & getRecords() const
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
void parseApduResponse(const std::shared_ptr< ApduResponseApi > apduResponse) override
AbstractApduCommand::StatusProperties StatusProperties