rotor_light
real-time C++ actor micro-framework for embedded systems, supervisable
messages.hpp
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2022 Ivan Baidakou
3
4#pragma once
5
6#include "definitions.hpp"
7#include "message.hpp"
8
9namespace rotor_light::message {
10
16 static constexpr auto undef = std::numeric_limits<MessageTypeId>::max();
17
19 static constexpr auto type_id = undef - 1;
20
22 ChangeState(ActorId to, details::StateCommand command_)
23 : Message(to), command{command_} {}
24
26 details::StateCommand command;
27};
28
34 static constexpr auto type_id = ChangeState::type_id - 1;
35
37 ChangeStateAck(ActorId to, ActorId from_, State state_, bool success_)
38 : Message(to), from{from_}, state{state_}, success{success_} {}
39
41 ActorId from;
42
44 State state;
45
47 bool success;
48};
49
55 static constexpr auto type_id = ChangeStateAck::type_id - 1;
56
58 using Message::Message;
59};
60
61} // namespace rotor_light::message
base class for all rotor-light messages
Definition: message.hpp:22
State Change confirmation, from actor to supervisor.
Definition: messages.hpp:32
ChangeStateAck(ActorId to, ActorId from_, State state_, bool success_)
Definition: messages.hpp:37
State state
Definition: messages.hpp:44
bool success
Definition: messages.hpp:47
static constexpr auto type_id
Definition: messages.hpp:34
ActorId from
Definition: messages.hpp:41
State Change command, from supervisor/actor to actor.
Definition: messages.hpp:14
ChangeState(ActorId to, details::StateCommand command_)
Definition: messages.hpp:22
static constexpr auto undef
Definition: messages.hpp:16
details::StateCommand command
Definition: messages.hpp:26
static constexpr auto type_id
Definition: messages.hpp:19
Idle message, refreshes time and triggers expired timers.
Definition: messages.hpp:53
static constexpr auto type_id
Definition: messages.hpp:55