added announce all subservice

This commit is contained in:
Robin Müller 2020-10-10 17:55:38 +02:00
parent bc0402faf7
commit 01e7a98425
2 changed files with 11 additions and 6 deletions

View File

@ -7,11 +7,13 @@ void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command,
message->setParameter2(oldHealth); message->setParameter2(oldHealth);
} }
void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command) { void HealthMessage::setHealthMessage(CommandMessage* message,
Command_t command) {
message->setCommand(command); message->setCommand(command);
} }
HasHealthIF::HealthState HealthMessage::getHealth(const CommandMessage* message) { HasHealthIF::HealthState HealthMessage::getHealth(
const CommandMessage* message) {
return (HasHealthIF::HealthState) message->getParameter(); return (HasHealthIF::HealthState) message->getParameter();
} }

View File

@ -7,17 +7,20 @@
class HealthMessage { class HealthMessage {
public: public:
static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND;
// REPLY_COMMAND_OK/REPLY_REJECTED
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1); static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);
// NO REPLY! // No reply expected, health will be announced as event!
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); 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);
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5); static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);
static const Command_t REPLY_HEALTH_SET = MAKE_COMMAND_ID(6); static const Command_t REPLY_HEALTH_SET = MAKE_COMMAND_ID(6);
static void setHealthMessage(CommandMessage *message, Command_t command, static void setHealthMessage(CommandMessage *message, Command_t command,
HasHealthIF::HealthState health, HasHealthIF::HealthState health,
HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY); HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY);
static void setHealthMessage(CommandMessage *message, Command_t command); static void setHealthMessage(CommandMessage *message, Command_t command);
static HasHealthIF::HealthState getHealth(const CommandMessage *message); static HasHealthIF::HealthState getHealth(const CommandMessage *message);