1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- // SPDX-License-Identifier: MIT
- // SPDX-FileCopyrightText: 2022 Ivan Baidakou
- #pragma once
- #include "definitions.hpp"
- #include "message.hpp"
- namespace rotor_light::message {
- /** \struct ChangeState
- * \brief State Change command, from supervisor/actor to actor
- */
- struct ChangeState : Message {
- /** synthethic message id used as anchor for rotor-light messages */
- static constexpr auto undef = std::numeric_limits<MessageTypeId>::max();
- /** message type identifyer */
- static constexpr auto type_id = undef - 1;
- /** records destination and state change command */
- ChangeState(ActorId to, details::StateCommand command_)
- : Message(to), command{command_} {}
- /** state change command */
- details::StateCommand command;
- };
- /** \struct ChangeStateAck
- * \brief State Change confirmation, from actor to supervisor
- */
- struct ChangeStateAck : Message {
- /** message type identifyer */
- static constexpr auto type_id = ChangeState::type_id - 1;
- /** records origin of the state change and success marker */
- ChangeStateAck(ActorId to, ActorId from_, State state_, bool success_)
- : Message(to), from{from_}, state{state_}, success{success_} {}
- /** origin/source actor */
- ActorId from;
- /** asked/subject state */
- State state;
- /** success marker */
- bool success;
- };
- /** \struct RefreshTime
- * \brief Idle message, refreshes time and triggers expired timers
- */
- struct RefreshTime : Message {
- /** message type identifyer */
- static constexpr auto type_id = ChangeStateAck::type_id - 1;
- /** use parent's ctor */
- using Message::Message;
- };
- } // namespace rotor_light::message
|