Keypop Reader C++ API - 2.1.0
Component of the Keypop C++ API
ObservableCardReader.hpp
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 MIT License which is available at *
9 * https://opensource.org/licenses/MIT *
10 * *
11 * SPDX-License-Identifier: MIT *
12 ******************************************************************************/
13
14#pragma once
15
16#include <memory>
17
21
22namespace keypop {
23namespace reader {
24
27
33class ObservableCardReader : virtual public CardReader {
34public:
47
54 };
55
77 };
78
94 std::shared_ptr<CardReaderObservationExceptionHandlerSpi>
95 exceptionHandler) = 0;
96
109 virtual void addObserver(std::shared_ptr<CardReaderObserverSpi> observer)
110 = 0;
111
122 virtual void
123 removeObserver(const std::shared_ptr<CardReaderObserverSpi> observer) = 0;
124
130 virtual void clearObservers() = 0;
131
138 virtual int countObservers() const = 0;
139
151 virtual void startCardDetection(const DetectionMode detectionMode) = 0;
152
158 virtual void stopCardDetection() = 0;
159
181 virtual void finalizeCardProcessing() = 0;
182};
183
184} /* namespace reader */
185} /* namespace keypop */
Card reader driving the underlying hardware to manage the card detection.
Definition: CardReader.hpp:26
Card reader able to observe the insertion/removal of cards.
virtual void finalizeCardProcessing()=0
Notifies the observation process that the processing of the card has been completed in order to ensur...
virtual void startCardDetection(const DetectionMode detectionMode)=0
Starts the card detection.
virtual void removeObserver(const std::shared_ptr< CardReaderObserverSpi > observer)=0
Unregisters a reader observer.
NotificationMode
The options that apply when a card is detected.
@ ALWAYS
All cards presented to the readers are notified to the observers, regardless of the result of the sel...
@ MATCHED_ONLY
Only the cards that have been successfully selected will be notified to the observers.
virtual void clearObservers()=0
Unregisters all observers at once.
virtual int countObservers() const =0
Provides the current number of registered observers.
virtual void stopCardDetection()=0
Stops the card detection.
DetectionMode
Card detection management options to be applied after processing a card.
@ SINGLESHOT
Stop and wait for a restart signal.
@ REPEATING
Continue waiting for the insertion of a next card.
virtual void setReaderObservationExceptionHandler(std::shared_ptr< CardReaderObservationExceptionHandlerSpi > exceptionHandler)=0
Sets the exception handler.
virtual void addObserver(std::shared_ptr< CardReaderObserverSpi > observer)=0
Registers a new observer to be notified when a reader event occurs.
Reader observation error handler to implement in order to be notified of errors that may occur during...
Reader observer to implement in order to receive CardReaderEvent from a keypop::reader::ObservableCar...