1
0
forked from fsfw/fsfw

Today's the day. Renamed platform to framework.

This commit is contained in:
Bastian Baetz
2016-06-15 23:48:41 +02:00
committed by Ulrich Mohr
parent 40987d0b27
commit 1d22a6c97e
356 changed files with 33946 additions and 3 deletions

View File

@ -0,0 +1,57 @@
#include <framework/devicehandlers/HealthDevice.h>
HealthDevice::HealthDevice(object_id_t setObjectId,
MessageQueueId_t parentQueue) :
SystemObject(setObjectId), lastHealth(HEALTHY), parentQueue(
parentQueue), commandQueue(3,
CommandMessage::COMMAND_MESSAGE_SIZE), healthHelper(this, setObjectId) {
}
HealthDevice::~HealthDevice() {
}
ReturnValue_t HealthDevice::performOperation() {
CommandMessage message;
ReturnValue_t result = commandQueue.receiveMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
healthHelper.handleHealthCommand(&message);
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t HealthDevice::initialize() {
ReturnValue_t result = SystemObject::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
if (parentQueue != 0) {
return healthHelper.initialize(parentQueue);
} else {
return healthHelper.initialize();
}
}
MessageQueueId_t HealthDevice::getCommandQueue() const {
return commandQueue.getId();
}
void HealthDevice::setParentQueue(MessageQueueId_t parentQueue) {
healthHelper.setParentQeueue(parentQueue);
}
bool HealthDevice::hasHealthChanged() {
bool changed;
HealthState currentHealth = healthHelper.getHealth();
changed = currentHealth != lastHealth;
lastHealth = currentHealth;
return changed;
}
ReturnValue_t HealthDevice::setHealth(HealthState health) {
healthHelper.setHealth(health);
return HasReturnvaluesIF::RETURN_OK;
}
HasHealthIF::HealthState HealthDevice::getHealth() {
return healthHelper.getHealth();
}