Skip to content

Commit 8f371e9

Browse files
Merge pull request #5 from eclipse/develop-2.1.0
keyple-service-cpp-lib 2.1.0
2 parents 2a6a77d + 0e5fb8c commit 8f371e9

42 files changed

Lines changed: 636 additions & 281 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *************************************************************************************************
2-
# Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
# Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
# *
44
# See the NOTICE file(s) distributed with this work for additional information regarding *
55
# copyright ownership. *
@@ -14,8 +14,8 @@ PROJECT(KeypleServiceCppLib C CXX)
1414
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
1515

1616
SET(CMAKE_PROJECT_VERSION_MAJOR "2")
17-
SET(CMAKE_PROJECT_VERSION_MINOR "0")
18-
SET(CMAKE_PROJECT_VERSION_PATCH "1")
17+
SET(CMAKE_PROJECT_VERSION_MINOR "1")
18+
SET(CMAKE_PROJECT_VERSION_PATCH "0")
1919

2020
SET(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.
2121
${CMAKE_PROJECT_VERSION_MINOR}.

src/main/AbstractPluginAdapter.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -37,10 +37,10 @@ std::shared_ptr<LocalReaderAdapter> AbstractPluginAdapter::buildLocalReaderAdapt
3737

3838
const auto& observable = std::dynamic_pointer_cast<ObservableReaderSpi>(readerSpi);
3939
const auto& configurable = std::dynamic_pointer_cast<ConfigurableReaderSpi>(readerSpi);
40-
40+
4141
if (observable) {
4242
if (configurable) {
43-
adapter =
43+
adapter =
4444
std::make_shared<ObservableLocalConfigurableReaderAdapter>(configurable, getName());
4545
} else {
4646
adapter = std::make_shared<ObservableLocalReaderAdapter>(observable, getName());
@@ -71,17 +71,17 @@ void AbstractPluginAdapter::doRegister()
7171
void AbstractPluginAdapter::doUnregister()
7272
{
7373
mIsRegistered = false;
74-
74+
7575
for (const auto& pair : mReaders) {
7676
try {
7777
std::dynamic_pointer_cast<AbstractReaderAdapter>(pair.second)->doUnregister();
7878
} catch (const Exception& e) {
79-
mLogger->error("Error during the unregistration of reader '%'\n",
80-
pair.second->getName(),
79+
mLogger->error("Error during the unregistration of reader '%'\n",
80+
pair.second->getName(),
8181
e);
8282
}
8383
}
84-
84+
8585
mReaders.clear();
8686
mIsRegistered = false;
8787
}
@@ -101,6 +101,19 @@ std::shared_ptr<KeyplePluginExtension> AbstractPluginAdapter::getExtension(
101101
return mPluginExtension;
102102
}
103103

104+
std::shared_ptr<KeypleReaderExtension> AbstractPluginAdapter::getReaderExtension(
105+
const std::type_info& readerExtensionClass, const std::string& readerName) const
106+
{
107+
checkStatus();
108+
109+
const auto reader = std::dynamic_pointer_cast<AbstractReaderAdapter>(getReader(readerName));
110+
if (reader == nullptr) {
111+
throw IllegalArgumentException("Reader '" + readerName + "'not found!");
112+
}
113+
114+
return reader->getExtension(readerExtensionClass);
115+
}
116+
104117
std::map<const std::string, std::shared_ptr<Reader>>& AbstractPluginAdapter::getReadersMap()
105118
{
106119
return mReaders;

src/main/AbstractPluginAdapter.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -55,7 +55,7 @@ class KEYPLESERVICE_API AbstractPluginAdapter : virtual public Plugin {
5555
std::shared_ptr<KeyplePluginExtension> pluginExtension);
5656

5757
/**
58-
*
58+
*
5959
*/
6060
virtual ~AbstractPluginAdapter() = default;
6161

@@ -107,9 +107,17 @@ class KEYPLESERVICE_API AbstractPluginAdapter : virtual public Plugin {
107107
*
108108
* @since 2.0.0
109109
*/
110-
std::shared_ptr<KeyplePluginExtension> getExtension(const std::type_info& pluginExtensionClass)
110+
std::shared_ptr<KeyplePluginExtension> getExtension(const std::type_info& pluginExtensionClass)
111111
const final;
112112

113+
/**
114+
* {@inheritDoc}
115+
*
116+
* @since 2.1.0
117+
*/
118+
std::shared_ptr<KeypleReaderExtension> getReaderExtension(
119+
const std::type_info& readerExtensionClass, const std::string& readerName) const final;
120+
113121
/**
114122
* (package-private)<br>
115123
* Gets the Map of all connected readers.
@@ -141,10 +149,10 @@ class KEYPLESERVICE_API AbstractPluginAdapter : virtual public Plugin {
141149

142150
private:
143151
/**
144-
*
152+
*
145153
*/
146154
const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(AbstractPluginAdapter));
147-
155+
148156
/**
149157
*
150158
*/

src/main/AbstractReaderAdapter.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -86,7 +86,7 @@ class KEYPLESERVICE_API AbstractReaderAdapter : virtual public Reader, public Pr
8686
* defined by MultiSelectionProcessing}.<br>
8787
* At the end of the treatment of each case, the channel is left open or is closed according to
8888
* the channel control policy.
89-
*
89+
*
9090
* C++: method should be final but cannot perform UTs if so...
9191
*
9292
* @param cardSelectionRequests A list of selection cases composed of one or more {@link
@@ -98,7 +98,7 @@ class KEYPLESERVICE_API AbstractReaderAdapter : virtual public Reader, public Pr
9898
* @throw CardBrokenCommunicationException if the communication with the card has failed.
9999
* @since 2.0.0
100100
*/
101-
virtual const std::vector<std::shared_ptr<CardSelectionResponseApi>>
101+
virtual const std::vector<std::shared_ptr<CardSelectionResponseApi>>
102102
transmitCardSelectionRequests(
103103
const std::vector<std::shared_ptr<CardSelectionRequestSpi>>& cardSelectionRequests,
104104
const MultiSelectionProcessing multiSelectionProcessing,
@@ -181,8 +181,8 @@ class KEYPLESERVICE_API AbstractReaderAdapter : virtual public Reader, public Pr
181181
*
182182
* @since 2.0.0
183183
*/
184-
virtual std::shared_ptr<KeypleReaderExtension> getExtension(
185-
const std::type_info& readerExtensionClass) const override final;
184+
std::shared_ptr<KeypleReaderExtension> getExtension(
185+
const std::type_info& readerExtensionClass) const final;
186186

187187
/**
188188
* {@inheritDoc}

src/main/ApduRequestAdapter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -38,7 +38,7 @@ ApduRequestAdapter& ApduRequestAdapter::setInfo(const std::string& info)
3838
return *this;
3939
}
4040

41-
const std::vector<uint8_t>& ApduRequestAdapter::getApdu() const
41+
std::vector<uint8_t>& ApduRequestAdapter::getApdu()
4242
{
4343
return mApdu;
4444
}

src/main/ApduRequestAdapter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -68,7 +68,7 @@ class ApduRequestAdapter final : public ApduRequestSpi {
6868
ApduRequestAdapter& setInfo(const std::string& info);
6969

7070
/**
71-
*
71+
*
7272
*/
7373
virtual ~ApduRequestAdapter() = default;
7474

@@ -77,7 +77,7 @@ class ApduRequestAdapter final : public ApduRequestSpi {
7777
*
7878
* @since 2.0.0
7979
*/
80-
virtual const std::vector<uint8_t>& getApdu() const override;
80+
virtual std::vector<uint8_t>& getApdu() override;
8181

8282
/**
8383
* {@inheritDoc}
@@ -113,7 +113,7 @@ class ApduRequestAdapter final : public ApduRequestSpi {
113113
/**
114114
*
115115
*/
116-
const std::vector<uint8_t> mApdu;
116+
std::vector<uint8_t> mApdu;
117117

118118
/**
119119
*

src/main/ApduResponseAdapter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -47,7 +47,7 @@ class KEYPLESERVICE_API ApduResponseAdapter final : public ApduResponseApi {
4747
ApduResponseAdapter(const std::vector<uint8_t>& apdu);
4848

4949
/**
50-
*
50+
*
5151
*/
5252
virtual ~ApduResponseAdapter() = default;
5353

src/main/AutonomousObservableLocalPluginAdapter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -12,6 +12,9 @@
1212

1313
#include "AutonomousObservableLocalPluginAdapter.h"
1414

15+
/* Calypsonet Terminal Reader */
16+
#include "CardReader.h"
17+
1518
/* Keyple Core Util */
1619
#include "KeypleAssert.h"
1720

@@ -26,6 +29,7 @@ namespace keyple {
2629
namespace core {
2730
namespace service {
2831

32+
using namespace calypsonet::terminal::reader;
2933
using namespace keyple::core::plugin;
3034
using namespace keyple::core::plugin::spi::reader::observable;
3135
using namespace keyple::core::util::cpp;
@@ -62,7 +66,7 @@ void AutonomousObservableLocalPluginAdapter::onReaderDisconnected(
6266
std::vector<std::string> notifyReaders;
6367

6468
for (const auto& readerName : readerNames) {
65-
const std::shared_ptr<Reader> reader = getReader(readerName);
69+
const std::shared_ptr<CardReader> reader = getReader(readerName);
6670
if (reader == nullptr) {
6771
mLogger->warn("[%] ObservableLocalPlugin => Impossible to remove reader, reader not " \
6872
"found with name : %\n",

src/main/CMakeLists.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,26 @@ ADD_LIBRARY(
6161
)
6262

6363
TARGET_INCLUDE_DIRECTORIES(
64-
${LIBRARY_NAME}
65-
PUBLIC
64+
${LIBRARY_NAME}
65+
66+
PUBLIC
67+
6668
${CMAKE_CURRENT_SOURCE_DIR}
6769
${CMAKE_CURRENT_SOURCE_DIR}/cpp
6870
${CMAKE_CURRENT_SOURCE_DIR}/spi
6971
)
7072

7173
TARGET_LINK_LIBRARIES(
72-
${LIBRARY_NAME}
73-
PUBLIC
74-
CalypsoNet::TerminalCard
75-
CalypsoNet::TerminalReader
76-
Keyple::CommonApi
77-
Keyple::PluginApi
78-
Keyple::Util
79-
Threads::Threads)
74+
${LIBRARY_NAME}
75+
76+
PUBLIC
77+
78+
CalypsoNet::TerminalCard
79+
CalypsoNet::TerminalReader
80+
Keyple::CommonApi
81+
Keyple::PluginApi
82+
Keyple::Util
83+
Threads::Threads
84+
)
8085

8186
ADD_LIBRARY(Keyple::Service ALIAS ${LIBRARY_NAME})

src/main/CardInsertionActiveMonitoringJobAdapter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
2+
* Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
33
* *
44
* See the NOTICE file(s) distributed with this work for additional information regarding *
55
* copyright ownership. *
@@ -32,7 +32,7 @@ using namespace keyple::core::util::cpp;
3232

3333
/**
3434
* (package-private)<br>
35-
* This monitoring job polls the Reader#isCardPresent() method to detect a card insertion or
35+
* This monitoring job polls the CardReader::isCardPresent() method to detect a card insertion or
3636
* a card removal.
3737
*
3838
* <p>All runtime exceptions that may occur during the monitoring process are caught and notified at

0 commit comments

Comments
 (0)