Keyple Service C++ Library - 3.3.5
Component of the Keyple C++ middleware
WaitForStartDetectStateAdapter.cpp
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 Eclipse Public License 2.0 which is available at *
9 * http://www.eclipse.org/legal/epl-2.0 *
10 * *
11 * SPDX-License-Identifier: EPL-2.0 *
12 ******************************************************************************/
13
14#include "keyple/core/service/WaitForStartDetectStateAdapter.hpp"
15
16#include <memory>
17
18namespace keyple {
19namespace core {
20namespace service {
21
22WaitForStartDetectStateAdapter::WaitForStartDetectStateAdapter(
23 ObservableLocalReaderAdapter* reader,
24 std::shared_ptr<AbstractMonitoringJobAdapter> monitoringJob,
25 std::shared_ptr<ExecutorService> executorService)
26: AbstractObservableStateAdapter(
27 MonitoringState::WAIT_FOR_START_DETECTION,
28 reader,
29 monitoringJob,
30 executorService)
31{
32}
33
34WaitForStartDetectStateAdapter::WaitForStartDetectStateAdapter(
35 ObservableLocalReaderAdapter* reader)
36: WaitForStartDetectStateAdapter(reader, nullptr, nullptr)
37{
38}
39
40void
41WaitForStartDetectStateAdapter::onEvent(const InternalEvent event)
42{
43 mLogger->trace(
44 "Internal event [%] received for reader [%] in current state [%]\n",
45 event,
46 getReader()->getName(),
47 getMonitoringState());
48
49 /* Process InternalEvent */
50 switch (event) {
51 case InternalEvent::START_DETECT:
52 switchState(MonitoringState::WAIT_FOR_CARD_INSERTION);
53 break;
54
55 default:
56 mLogger->trace("Event ignored\n");
57 break;
58 }
59}
60
61} /* namespace service */
62} /* namespace core */
63} /* namespace keyple */
ObservableLocalReaderAdapter::InternalEvent InternalEvent