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