14#include "keyple/core/service/WaitForCardInsertionStateAdapter.hpp"
22WaitForCardInsertionStateAdapter::WaitForCardInsertionStateAdapter(
23 ObservableLocalReaderAdapter* reader,
24 std::shared_ptr<AbstractMonitoringJobAdapter> monitoringJob,
25 std::shared_ptr<ExecutorService> executorService)
26: AbstractObservableStateAdapter(
27 MonitoringState::WAIT_FOR_CARD_INSERTION,
34WaitForCardInsertionStateAdapter::WaitForCardInsertionStateAdapter(
35 ObservableLocalReaderAdapter* reader)
36: WaitForCardInsertionStateAdapter(reader, nullptr, nullptr)
41WaitForCardInsertionStateAdapter::onEvent(
const InternalEvent event)
44 "Internal event [%] received for reader [%] in current state [%]\n",
46 getReader()->getName(),
47 getMonitoringState());
51 case InternalEvent::CARD_INSERTED: {
53 const std::shared_ptr<CardReaderEvent> cardEvent
54 = getReader()->processCardInserted();
55 if (cardEvent !=
nullptr) {
57 switchState(MonitoringState::WAIT_FOR_CARD_PROCESSING);
59 getReader()->notifyObservers(cardEvent);
66 mLogger->trace(
"Inserted card hasn't matched\n");
68 switchState(MonitoringState::WAIT_FOR_CARD_REMOVAL);
72 case InternalEvent::STOP_DETECT:
73 switchState(MonitoringState::WAIT_FOR_START_DETECTION);
76 mLogger->trace(
"Event ignored\n");
ObservableLocalReaderAdapter::InternalEvent InternalEvent