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 "../datapoollocal/LocalPoolVariable.h"
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
object_id_t DeviceHandlerBase::rawDataReceiverId = 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(
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId) {
gp_id_t thermalStatePoolId, gp_id_t thermalRequestPoolId) {
this->deviceThermalRequestPoolId = thermalStatePoolId;
this->deviceThermalRequestPoolId = thermalRequestPoolId;
}
@ -211,15 +212,15 @@ ReturnValue_t DeviceHandlerBase::initialize() {
fillCommandAndReplyMap();
//Set temperature target state to NON_OP.
GlobDataSet mySet;
gp_uint8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
PoolVariableIF::VAR_WRITE);
mySet.read();
LocalPoolVar<int8_t> thermalRequest(deviceThermalRequestPoolId, nullptr,
pool_rwm_t::VAR_WRITE);
ReturnValue_t result = thermalRequest.read();
if(result == HasReturnvaluesIF::RETURN_OK) {
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
mySet.commit(PoolVariableIF::VALID);
thermalRequest.commit(PoolVariableIF::VALID);
}
return RETURN_OK;
}
void DeviceHandlerBase::decrementDeviceReplyMap() {
@ -508,14 +509,18 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
Clock::getUptime(&timeoutStart);
if (mode == MODE_OFF) {
GlobDataSet mySet;
gp_uint8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
PoolVariableIF::VAR_READ_WRITE);
mySet.read();
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
LocalPoolVar<uint8_t> heaterRequest(deviceThermalRequestPoolId,
nullptr, PoolVariableIF::VAR_READ_WRITE);
ReturnValue_t result = heaterRequest.read();
if(heaterRequest == HasReturnvaluesIF::RETURN_OK) {
if (heaterRequest.value !=
ThermalComponentIF::STATE_REQUEST_IGNORE) {
heaterRequest.value = ThermalComponentIF::
STATE_REQUEST_NON_OPERATIONAL;
}
mySet.commit(PoolVariableIF::VALID);
heaterRequest.commit(PoolVariableIF::VALID);
}
}
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::setTaskIF(PeriodicTaskIF* task_){
executingTask = task_;
void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task){
executingTask = task;
}
// Default implementations empty.

View File

@ -103,8 +103,8 @@ public:
size_t cmdQueueSize = 20);
void setHkDestination(object_id_t hkDestination);
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId,
uint32_t thermalRequestPoolId);
void setThermalStateRequestPoolIds(gp_id_t thermalStatePoolId,
gp_id_t thermalRequestPoolId);
/**
* @brief Helper function to ease device handler development.
* 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
*/
uint32_t deviceThermalStatePoolId = PoolVariableIF::NO_PARAMETER;
gp_id_t deviceThermalStatePoolId;
/**
* this is the datapool variable with the thermal request of the device
*
* 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