Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
CalypsoSamSelectionAdapter.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2021 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 <memory>
16#include <string>
17#include <vector>
18
19/* Calypsonet Terminal Calypso */
20#include "CalypsoSam.h"
21#include "CalypsoSamSelection.h"
22
23/* Calypsonet Terminal Card */
24#include "CardSelectionSpi.h"
25
26/* Keyple Card Calypso */
27#include "AbstractSamCommand.h"
28#include "CardSelectorAdapter.h"
29
30
31namespace keyple {
32namespace card {
33namespace calypso {
34
35using namespace calypsonet::terminal::calypso::sam;
36using namespace calypsonet::terminal::card::spi;
37
46class CalypsoSamSelectionAdapter : public CalypsoSamSelection, public CardSelectionSpi {
47public:
55
61 const std::shared_ptr<CardSelectionRequestSpi> getCardSelectionRequest() override;
62
68 const std::shared_ptr<SmartCardSpi> parse(
69 const std::shared_ptr<CardSelectionResponseApi> cardSelectionResponse) override;
70
76 CalypsoSamSelection& filterByProductType(const CalypsoSam::ProductType productType) override;
77
83 CalypsoSamSelection& filterBySerialNumber(const std::string& serialNumberRegex) override;
84
90 CalypsoSamSelection& setUnlockData(const std::string& unlockData) override;
91
92private:
96 const std::shared_ptr<CardSelectorAdapter> mSamCardSelector;
97
101 std::vector<std::shared_ptr<AbstractSamCommand>> mSamCommands;
102
106 CalypsoSam::ProductType mProductType;
107
111 std::string mSerialNumberRegex;
112
116 std::string mUnlockData;
117
127 const std::string buildAtrRegex(const CalypsoSam::ProductType productType,
128 const std::string& samSerialNumberRegex);
129};
130
131}
132}
133}
CalypsoSamSelection & setUnlockData(const std::string &unlockData) override
CalypsoSamSelection & filterByProductType(const CalypsoSam::ProductType productType) override
const std::shared_ptr< SmartCardSpi > parse(const std::shared_ptr< CardSelectionResponseApi > cardSelectionResponse) override
const std::shared_ptr< CardSelectionRequestSpi > getCardSelectionRequest() override
CalypsoSamSelection & filterBySerialNumber(const std::string &serialNumberRegex) override
CalypsoSam::ProductType ProductType