replacing global pool with local pool DHB

This commit is contained in:
Robin Müller 2020-12-01 18:15:09 +01:00
parent 84ab5f8318
commit 0116bb8663
2 changed files with 26 additions and 21 deletions

View File

@ -16,6 +16,7 @@
#include <iomanip> #include <iomanip>
#include "../datapoollocal/LocalPoolVariable.h"
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
@ -56,7 +57,7 @@ void DeviceHandlerBase::setHkDestination(object_id_t hkDestination) {
} }
void DeviceHandlerBase::setThermalStateRequestPoolIds( void DeviceHandlerBase::setThermalStateRequestPoolIds(
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId) { gp_id_t thermalStatePoolId, gp_id_t thermalRequestPoolId) {
this->deviceThermalRequestPoolId = thermalStatePoolId; this->deviceThermalRequestPoolId = thermalStatePoolId;
this->deviceThermalRequestPoolId = thermalRequestPoolId; this->deviceThermalRequestPoolId = thermalRequestPoolId;
} }
@ -211,15 +212,15 @@ ReturnValue_t DeviceHandlerBase::initialize() {
fillCommandAndReplyMap(); fillCommandAndReplyMap();
//Set temperature target state to NON_OP. //Set temperature target state to NON_OP.
GlobDataSet mySet; LocalPoolVar<int8_t> thermalRequest(deviceThermalRequestPoolId, nullptr,
gp_uint8_t thermalRequest(deviceThermalRequestPoolId, &mySet, pool_rwm_t::VAR_WRITE);
PoolVariableIF::VAR_WRITE); ReturnValue_t result = thermalRequest.read();
mySet.read(); if(result == HasReturnvaluesIF::RETURN_OK) {
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL; thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
mySet.commit(PoolVariableIF::VALID); thermalRequest.commit(PoolVariableIF::VALID);
}
return RETURN_OK; return RETURN_OK;
} }
void DeviceHandlerBase::decrementDeviceReplyMap() { void DeviceHandlerBase::decrementDeviceReplyMap() {
@ -508,14 +509,18 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
Clock::getUptime(&timeoutStart); Clock::getUptime(&timeoutStart);
if (mode == MODE_OFF) { if (mode == MODE_OFF) {
GlobDataSet mySet; LocalPoolVar<uint8_t> heaterRequest(deviceThermalRequestPoolId,
gp_uint8_t thermalRequest(deviceThermalRequestPoolId, &mySet, nullptr, PoolVariableIF::VAR_READ_WRITE);
PoolVariableIF::VAR_READ_WRITE); ReturnValue_t result = heaterRequest.read();
mySet.read(); if(heaterRequest == HasReturnvaluesIF::RETURN_OK) {
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) { if (heaterRequest.value !=
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL; ThermalComponentIF::STATE_REQUEST_IGNORE) {
heaterRequest.value = ThermalComponentIF::
STATE_REQUEST_NON_OPERATIONAL;
}
heaterRequest.commit(PoolVariableIF::VALID);
} }
mySet.commit(PoolVariableIF::VALID);
} }
changeHK(mode, submode, true); changeHK(mode, submode, true);
} }
@ -1374,8 +1379,8 @@ bool DeviceHandlerBase::commandIsExecuting(DeviceCommandId_t commandId) {
void DeviceHandlerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) { void DeviceHandlerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {
} }
void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_){ void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task){
executingTask = task_; executingTask = task;
} }
// Default implementations empty. // Default implementations empty.

View File

@ -103,8 +103,8 @@ public:
size_t cmdQueueSize = 20); size_t cmdQueueSize = 20);
void setHkDestination(object_id_t hkDestination); void setHkDestination(object_id_t hkDestination);
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId, void setThermalStateRequestPoolIds(gp_id_t thermalStatePoolId,
uint32_t thermalRequestPoolId); gp_id_t thermalRequestPoolId);
/** /**
* @brief Helper function to ease device handler development. * @brief Helper function to ease device handler development.
* This will instruct the transition to MODE_ON immediately * This will instruct the transition to MODE_ON immediately
@ -699,14 +699,14 @@ protected:
* *
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking * can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
*/ */
uint32_t deviceThermalStatePoolId = PoolVariableIF::NO_PARAMETER; gp_id_t deviceThermalStatePoolId;
/** /**
* this is the datapool variable with the thermal request of the device * this is the datapool variable with the thermal request of the device
* *
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking * can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
*/ */
uint32_t deviceThermalRequestPoolId = PoolVariableIF::NO_PARAMETER; gp_id_t deviceThermalRequestPoolId;
/** /**
* Optional Error code. Can be set in doStartUp(), doShutDown() and * Optional Error code. Can be set in doStartUp(), doShutDown() and