Today's the day. Renamed platform to framework.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#ifndef HASHEALTHIF_H_
|
||||
#define HASHEALTHIF_H_
|
||||
|
||||
#include <framework/events/Event.h>
|
||||
#include <framework/ipc/MessageQueueSender.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
class HasHealthIF {
|
||||
public:
|
||||
|
||||
typedef enum {
|
||||
HEALTHY = 1, FAULTY = 0, EXTERNAL_CONTROL = 2, NEEDS_RECOVERY = 3, PERMANENT_FAULTY = 4
|
||||
} HealthState;
|
||||
|
||||
static const uint8_t INTERFACE_ID = HAS_HEALTH_IF;
|
||||
static const ReturnValue_t OBJECT_NOT_HEALTHY = MAKE_RETURN_CODE(1);
|
||||
static const ReturnValue_t INVALID_HEALTH_STATE = MAKE_RETURN_CODE(2);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1;
|
||||
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);
|
||||
static const Event OVERWRITING_HEALTH = MAKE_EVENT(9, SEVERITY::LOW); //!< Assembly overwrites health information of children to keep satellite alive.
|
||||
static const Event TRYING_RECOVERY = MAKE_EVENT(10, SEVERITY::MEDIUM);
|
||||
static const Event RECOVERY_STEP = MAKE_EVENT(11, SEVERITY::MEDIUM);
|
||||
static const Event RECOVERY_DONE = MAKE_EVENT(12, SEVERITY::MEDIUM);
|
||||
|
||||
virtual ~HasHealthIF() {
|
||||
}
|
||||
|
||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||
|
||||
/**
|
||||
* set the Health State
|
||||
*
|
||||
* The parent will be informed, if the Health changes
|
||||
*
|
||||
* @param health
|
||||
*/
|
||||
virtual ReturnValue_t setHealth(HealthState health) = 0;
|
||||
|
||||
/**
|
||||
* get Health State
|
||||
*
|
||||
* @return Health State of the object
|
||||
*/
|
||||
virtual HasHealthIF::HealthState getHealth() = 0;
|
||||
};
|
||||
|
||||
#endif /* HASHEALTHIF_H_ */
|
||||
@@ -0,0 +1,99 @@
|
||||
#include <framework/ipc/MessageQueueSender.h>
|
||||
#include <framework/health/HealthHelper.h>
|
||||
#include <framework/ipc/MessageQueueSender.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) :
|
||||
healthTable(NULL), eventSender(NULL), objectId(objectId), parentQueue(
|
||||
0), owner(owner) {
|
||||
}
|
||||
|
||||
HealthHelper::~HealthHelper() {
|
||||
}
|
||||
|
||||
ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
|
||||
switch (message->getCommand()) {
|
||||
case HealthMessage::HEALTH_SET:
|
||||
handleSetHealthCommand(message);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
case HealthMessage::HEALTH_ANNOUNCE: {
|
||||
eventSender->forwardEvent(HasHealthIF::HEALTH_INFO, getHealth(),
|
||||
getHealth());
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
default:
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthHelper::getHealth() {
|
||||
return healthTable->getHealth(objectId);
|
||||
}
|
||||
|
||||
ReturnValue_t HealthHelper::initialize(MessageQueueId_t parentQueue) {
|
||||
setParentQeueue(parentQueue);
|
||||
return initialize();
|
||||
}
|
||||
|
||||
void HealthHelper::setParentQeueue(MessageQueueId_t parentQueue) {
|
||||
this->parentQueue = parentQueue;
|
||||
}
|
||||
|
||||
ReturnValue_t HealthHelper::initialize() {
|
||||
healthTable = objectManager->get<HealthTableIF>(objects::HEALTH_TABLE);
|
||||
eventSender = objectManager->get<EventReportingProxyIF>(objectId);
|
||||
if ((healthTable == NULL) || eventSender == NULL) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = healthTable->registerObject(objectId,
|
||||
HasHealthIF::HEALTHY);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void HealthHelper::setHealth(HasHealthIF::HealthState health) {
|
||||
HasHealthIF::HealthState oldHealth = getHealth();
|
||||
eventSender->forwardEvent(HasHealthIF::HEALTH_INFO, health, oldHealth);
|
||||
if (health != oldHealth) {
|
||||
healthTable->setHealth(objectId, health);
|
||||
informParent(health, oldHealth);
|
||||
}
|
||||
}
|
||||
|
||||
void HealthHelper::informParent(HasHealthIF::HealthState health,
|
||||
HasHealthIF::HealthState oldHealth) {
|
||||
if (parentQueue == 0) {
|
||||
return;
|
||||
}
|
||||
CommandMessage message;
|
||||
MessageQueueSender sender(parentQueue);
|
||||
HealthMessage::setHealthMessage(&message, HealthMessage::HEALTH_INFO,
|
||||
health, oldHealth);
|
||||
if (sender.sendToDefault(&message, owner->getCommandQueue())
|
||||
!= HasReturnvaluesIF::RETURN_OK) {
|
||||
debug << "HealthHelper::informParent: sending health reply failed."
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void HealthHelper::handleSetHealthCommand(CommandMessage* message) {
|
||||
ReturnValue_t result = owner->setHealth(HealthMessage::getHealth(message));
|
||||
if (message->getSender() == 0) {
|
||||
return;
|
||||
}
|
||||
CommandMessage reply;
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
HealthMessage::setHealthMessage(&reply,
|
||||
HealthMessage::REPLY_HEALTH_SET);
|
||||
} else {
|
||||
reply.setReplyRejected(result, message->getCommand());
|
||||
}
|
||||
MessageQueueSender sender(message->getSender());
|
||||
if (sender.sendToDefault(&reply, owner->getCommandQueue())
|
||||
!= HasReturnvaluesIF::RETURN_OK) {
|
||||
debug
|
||||
<< "HealthHelper::handleHealthCommand: sending health reply failed."
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
#ifndef HEALTHHELPER_H_
|
||||
#define HEALTHHELPER_H_
|
||||
|
||||
#include <framework/events/EventManagerIF.h>
|
||||
#include <framework/events/EventReportingProxyIF.h>
|
||||
#include <framework/health/HasHealthIF.h>
|
||||
#include <framework/health/HealthMessage.h>
|
||||
#include <framework/health/HealthTableIF.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
/**
|
||||
* Helper class for Objects that implement HasHealthIF
|
||||
*
|
||||
* 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
|
||||
* changes, not for all @c HEALTH_SET commands received.
|
||||
*
|
||||
* It does NOT handle @c HEALTH_INFO messages
|
||||
*/
|
||||
class HealthHelper {
|
||||
public:
|
||||
|
||||
/**
|
||||
* ctor
|
||||
*
|
||||
* @param objectId the object Id to use when communication with the HealthTable
|
||||
* @param useAsFrom id to use as from id when sending replies, can be set to 0
|
||||
*/
|
||||
HealthHelper(HasHealthIF* owner, object_id_t objectId);
|
||||
|
||||
virtual ~HealthHelper();
|
||||
|
||||
/**
|
||||
* Pointer to the Health Table
|
||||
*
|
||||
* only valid after initialize() has been called
|
||||
*/
|
||||
HealthTableIF *healthTable;
|
||||
|
||||
/**
|
||||
* Proxy to forward events.
|
||||
*/
|
||||
EventReportingProxyIF* eventSender;
|
||||
|
||||
/**
|
||||
* Try to handle the message.
|
||||
*
|
||||
* This function handles @c HEALTH_SET and @c HEALTH_READ commands.
|
||||
* it updates the Health Table and generates a reply to the sender.
|
||||
*
|
||||
* @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)
|
||||
*/
|
||||
ReturnValue_t handleHealthCommand(CommandMessage *message);
|
||||
|
||||
/**
|
||||
* set the Health State
|
||||
*
|
||||
* The parent will be informed, if the Health changes
|
||||
*
|
||||
* @param health
|
||||
*/
|
||||
void setHealth(HasHealthIF::HealthState health);
|
||||
|
||||
/**
|
||||
* get Health State
|
||||
*
|
||||
* @return Health State of the object
|
||||
*/
|
||||
HasHealthIF::HealthState getHealth();
|
||||
|
||||
/**
|
||||
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
|
||||
*/
|
||||
void setParentQeueue(MessageQueueId_t parentQueue);
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
ReturnValue_t initialize(MessageQueueId_t parentQueue );
|
||||
|
||||
ReturnValue_t initialize();
|
||||
|
||||
private:
|
||||
/**
|
||||
* the object id to use when communicating with the Health Table
|
||||
*/
|
||||
object_id_t objectId;
|
||||
|
||||
/**
|
||||
* The Queue of the parent
|
||||
*/
|
||||
MessageQueueId_t parentQueue;
|
||||
|
||||
/**
|
||||
* The one using the healthHelper.
|
||||
*/
|
||||
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
|
||||
* @param oldHealth information of the previous health state.
|
||||
*/
|
||||
void informParent(HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth);
|
||||
|
||||
void handleSetHealthCommand(CommandMessage *message);
|
||||
};
|
||||
|
||||
#endif /* HEALTHHELPER_H_ */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* HealthMessage.cpp
|
||||
*
|
||||
* Created on: 15.07.2013
|
||||
* Author: tod
|
||||
*/
|
||||
|
||||
#include <framework/health/HealthMessage.h>
|
||||
|
||||
void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command,
|
||||
HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth) {
|
||||
message->setCommand(command);
|
||||
message->setParameter(health);
|
||||
message->setParameter2(oldHealth);
|
||||
}
|
||||
|
||||
void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command) {
|
||||
message->setCommand(command);
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthMessage::getHealth(const CommandMessage* message) {
|
||||
return (HasHealthIF::HealthState) message->getParameter();
|
||||
}
|
||||
|
||||
void HealthMessage::clear(CommandMessage* message) {
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
}
|
||||
|
||||
HealthMessage::HealthMessage() {
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthMessage::getOldHealth(
|
||||
const CommandMessage* message) {
|
||||
return (HasHealthIF::HealthState) message->getParameter2();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* HealthMessage.h
|
||||
*
|
||||
* Created on: 15.07.2013
|
||||
* Author: tod
|
||||
*/
|
||||
|
||||
#ifndef HEALTHMESSAGE_H_
|
||||
#define HEALTHMESSAGE_H_
|
||||
|
||||
#include <framework/health/HasHealthIF.h>
|
||||
#include <framework/ipc/CommandMessage.h>
|
||||
|
||||
class HealthMessage {
|
||||
public:
|
||||
static const uint8_t MESSAGE_ID = HEALTH_COMMAND_MESSAGE_ID;
|
||||
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED
|
||||
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY!
|
||||
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,
|
||||
HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY);
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
#endif /* HEALTHMESSAGE_H_ */
|
||||
@@ -0,0 +1,101 @@
|
||||
#include <framework/health/HealthTable.h>
|
||||
#include <framework/serialize/SerializeAdapter.h>
|
||||
|
||||
HealthTable::HealthTable(object_id_t objectid) :
|
||||
SystemObject(objectid) {
|
||||
mutex = new MutexId_t;
|
||||
OSAL::createMutex(objectid + 1, mutex);
|
||||
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
|
||||
HealthTable::~HealthTable() {
|
||||
OSAL::deleteMutex(mutex);
|
||||
delete mutex;
|
||||
}
|
||||
|
||||
ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState) {
|
||||
if (healthMap.count(object) != 0) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
healthMap.insert(
|
||||
std::pair<object_id_t, HasHealthIF::HealthState>(object,
|
||||
initilialState));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void HealthTable::setHealth(object_id_t object,
|
||||
HasHealthIF::HealthState newState) {
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
iter->second = newState;
|
||||
}
|
||||
OSAL::unlockMutex(mutex);
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
|
||||
HasHealthIF::HealthState state = HasHealthIF::HEALTHY;
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
state = iter->second;
|
||||
}
|
||||
OSAL::unlockMutex(mutex);
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32_t HealthTable::getPrintSize() {
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
uint32_t size = healthMap.size() * 5 + 2;
|
||||
OSAL::unlockMutex(mutex);
|
||||
return size;
|
||||
}
|
||||
|
||||
bool HealthTable::hasHealth(object_id_t object) {
|
||||
bool exits = false;
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
exits = true;
|
||||
}
|
||||
OSAL::unlockMutex(mutex);
|
||||
return exits;
|
||||
}
|
||||
|
||||
void HealthTable::printAll(uint8_t* pointer, uint32_t maxSize) {
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
uint32_t size = 0;
|
||||
uint16_t count = healthMap.size();
|
||||
ReturnValue_t result = SerializeAdapter<uint16_t>::serialize(&count,
|
||||
&pointer, &size, maxSize, true);
|
||||
HealthMap::iterator iter;
|
||||
for (iter = healthMap.begin();
|
||||
iter != healthMap.end() && result == HasReturnvaluesIF::RETURN_OK;
|
||||
++iter) {
|
||||
result = SerializeAdapter<object_id_t>::serialize(&iter->first,
|
||||
&pointer, &size, maxSize, true);
|
||||
uint8_t health = iter->second;
|
||||
result = SerializeAdapter<uint8_t>::serialize(&health, &pointer, &size,
|
||||
maxSize, true);
|
||||
}
|
||||
OSAL::unlockMutex(mutex);
|
||||
}
|
||||
|
||||
ReturnValue_t HealthTable::iterate(
|
||||
std::pair<object_id_t, HasHealthIF::HealthState> *value, bool reset) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
OSAL::lockMutex(mutex, OSAL::NO_TIMEOUT);
|
||||
if (reset) {
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
if (mapIterator == healthMap.end()) {
|
||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
*value = *mapIterator;
|
||||
mapIterator++;
|
||||
OSAL::unlockMutex(mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef HEALTHTABLE_H_
|
||||
#define HEALTHTABLE_H_
|
||||
|
||||
#include <framework/health/HealthTableIF.h>
|
||||
#include <framework/objectmanager/SystemObject.h>
|
||||
#include <framework/osal/OSAL.h>
|
||||
#include <map>
|
||||
|
||||
typedef std::map<object_id_t, HasHealthIF::HealthState> HealthMap;
|
||||
|
||||
class HealthTable: public HealthTableIF, public SystemObject {
|
||||
public:
|
||||
HealthTable(object_id_t objectid);
|
||||
virtual ~HealthTable();
|
||||
|
||||
virtual ReturnValue_t registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY);
|
||||
|
||||
virtual bool hasHealth(object_id_t object);
|
||||
virtual void setHealth(object_id_t object, HasHealthIF::HealthState newState);
|
||||
virtual HasHealthIF::HealthState getHealth(object_id_t);
|
||||
|
||||
virtual uint32_t getPrintSize();
|
||||
virtual void printAll(uint8_t *pointer, uint32_t maxSize);
|
||||
|
||||
protected:
|
||||
MutexId_t* mutex;
|
||||
HealthMap healthMap;
|
||||
|
||||
HealthMap::iterator mapIterator;
|
||||
|
||||
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false);
|
||||
};
|
||||
|
||||
#endif /* HEALTHTABLE_H_ */
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* HealthTabelIF.h
|
||||
*
|
||||
* Created on: 15.07.2013
|
||||
* Author: tod
|
||||
*/
|
||||
|
||||
#ifndef HEALTHTABLEIF_H_
|
||||
#define HEALTHTABLEIF_H_
|
||||
|
||||
#include <framework/health/ManagesHealthIF.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <map>
|
||||
|
||||
|
||||
class HealthTableIF: public ManagesHealthIF {
|
||||
friend class HealthCommandingService;
|
||||
public:
|
||||
virtual ~HealthTableIF() {
|
||||
}
|
||||
|
||||
virtual ReturnValue_t registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
|
||||
|
||||
virtual uint32_t getPrintSize() = 0;
|
||||
virtual void printAll(uint8_t *pointer, uint32_t maxSize) = 0;
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false) = 0;
|
||||
};
|
||||
|
||||
#endif /* HEALTHTABLEIF_H_ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* ManagesHealthIF.h
|
||||
*
|
||||
* Created on: 13.10.2015
|
||||
* Author: baetz
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_
|
||||
#define FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_
|
||||
|
||||
#include <framework/health/HasHealthIF.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
class ManagesHealthIF {
|
||||
public:
|
||||
virtual ~ManagesHealthIF() {
|
||||
}
|
||||
virtual bool hasHealth(object_id_t object) = 0;
|
||||
virtual void setHealth(object_id_t object,
|
||||
HasHealthIF::HealthState newState) = 0;
|
||||
virtual HasHealthIF::HealthState getHealth(object_id_t) = 0;
|
||||
|
||||
virtual bool isHealthy(object_id_t object) {
|
||||
return (getHealth(object) == HasHealthIF::HEALTHY);
|
||||
}
|
||||
|
||||
virtual bool isHealthy(HasHealthIF::HealthState health) {
|
||||
return (health == HasHealthIF::HEALTHY);
|
||||
}
|
||||
|
||||
virtual bool isFaulty(object_id_t object) {
|
||||
HasHealthIF::HealthState health = getHealth(object);
|
||||
return isFaulty(health);
|
||||
}
|
||||
|
||||
virtual bool isPermanentFaulty(object_id_t object) {
|
||||
HasHealthIF::HealthState health = getHealth(object);
|
||||
return isPermanentFaulty(health);
|
||||
}
|
||||
|
||||
virtual bool isPermanentFaulty(HasHealthIF::HealthState health) {
|
||||
return (health == HasHealthIF::PERMANENT_FAULTY);
|
||||
}
|
||||
|
||||
virtual bool shouldBeMonitored(object_id_t object) {
|
||||
HasHealthIF::HealthState health = getHealth(object);
|
||||
return shouldBeMonitored(health);
|
||||
}
|
||||
|
||||
static bool isFaulty(HasHealthIF::HealthState health) {
|
||||
return ((health == HasHealthIF::FAULTY)
|
||||
|| (health == HasHealthIF::PERMANENT_FAULTY)
|
||||
|| (health == HasHealthIF::NEEDS_RECOVERY));
|
||||
}
|
||||
|
||||
virtual bool isCommandable(object_id_t object) {
|
||||
return (getHealth(object) != HasHealthIF::EXTERNAL_CONTROL);
|
||||
}
|
||||
|
||||
virtual bool isCommandable(HasHealthIF::HealthState health) {
|
||||
return (health != HasHealthIF::EXTERNAL_CONTROL);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_ */
|
||||
Reference in New Issue
Block a user