Merge branch 'mueller/master' into mueller/project/distribDatapool

This commit is contained in:
Robin Müller 2020-07-16 12:42:02 +02:00
commit b7411591a1
5 changed files with 26 additions and 69 deletions

View File

@ -4,15 +4,14 @@
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
object_id_t deviceCommunication, CookieIF * cookie, object_id_t deviceCommunication, CookieIF * cookie,
uint8_t setDeviceSwitch, object_id_t hkDestination, object_id_t hkDestination, uint32_t thermalStatePoolId,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalRequestPoolId,
object_id_t parent, object_id_t parent,
FailureIsolationBase* customFdir, size_t cmdQueueSize) : FailureIsolationBase* customFdir, size_t cmdQueueSize) :
DeviceHandlerBase(setObjectId, deviceCommunication, cookie, DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
(customFdir == nullptr? &childHandlerFdir : customFdir), (customFdir == nullptr? &childHandlerFdir : customFdir),
cmdQueueSize), cmdQueueSize),
parentId(parent), childHandlerFdir(setObjectId) { parentId(parent), childHandlerFdir(setObjectId) {
this->setDeviceSwitch(setDeviceSwitch);
this->setHkDestination(hkDestination); this->setHkDestination(hkDestination);
this->setThermalStateRequestPoolIds(thermalStatePoolId, this->setThermalStateRequestPoolIds(thermalStatePoolId,
thermalRequestPoolId); thermalRequestPoolId);

View File

@ -7,9 +7,9 @@
class ChildHandlerBase: public DeviceHandlerBase { class ChildHandlerBase: public DeviceHandlerBase {
public: public:
ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
CookieIF * cookie, uint8_t setDeviceSwitch, CookieIF * cookie, object_id_t hkDestination,
object_id_t hkDestination, uint32_t thermalStatePoolId, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
uint32_t thermalRequestPoolId, object_id_t parent = objects::NO_OBJECT, object_id_t parent = objects::NO_OBJECT,
FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20);
virtual ~ChildHandlerBase(); virtual ~ChildHandlerBase();

View File

@ -63,10 +63,6 @@ void DeviceHandlerBase::setThermalStateRequestPoolIds(
} }
void DeviceHandlerBase::setDeviceSwitch(uint8_t deviceSwitch) {
this->deviceSwitch = deviceSwitch;
}
DeviceHandlerBase::~DeviceHandlerBase() { DeviceHandlerBase::~DeviceHandlerBase() {
delete comCookie; delete comCookie;
if (defaultFDIRUsed) { if (defaultFDIRUsed) {
@ -168,12 +164,8 @@ ReturnValue_t DeviceHandlerBase::initialize() {
} }
result = healthHelper.initialize(); result = healthHelper.initialize();
if (result == RETURN_OK) { if (result != RETURN_OK) {
healthHelperActive = true; return result;
}
else {
sif::warning << "DeviceHandlerBase::initialize: Health Helper "
"initialization failure." << std::endl;
} }
result = modeHelper.initialize(); result = modeHelper.initialize();
@ -250,12 +242,10 @@ void DeviceHandlerBase::readCommandQueue() {
return; return;
} }
if(healthHelperActive) {
result = healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) { if (result == RETURN_OK) {
return; return;
} }
}
result = modeHelper.handleModeCommand(&command); result = modeHelper.handleModeCommand(&command);
if (result == RETURN_OK) { if (result == RETURN_OK) {
@ -1032,10 +1022,8 @@ void DeviceHandlerBase::getMode(Mode_t* mode, Submode_t* submode) {
} }
void DeviceHandlerBase::setToExternalControl() { void DeviceHandlerBase::setToExternalControl() {
if(healthHelperActive) {
healthHelper.setHealth(EXTERNAL_CONTROL); healthHelper.setHealth(EXTERNAL_CONTROL);
} }
}
void DeviceHandlerBase::announceMode(bool recursive) { void DeviceHandlerBase::announceMode(bool recursive) {
triggerEvent(MODE_INFO, mode, submode); triggerEvent(MODE_INFO, mode, submode);
@ -1054,24 +1042,11 @@ void DeviceHandlerBase::missedReply(DeviceCommandId_t id) {
} }
HasHealthIF::HealthState DeviceHandlerBase::getHealth() { HasHealthIF::HealthState DeviceHandlerBase::getHealth() {
if(healthHelperActive) {
return healthHelper.getHealth(); return healthHelper.getHealth();
} }
else {
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
<< std::endl;
return HasHealthIF::HEALTHY;
}
}
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) { ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
if(healthHelperActive) {
healthHelper.setHealth(health); healthHelper.setHealth(health);
}
else {
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
<< std::endl;
}
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -1391,18 +1366,6 @@ LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() {
return &hkManager; return &hkManager;
} }
ReturnValue_t DeviceHandlerBase::addDataSet(sid_t sid) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::removeDataSet(sid_t sid) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::changeCollectionInterval(sid_t sid,
dur_seconds_t newInterval) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() { ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
// In this function, the task handle should be valid if the task // In this function, the task handle should be valid if the task

View File

@ -108,7 +108,6 @@ public:
CookieIF * comCookie, FailureIsolationBase* fdirInstance = nullptr, CookieIF * comCookie, FailureIsolationBase* fdirInstance = nullptr,
size_t cmdQueueSize = 20); size_t cmdQueueSize = 20);
void setDeviceSwitch(uint8_t deviceSwitch);
void setHkDestination(object_id_t hkDestination); void setHkDestination(object_id_t hkDestination);
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId, void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId,
uint32_t thermalRequestPoolId); uint32_t thermalRequestPoolId);
@ -487,11 +486,6 @@ protected:
/** Get the HK manager object handle */ /** Get the HK manager object handle */
virtual LocalDataPoolManager* getHkManagerHandle() override; virtual LocalDataPoolManager* getHkManagerHandle() override;
virtual ReturnValue_t addDataSet(sid_t sid) override;
virtual ReturnValue_t removeDataSet(sid_t sid) override;
virtual ReturnValue_t changeCollectionInterval(sid_t sid,
dur_seconds_t newInterval) override;
/** /**
* @brief Hook function for child handlers which is called once per * @brief Hook function for child handlers which is called once per
* performOperation(). Default implementation is empty. * performOperation(). Default implementation is empty.
@ -610,7 +604,6 @@ protected:
/** Health helper for HasHealthIF */ /** Health helper for HasHealthIF */
HealthHelper healthHelper; HealthHelper healthHelper;
bool healthHelperActive = false;
/** Mode helper for HasModesIF */ /** Mode helper for HasModesIF */
ModeHelper modeHelper; ModeHelper modeHelper;
/** Parameter helper for ReceivesParameterMessagesIF */ /** Parameter helper for ReceivesParameterMessagesIF */
@ -1079,13 +1072,6 @@ private:
*/ */
Submode_t transitionSourceSubMode; Submode_t transitionSourceSubMode;
/**
* the switch of the device
*
* for devices using two switches override getSwitches()
*/
uint8_t deviceSwitch;
/** /**
* read the command queue * read the command queue
*/ */

View File

@ -39,10 +39,19 @@ void HealthHelper::setParentQeueue(MessageQueueId_t parentQueue) {
ReturnValue_t HealthHelper::initialize() { ReturnValue_t HealthHelper::initialize() {
healthTable = objectManager->get<HealthTableIF>(objects::HEALTH_TABLE); healthTable = objectManager->get<HealthTableIF>(objects::HEALTH_TABLE);
eventSender = objectManager->get<EventReportingProxyIF>(objectId); eventSender = objectManager->get<EventReportingProxyIF>(objectId);
// TODO: Better returnvalues
if ((healthTable == NULL) || eventSender == NULL) { if (healthTable == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; sif::error << "HealthHelper::initialize: Health table object needs"
"to be created in factory." << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
} }
if(eventSender == nullptr) {
sif::error << "HealthHelper::initialize: Owner has to implement "
"ReportingProxyIF." << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
ReturnValue_t result = healthTable->registerObject(objectId, ReturnValue_t result = healthTable->registerObject(objectId,
HasHealthIF::HEALTHY); HasHealthIF::HEALTHY);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {