REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
run_manager.h
Go to the documentation of this file.
1// Copyright (c) 2024 anabrid GmbH
2// Contact: https://www.anabrid.com/licensing/
3// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
4
5#pragma once
6
7#include "run/run.h"
8
9namespace client {
10 class StreamingRunDataNotificationHandler;
11} // namespace client
12
13namespace carrier {
14 class Carrier;
15}
16
17namespace run {
18
20private:
21 static RunManager _instance;
22
23protected:
24 RunManager() = default;
25
26public:
27 std::queue<run::Run> queue;
28
29 RunManager(RunManager &other) = delete;
30 void operator=(const RunManager &other) = delete;
31
32 static RunManager &get() { return _instance; }
33
36 if (!queue.empty()) {
37 queue.front().config.repetitive = false;
38 return true;
39 }
40 return false;
41 }
42
44 void clear_queue() {
45 queue = {};
46 // if this does not work, try while(!Q.empty()) Q.pop();
47 }
48
50 run::RunDataHandler *run_data_handler,
52
53 void run_next_flexio(run::Run &run, run::RunStateChangeHandler *state_change_handler, run::RunDataHandler *run_data_handler);
54 void run_next_traditional(run::Run &run, run::RunStateChangeHandler *state_change_handler, run::RunDataHandler *run_data_handler, client::StreamingRunDataNotificationHandler *alt_run_data_handler);
55
57 int start_run(JsonObjectConst msg_in, JsonObject &msg_out);
58};
59
60} // namespace run
61
Top-level hierarchy controlled by a single microcontroller.
Definition carrier.h:38
void run_next_traditional(run::Run &run, run::RunStateChangeHandler *state_change_handler, run::RunDataHandler *run_data_handler, client::StreamingRunDataNotificationHandler *alt_run_data_handler)
static RunManager & get()
Definition run_manager.h:32
RunManager()=default
RunManager(RunManager &other)=delete
std::queue< run::Run > queue
Definition run_manager.h:27
bool end_repetitive_runs()
Returns true on success.
Definition run_manager.h:35
void clear_queue()
Clears the run queue.
Definition run_manager.h:44
void run_next_flexio(run::Run &run, run::RunStateChangeHandler *state_change_handler, run::RunDataHandler *run_data_handler)
void run_next(carrier::Carrier &carrier_, run::RunStateChangeHandler *state_change_handler, run::RunDataHandler *run_data_handler, client::StreamingRunDataNotificationHandler *alt_run_data_handler)
void operator=(const RunManager &other)=delete
Definition run.h:47
int start_run(JsonObjectConst msg_in, JsonObject &msg_out)
auto & carrier_
Definition run.h:14
Variant of RunDataNotificationHandler using utils::StreamingJson.