Keyple Card Generic C++ Library - 3.1.2
Component of the Keyple C++ middleware
GenericCardSelectionExtensionAdapter.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/card/generic/GenericCardSelectionExtensionAdapter.hpp"
15
16#include <memory>
17
18#include "keyple/card/generic/GenericCardAdapter.hpp"
19#include "keyple/card/generic/GenericCardSelectionRequestAdapter.hpp"
20
21namespace keyple {
22namespace card {
23namespace generic {
24
25const int GenericCardSelectionExtensionAdapter::DEFAULT_SUCCESSFUL_CODE
26 = 0x9000;
27
28GenericCardSelectionExtensionAdapter::GenericCardSelectionExtensionAdapter()
29: mSuccessfulSelectionStatusWords({0x9000})
30{
31}
32
33std::unique_ptr<CardSelectionRequestSpi>
34GenericCardSelectionExtensionAdapter::getCardSelectionRequest()
35{
36 return std::unique_ptr<GenericCardSelectionRequestAdapter>(
37 new GenericCardSelectionRequestAdapter(
38 mSuccessfulSelectionStatusWords));
39}
40
41std::shared_ptr<SmartCardSpi>
42GenericCardSelectionExtensionAdapter::parse(
43 const std::shared_ptr<CardSelectionResponseApi>& cardSelectionResponse)
44{
45 return std::make_shared<GenericCardAdapter>(cardSelectionResponse);
46}
47
48GenericCardSelectionExtension&
49GenericCardSelectionExtensionAdapter::addSuccessfulStatusWord(
50 const int statusWord)
51{
52 mSuccessfulSelectionStatusWords.push_back(statusWord);
53
54 return *this;
55}
56
57} /* namespace generic */
58} /* namespace card */
59} /* namespace keyple */