2020-09-23 17:44:22 +02:00
|
|
|
#ifndef FSFW_HEALTH_HEALTHMESSAGE_H_
|
|
|
|
#define FSFW_HEALTH_HEALTHMESSAGE_H_
|
2020-08-28 18:33:29 +02:00
|
|
|
|
2020-09-23 17:44:22 +02:00
|
|
|
#include "HasHealthIF.h"
|
2020-08-28 18:33:29 +02:00
|
|
|
#include "../ipc/CommandMessage.h"
|
|
|
|
|
|
|
|
class HealthMessage {
|
|
|
|
public:
|
|
|
|
static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND;
|
2020-10-10 17:55:38 +02:00
|
|
|
|
2020-09-23 17:44:22 +02:00
|
|
|
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);
|
2020-10-10 17:55:38 +02:00
|
|
|
// No reply expected, health will be announced as event!
|
|
|
|
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(2);
|
|
|
|
// Same as before, but all objects in health table will
|
|
|
|
// announce their health as events.
|
|
|
|
static const Command_t HEALTH_ANNOUNCE_ALL = MAKE_COMMAND_ID(3);
|
|
|
|
|
2020-08-28 18:33:29 +02:00
|
|
|
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);
|
|
|
|
static const Command_t REPLY_HEALTH_SET = MAKE_COMMAND_ID(6);
|
|
|
|
|
|
|
|
static void setHealthMessage(CommandMessage *message, Command_t command,
|
2020-09-23 17:44:22 +02:00
|
|
|
HasHealthIF::HealthState health,
|
|
|
|
HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY);
|
2020-08-28 18:33:29 +02:00
|
|
|
static void setHealthMessage(CommandMessage *message, Command_t command);
|
|
|
|
|
|
|
|
static HasHealthIF::HealthState getHealth(const CommandMessage *message);
|
|
|
|
|
|
|
|
static HasHealthIF::HealthState getOldHealth(const CommandMessage *message);
|
|
|
|
|
|
|
|
static void clear(CommandMessage *message);
|
|
|
|
|
|
|
|
private:
|
|
|
|
HealthMessage();
|
|
|
|
};
|
|
|
|
|
2020-09-23 17:44:22 +02:00
|
|
|
#endif /* FSFW_HEALTH_HEALTHMESSAGE_H_ */
|