fsfw/src/fsfw/health/HasHealthIF.h

56 lines
2.1 KiB
C
Raw Normal View History

2020-10-29 17:52:28 +01:00
#ifndef FSFW_HEALTH_HASHEALTHIF_H_
#define FSFW_HEALTH_HASHEALTHIF_H_
2020-08-13 20:53:35 +02:00
#include "../events/Event.h"
#include "../ipc/MessageQueueSenderIF.h"
2022-08-16 12:48:22 +02:00
#include "../returnvalues/returnvalue.h"
class HasHealthIF {
2022-02-02 10:29:30 +01:00
public:
enum HealthState : uint8_t {
HEALTHY = 1,
FAULTY = 0,
EXTERNAL_CONTROL = 2,
NEEDS_RECOVERY = 3,
PERMANENT_FAULTY = 4
};
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_HEALTH_IF;
2022-08-27 01:01:29 +02:00
static constexpr ReturnValue_t OBJECT_NOT_HEALTHY = returnvalue::makeCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t INVALID_HEALTH_STATE = returnvalue::makeCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t IS_EXTERNALLY_CONTROLLED = returnvalue::makeCode(INTERFACE_ID, 3);
2022-02-02 10:29:30 +01:00
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1;
2022-05-12 20:06:10 +02:00
//! P1: New Health, P2: Old Health
2022-02-02 10:29:30 +01:00
static const Event HEALTH_INFO = MAKE_EVENT(6, severity::INFO);
static const Event CHILD_CHANGED_HEALTH = MAKE_EVENT(7, severity::INFO);
static const Event CHILD_PROBLEMS = MAKE_EVENT(8, severity::LOW);
2022-02-03 17:06:18 +01:00
//! Assembly overwrites health information of children to keep satellite alive.
static const Event OVERWRITING_HEALTH = MAKE_EVENT(9, severity::LOW);
//! Someone starts a recovery of a component (typically power-cycle). No parameters.
static const Event TRYING_RECOVERY = MAKE_EVENT(10, severity::MEDIUM);
//! Recovery is ongoing. Comes twice during recovery.
//! P1: 0 for the first, 1 for the second event. P2: 0
static const Event RECOVERY_STEP = MAKE_EVENT(11, severity::MEDIUM);
//! Recovery was completed. Not necessarily successful. No parameters.
static const Event RECOVERY_DONE = MAKE_EVENT(12, severity::MEDIUM);
2022-02-02 10:29:30 +01:00
virtual ~HasHealthIF() {}
virtual MessageQueueId_t getCommandQueue() const = 0;
/**
* @brief Set the Health State
* The parent will be informed, if the Health changes
* @param health
*/
virtual ReturnValue_t setHealth(HealthState health) = 0;
/**
* @brief Get Health State
* @return Health State of the object
*/
virtual HasHealthIF::HealthState getHealth() = 0;
};
2020-10-29 17:52:28 +01:00
#endif /* FSFW_HEALTH_HASHEALTHIF_H_ */