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 "[fsmState=%, reader=%] Processing internal event [type=%]\n",
46 getReader()->getName(),
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);
67 "[fsmState=%, reader=%] Inserted card hasn't matched",
69 getReader()->getName());
71 switchState(MonitoringState::WAIT_FOR_CARD_REMOVAL);
75 case InternalEvent::STOP_DETECT:
76 switchState(MonitoringState::WAIT_FOR_START_DETECTION);
80 "[fsmState=%, reader=%] Internal event ignored\n",
82 getReader()->getName());
87 "[fsmState=%, reader=%] Internal event processed [type=%]\n",
89 getReader()->getName(),
ObservableLocalReaderAdapter::InternalEvent InternalEvent