health update

This commit is contained in:
2020-10-29 17:52:28 +01:00
parent 096643971b
commit 3098f34eb0
8 changed files with 112 additions and 99 deletions

View File

@ -12,13 +12,15 @@
#include "../returnvalues/HasReturnvaluesIF.h"
/**
* Helper class for Objects that implement HasHealthIF
* @brief Helper class for Objects that implement HasHealthIF
* @details
* It takes care of registering with the Health Table as well as handling
* health commands (including replying to the sender) and updating
* the Health Table.
*
* It takes care of registering with the Health Table as well as handling health commands
* (including replying to the sender) and updating the Health Table.
*
* If a parent is set in the ctor, the parent will be informed with a @c HEALTH_INFO message
* about changes in the health state. Note that a @c HEALTH_INFO is only generated if the Health
* If a parent is set in the ctor, the parent will be informed with a
* @c HEALTH_INFO message about changes in the health state.
* Note that a @c HEALTH_INFO is only generated if the Health
* changes, not for all @c HEALTH_SET commands received.
*
* It does NOT handle @c HEALTH_INFO messages
@ -27,10 +29,9 @@ class HealthHelper {
public:
/**
* ctor
*
* @param owner
* @param objectId the object Id to use when communication with the HealthTable
* @param objectId The object Id to use when communication with
* the HealthTable
*/
HealthHelper(HasHealthIF* owner, object_id_t objectId);
@ -56,8 +57,9 @@ public:
*
* @param message
* @return
* -@c RETURN_OK if the message was handled
* -@c RETURN_FAILED if the message could not be handled (ie it was not a @c HEALTH_SET or @c HEALTH_READ message)
* -@c RETURN_OK if the message was handled
* -@c RETURN_FAILED if the message could not be handled
* (ie it was not a @c HEALTH_SET or @c HEALTH_READ message)
*/
ReturnValue_t handleHealthCommand(CommandMessage *message);
@ -78,16 +80,19 @@ public:
HasHealthIF::HealthState getHealth();
/**
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
* @param parentQueue The queue ID of the parent object.
* Set to 0 if no parent present
*/
void setParentQueue(MessageQueueId_t parentQueue);
/**
*
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
* @param parentQueue The queue ID of the parent object.
* Set to 0 if no parent present
* @return
* -@c RETURN_OK if the Health Table was found and the object could be registered
* -@c RETURN_FAILED else
* -@c RETURN_OK if the Health Table was found and the object
* could be registered
* -@c RETURN_FAILED else
*/
ReturnValue_t initialize(MessageQueueId_t parentQueue );
@ -110,11 +115,15 @@ private:
HasHealthIF* owner;
/**
* if the #parentQueue is not NULL, a @c HEALTH_INFO message will be sent to this queue
* @param health the health is passed as parameter so that the number of calls to the health table can be minimized
* if the #parentQueue is not NULL, a @c HEALTH_INFO message
* will be sent to this queue
* @param health
* The health is passed as parameter so that the number of
* calls to the health table can be minimized
* @param oldHealth information of the previous health state.
*/
void informParent(HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth);
void informParent(HasHealthIF::HealthState health,
HasHealthIF::HealthState oldHealth);
void handleSetHealthCommand(CommandMessage *message);
};