|
24 | 24 | #include "keyple/core/service/CardResponseAdapter.hpp" |
25 | 25 | #include "keyple/core/service/InternalIsoCardSelector.hpp" |
26 | 26 | #include "keyple/core/service/KeypleServiceExport.hpp" |
| 27 | +#include "keyple/core/util/cpp/KeypleStd.hpp" |
27 | 28 | #include "keypop/card/spi/ApduRequestSpi.hpp" |
28 | 29 | #include "keypop/card/spi/CardSelectionRequestSpi.hpp" |
29 | 30 | #include "keypop/reader/selection/CardSelector.hpp" |
@@ -170,6 +171,85 @@ class KEYPLESERVICE_API LocalReaderAdapter : public AbstractReaderAdapter { |
170 | 171 | */ |
171 | 172 | void releaseChannel() final; |
172 | 173 |
|
| 174 | + /** |
| 175 | + * (private)<br> |
| 176 | + * Local implementation of ApduRequestSpi. |
| 177 | + */ |
| 178 | + class ApduRequest : public ApduRequestSpi { |
| 179 | + public: |
| 180 | + friend class LocalReaderAdapter; |
| 181 | + |
| 182 | + /** |
| 183 | + * |
| 184 | + */ |
| 185 | + virtual ~ApduRequest() = default; |
| 186 | + |
| 187 | + /** |
| 188 | + * |
| 189 | + */ |
| 190 | + std::vector<uint8_t> getApdu() const override; |
| 191 | + |
| 192 | + /** |
| 193 | + * |
| 194 | + */ |
| 195 | + const std::vector<int>& getSuccessfulStatusWords() const override; |
| 196 | + |
| 197 | + /** |
| 198 | + * |
| 199 | + */ |
| 200 | + const std::string& getInfo() const override; |
| 201 | + |
| 202 | + /** |
| 203 | + * |
| 204 | + */ |
| 205 | + friend std::ostream& |
| 206 | + operator<<(std::ostream& os, const ApduRequest& ar); |
| 207 | + |
| 208 | + /** |
| 209 | + * |
| 210 | + */ |
| 211 | + friend std::ostream& |
| 212 | + operator<<(std::ostream& os, const std::shared_ptr<ApduRequest> ar); |
| 213 | + |
| 214 | + /** |
| 215 | + * |
| 216 | + */ |
| 217 | + friend std::ostream& operator<<( |
| 218 | + std::ostream& os, |
| 219 | + const std::vector<std::shared_ptr<ApduRequest>>& ars); |
| 220 | + |
| 221 | + private: |
| 222 | + /** |
| 223 | + * |
| 224 | + */ |
| 225 | + static const int DEFAULT_SUCCESSFUL_CODE; |
| 226 | + |
| 227 | + /** |
| 228 | + * |
| 229 | + */ |
| 230 | + std::vector<uint8_t> mApdu; |
| 231 | + |
| 232 | + /** |
| 233 | + * |
| 234 | + */ |
| 235 | + const std::vector<int> mSuccessfulStatusWords; |
| 236 | + |
| 237 | + /** |
| 238 | + * |
| 239 | + */ |
| 240 | + std::string mInfo; |
| 241 | + |
| 242 | + /** |
| 243 | + * |
| 244 | + */ |
| 245 | + explicit ApduRequest(const std::vector<uint8_t>& apdu); |
| 246 | + |
| 247 | + /** |
| 248 | + * |
| 249 | + */ |
| 250 | + ApduRequest& setInfo(const std::string& info); |
| 251 | + }; |
| 252 | + |
173 | 253 | protected: |
174 | 254 | /** |
175 | 255 | * @return null or the name of the physical protocol used for the last card |
@@ -267,66 +347,6 @@ class KEYPLESERVICE_API LocalReaderAdapter : public AbstractReaderAdapter { |
267 | 347 | const bool mHasMatched; |
268 | 348 | }; |
269 | 349 |
|
270 | | - /** |
271 | | - * (private)<br> |
272 | | - * Local implementation of ApduRequestSpi. |
273 | | - */ |
274 | | - class ApduRequest : public ApduRequestSpi { |
275 | | - public: |
276 | | - friend class LocalReaderAdapter; |
277 | | - |
278 | | - /** |
279 | | - * |
280 | | - */ |
281 | | - virtual ~ApduRequest() = default; |
282 | | - |
283 | | - /** |
284 | | - * |
285 | | - */ |
286 | | - std::vector<uint8_t> getApdu() const override; |
287 | | - |
288 | | - /** |
289 | | - * |
290 | | - */ |
291 | | - const std::vector<int>& getSuccessfulStatusWords() const override; |
292 | | - |
293 | | - /** |
294 | | - * |
295 | | - */ |
296 | | - const std::string& getInfo() const override; |
297 | | - |
298 | | - private: |
299 | | - /** |
300 | | - * |
301 | | - */ |
302 | | - static const int DEFAULT_SUCCESSFUL_CODE; |
303 | | - |
304 | | - /** |
305 | | - * |
306 | | - */ |
307 | | - std::vector<uint8_t> mApdu; |
308 | | - |
309 | | - /** |
310 | | - * |
311 | | - */ |
312 | | - const std::vector<int> mSuccessfulStatusWords; |
313 | | - |
314 | | - /** |
315 | | - * |
316 | | - */ |
317 | | - std::string mInfo; |
318 | | - |
319 | | - /** |
320 | | - * |
321 | | - */ |
322 | | - explicit ApduRequest(const std::vector<uint8_t>& apdu); |
323 | | - |
324 | | - /** |
325 | | - * |
326 | | - */ |
327 | | - ApduRequest& setInfo(const std::string& info); |
328 | | - }; |
329 | | - |
330 | 350 | /** |
331 | 351 | * Determines the current protocol used by the card. |
332 | 352 | * |
|
0 commit comments