Keyple Service C++ Library - 3.3.5
Component of the Keyple C++ middleware
CardSelectionResponseAdapter.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/CardSelectionResponseAdapter.hpp"
15
16#include <memory>
17#include <string>
18
19namespace keyple {
20namespace core {
21namespace service {
22
23CardSelectionResponseAdapter::CardSelectionResponseAdapter(
24 const std::string& powerOnData,
25 const std::shared_ptr<ApduResponseAdapter> selectApplicationResponse,
26 const bool hasMatched,
27 const std::shared_ptr<CardResponseAdapter> cardResponse)
28: mPowerOnData(powerOnData)
29, mSelectApplicationResponse(selectApplicationResponse)
30, mHasMatched(hasMatched)
31, mCardResponse(cardResponse)
32{
33}
34
35const std::string&
36CardSelectionResponseAdapter::getPowerOnData() const
37{
38 /* RL-ATR-IDENTIFY.1 */
39 return mPowerOnData;
40}
41
42const std::shared_ptr<ApduResponseApi>
43CardSelectionResponseAdapter::getSelectApplicationResponse() const
44{
45 return mSelectApplicationResponse;
46}
47
48bool
49CardSelectionResponseAdapter::hasMatched() const
50{
51 return mHasMatched;
52}
53
54const std::shared_ptr<CardResponseApi>
55CardSelectionResponseAdapter::getCardResponse() const
56{
57 return mCardResponse;
58}
59
60std::ostream&
61operator<<(std::ostream& os, const CardSelectionResponseAdapter& csra)
62{
63 os << "CARD_SELECTION_RESPONSE_ADAPTER: {"
64 << "HAS_MATCHED = " << csra.mHasMatched << ", "
65 << "POWER_ON_DATA = " << csra.mPowerOnData << ", "
66 << "SELECT_APPLICATION_RESPONSE = <TODO>, "
67 << "CARD_RESPONSE = <TODO>"
68 << "}";
69
70 return os;
71}
72
73std::ostream&
75 std::ostream& os, const std::shared_ptr<CardSelectionResponseAdapter> csra)
76{
77 os << *csra.get();
78
79 return os;
80}
81
82} /* namespace service */
83} /* namespace core */
84} /* namespace keyple */
std::ostream & operator<<(std::ostream &os, const std::shared_ptr< CardSelectionResponseAdapter > csra)