Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
CalypsoCardSelectionAdapter.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 <memory>
17#include <string>
18#include <vector>
19
20/* Calypsonet Terminal Calypso */
21#include "CalypsoCardSelection.h"
22
23/* Calypsonet Terminal Card */
24#include "CardSelectorSpi.h"
25#include "CardSelectionSpi.h"
26
27/* Keyple Card Calypso */
28#include "AbstractCardCommand.h"
29#include "CardSelectorAdapter.h"
31
32namespace keyple {
33namespace card {
34namespace calypso {
35
36using namespace calypsonet::terminal::calypso::card;
37using namespace calypsonet::terminal::card::spi;
38
46: public CalypsoCardSelection, public CardSelectionSpi {
47public:
56
62 CalypsoCardSelection& filterByCardProtocol(const std::string& cardProtocol) override;
63
69 CalypsoCardSelection& filterByPowerOnData(const std::string& powerOnDataRegex) override;
70
76 CalypsoCardSelection& filterByDfName(const std::vector<uint8_t>& aid) override;
77
83 CalypsoCardSelection& filterByDfName(const std::string& aid) override;
84
90 CalypsoCardSelection& setFileOccurrence(const FileOccurrence fileOccurrence) override;
91
97 CalypsoCardSelection& setFileControlInformation(
98 const FileControlInformation fileControlInformation) override;
99
106 CalypsoCardSelection& addSuccessfulStatusWord(const int statusWord) override;
107
113 CalypsoCardSelection& acceptInvalidatedCard() override;
114
121 CalypsoCardSelection& prepareReadRecordFile(const uint8_t sfi, const uint8_t recordNumber)
122 override;
123
129 CalypsoCardSelection& prepareReadRecord(const uint8_t sfi, const uint8_t recordNumber) override;
130
136 CalypsoCardSelection& prepareGetData(const GetDataTag tag) override;
137
144 CalypsoCardSelection& prepareSelectFile(const std::vector<uint8_t>& lid) override;
145
151 CalypsoCardSelection& prepareSelectFile(const uint16_t lid) override;
152
158 CalypsoCardSelection& prepareSelectFile(const SelectFileControl selectControl) override;
159
165 const std::shared_ptr<CardSelectionRequestSpi> getCardSelectionRequest() override;
166
172 const std::shared_ptr<SmartCardSpi> parse(
173 const std::shared_ptr<CardSelectionResponseApi> cardSelectionResponse) override;
174
175private:
179 static const int AID_MIN_LENGTH;
180 static const int AID_MAX_LENGTH;
181 static const int SW_CARD_INVALIDATED;
182 static const std::string MSG_CARD_COMMAND_ERROR;
183
184
189 std::vector<std::shared_ptr<AbstractApduCommand>> mCommands;
190
194 std::shared_ptr<CardSelectorAdapter> mCardSelector;
195
206 void parseApduResponses(const std::shared_ptr<CalypsoCardAdapter> calypsoCard,
207 const std::vector<std::shared_ptr<AbstractApduCommand>>& commands,
208 const std::vector<std::shared_ptr<ApduResponseApi>>& apduResponses);
209};
210
211}
212}
213}
#define KEYPLECARDCALYPSO_API
CardSelectorSpi::FileOccurrence FileOccurrence
CardSelectorSpi::FileControlInformation FileControlInformation