Keyple Service C++ Library - 3.4.1
Component of the Keyple C++ middleware
BasicCardSelectorAdapter.cpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional *
5 * information regarding copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the *
8 * terms of the Eclipse Public License 2.0 which is available at *
9 * http://www.eclipse.org/legal/epl-2.0 *
10 * *
11 * SPDX-License-Identifier: EPL-2.0 *
12 ******************************************************************************/
13
14#include "keyple/core/service/BasicCardSelectorAdapter.hpp"
15
16#include <memory>
17#include <sstream>
18#include <string>
19
20namespace keyple {
21namespace core {
22namespace service {
23
24const std::string&
25BasicCardSelectorAdapter::getLogicalProtocolName() const
26{
27 return mLogicalProtocolName;
28}
29
30const std::string&
31BasicCardSelectorAdapter::getPowerOnDataRegex() const
32{
33 return mPowerOnDataRegex;
34}
35
36BasicCardSelector&
37BasicCardSelectorAdapter::filterByCardProtocol(
38 const std::string& logicalProtocolName)
39{
40 mLogicalProtocolName = logicalProtocolName;
41
42 return *this;
43}
44
45BasicCardSelector&
46BasicCardSelectorAdapter::filterByPowerOnData(
47 const std::string& powerOnDataRegex)
48{
49 mPowerOnDataRegex = powerOnDataRegex;
50
51 return *this;
52}
53
54std::ostream&
55operator<<(std::ostream& os, const BasicCardSelectorAdapter& bcsa)
56{
57 os << "BASIC_CARD_SELECTOR_ADAPTER: {"
58 << "LOGICAL_PROTOCOL_NAME: " << bcsa.mLogicalProtocolName << ", "
59 << "POWER_ON_DATA_REGEX: " << bcsa.mPowerOnDataRegex << "}";
60
61 return os;
62}
63
67std::ostream&
69 std::ostream& os, const std::shared_ptr<BasicCardSelectorAdapter> bcsa)
70{
71 if (bcsa == nullptr) {
72 os << "BASIC_CARD_SELECTOR_ADAPTER: null";
73 } else {
74 os << *bcsa;
75 }
76
77 return os;
78}
79} /* namespace service */
80} /* namespace core */
81} /* namespace keyple */
std::ostream & operator<<(std::ostream &os, const ApduResponseAdapter &ara)