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 "protocol/handler.h"
8#include "run/run_manager.h"
9
10namespace msg {
11
12namespace handlers {
13
16public:
17 int handle(JsonObjectConst msg_in, JsonObject &msg_out) override {
18 return error(run::RunManager::get().start_run(msg_in, msg_out));
19 }
20};
21
23public:
24 int handle(JsonObjectConst msg_in, JsonObject &msg_out) override {
26 return error(success ? 0 : 1);
27 }
28};
29
30} // namespace handlers
31
32} // namespace msg
A MessageHandler is a functor/closure like event handler.
Definition handler.h:21
constexpr int error(int internal_code)
Definition handler.h:32
static constexpr int success
Definition handler.h:24
int handle(JsonObjectConst msg_in, JsonObject &msg_out) override
The actual handler method gets a message and returns a message next to the status code.
Definition run_manager.h:17
int handle(JsonObjectConst msg_in, JsonObject &msg_out) override
The actual handler method gets a message and returns a message next to the status code.
Definition run_manager.h:24
static RunManager & get()
Definition run_manager.h:32
bool end_repetitive_runs()
Returns true on success.
Definition run_manager.h:35
Definition carrier.h:12