Keyple Card Generic C++ Library - 3.1.2
Component of the Keyple C++ middleware
GenericExtensionService.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/GenericExtensionService.hpp"
15
16#include "keyple/card/generic/CardTransactionManagerAdapter.hpp"
17#include "keyple/card/generic/GenericCardResourceProfileExtensionAdapter.hpp"
18#include "keyple/card/generic/GenericCardSelectionExtensionAdapter.hpp"
19#include "keyple/core/common/CommonApiProperties.hpp"
20#include "keypop/card/CardApiProperties.hpp"
21#include "keypop/reader/ReaderApiProperties.hpp"
22
23namespace keyple {
24namespace card {
25namespace generic {
26
27using keyple::core::common::CommonApiProperties_VERSION;
28using keypop::card::CardApiProperties_VERSION;
29using keypop::reader::ReaderApiProperties_VERSION;
30
31std::shared_ptr<GenericExtensionService> GenericExtensionService::mInstance;
32
33GenericExtensionService::GenericExtensionService()
34{
35}
36
37std::shared_ptr<GenericExtensionService>
38GenericExtensionService::getInstance()
39{
40 if (mInstance == nullptr) {
41 mInstance = std::shared_ptr<GenericExtensionService>(
42 new GenericExtensionService());
43 }
44
45 return mInstance;
46}
47
48std::shared_ptr<GenericCardSelectionExtension>
49GenericExtensionService::createGenericCardSelectionExtension()
50{
51 return std::make_shared<GenericCardSelectionExtensionAdapter>();
52}
53
54std::shared_ptr<CardTransactionManager>
55GenericExtensionService::createCardTransaction(
56 std::shared_ptr<CardReader> reader, std::shared_ptr<SmartCard> card)
57{
58 return std::make_shared<CardTransactionManagerAdapter>(reader, card);
59}
60
61std::shared_ptr<CardResourceProfileExtension>
62GenericExtensionService::createCardResourceProfileExtension(
63 const std::shared_ptr<IsoCardSelector> cardSelector,
64 const std::shared_ptr<GenericCardSelectionExtension>
65 genericCardSelectionExtension)
66{
67 return std::make_shared<GenericCardResourceProfileExtensionAdapter>(
68 cardSelector, genericCardSelectionExtension);
69}
70
71const std::string
72GenericExtensionService::getCardApiVersion() const
73{
74 return CardApiProperties_VERSION;
75}
76
77const std::string
78GenericExtensionService::getReaderApiVersion() const
79{
80 return ReaderApiProperties_VERSION;
81}
82
83const std::string
84GenericExtensionService::getCommonApiVersion() const
85{
86 return CommonApiProperties_VERSION;
87}
88
89} /* namespace generic */
90} /* namespace card */
91} /* namespace keyple */