14#include "keyple/core/service/WaitForCardProcessingStateAdapter.hpp"
24WaitForCardProcessingStateAdapter::WaitForCardProcessingStateAdapter(
25 ObservableLocalReaderAdapter* reader,
26 std::shared_ptr<AbstractMonitoringJobAdapter> monitoringJob,
27 std::shared_ptr<ExecutorService> executorService)
28: AbstractObservableStateAdapter(
29 MonitoringState::WAIT_FOR_CARD_PROCESSING,
36WaitForCardProcessingStateAdapter::WaitForCardProcessingStateAdapter(
37 ObservableLocalReaderAdapter* reader)
38: WaitForCardProcessingStateAdapter(reader, nullptr, nullptr)
43WaitForCardProcessingStateAdapter::onEvent(
const InternalEvent event)
46 "Internal event [%] received for reader [%] in current state [%]\n",
48 getReader()->getName(),
49 getMonitoringState());
53 case InternalEvent::CARD_PROCESSED:
54 if (getReader()->getDetectionMode() == DetectionMode::REPEATING) {
55 switchState(MonitoringState::WAIT_FOR_CARD_REMOVAL);
59 getReader()->processCardRemoved();
60 switchState(MonitoringState::WAIT_FOR_START_DETECTION);
64 case InternalEvent::CARD_REMOVED:
70 getReader()->processCardRemoved();
71 if (getReader()->getDetectionMode() == DetectionMode::REPEATING) {
72 switchState(MonitoringState::WAIT_FOR_CARD_INSERTION);
74 switchState(MonitoringState::WAIT_FOR_START_DETECTION);
78 case InternalEvent::STOP_DETECT:
79 getReader()->processCardRemoved();
80 switchState(MonitoringState::WAIT_FOR_START_DETECTION);
84 mLogger->trace(
"Event ignored\n");
ObservableCardReader::DetectionMode DetectionMode
ObservableLocalReaderAdapter::InternalEvent InternalEvent