5#ifndef MRAS_SUBSYSTEM_H
6#define MRAS_SUBSYSTEM_H
9#include "SystemMessage.h"
12#define SUBSYSTEM_NO_MESSAGE_HANDLER void on_message(SystemMessage *msg) override {};
14#define SUBSYSTEM_NAME(name) const char* get_name() override { return name; }
44 virtual int8_t setup() = 0;
52 virtual int8_t loop() = 0;
91 int16_t subscriber_count = 0;
94 int8_t self_test_result = -1;
96 void log(
const char fmt[], ...);
114 static void buzzer(uint16_t frequency, uint32_t duration,
bool block =
false);
Definition: Subsystem.h:30
virtual const char * get_name()=0
bool add_subscriber(Subsystem *subscriber)
Definition: Subsystem.cpp:22
int8_t get_status() const
Definition: Subsystem.cpp:14
static void buzzer(uint16_t frequency, uint32_t duration, bool block=false)
Definition: Subsystem.cpp:60
uint8_t get_id() const
Definition: Subsystem.cpp:10
int8_t self_test() const
Definition: Subsystem.cpp:18
Subsystem(uint8_t id)
Definition: Subsystem.h:86
void publish(SystemMessage *msg)
Definition: Subsystem.cpp:51
virtual void on_message(SystemMessage *msg)=0
A base class for all system messages.
Definition: SystemMessage.h:32