Some changes and improvements for DHB
1. Renamed getCommanderId to getCommanderQueueId. 2. Some indentation 3. Correct preprocessor define for warning printout used now
This commit is contained in:
parent
23c562bb67
commit
21b5eaa891
@ -461,7 +461,7 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){
|
|||||||
return iter->second.replyLen;
|
return iter->second.replyLen;
|
||||||
}else{
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
||||||
@ -612,15 +612,15 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
|
|||||||
}
|
}
|
||||||
DeviceCommandInfo* info = &replyInfo.command->second;
|
DeviceCommandInfo* info = &replyInfo.command->second;
|
||||||
if (info == nullptr){
|
if (info == nullptr){
|
||||||
printWarningOrError(sif::OutputTypes::OUT_ERROR,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR,
|
||||||
"replyToReply", HasReturnvaluesIF::RETURN_FAILED,
|
"replyToReply", HasReturnvaluesIF::RETURN_FAILED,
|
||||||
"Command pointer not found");
|
"Command pointer not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->expectedReplies > 0){
|
if (info->expectedReplies > 0){
|
||||||
// Check before to avoid underflow
|
// Check before to avoid underflow
|
||||||
info->expectedReplies--;
|
info->expectedReplies--;
|
||||||
}
|
}
|
||||||
// Check if more replies are expected. If so, do nothing.
|
// Check if more replies are expected. If so, do nothing.
|
||||||
if (info->expectedReplies == 0) {
|
if (info->expectedReplies == 0) {
|
||||||
@ -1355,10 +1355,20 @@ void DeviceHandlerBase::buildInternalCommand(void) {
|
|||||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(
|
DeviceCommandMap::iterator iter = deviceCommandMap.find(
|
||||||
deviceCommandId);
|
deviceCommandId);
|
||||||
if (iter == deviceCommandMap.end()) {
|
if (iter == deviceCommandMap.end()) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
char output[36];
|
||||||
|
sprintf(output, "Command 0x%08x unknown",
|
||||||
|
static_cast<unsigned int>(deviceCommandId));
|
||||||
|
// so we can track misconfigurations
|
||||||
|
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
||||||
|
"buildInternalCommand",
|
||||||
|
COMMAND_NOT_SUPPORTED,
|
||||||
|
output);
|
||||||
|
#endif
|
||||||
result = COMMAND_NOT_SUPPORTED;
|
result = COMMAND_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
else if (iter->second.isExecuting) {
|
else if (iter->second.isExecuting) {
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
char output[36];
|
char output[36];
|
||||||
sprintf(output, "Command 0x%08x is executing",
|
sprintf(output, "Command 0x%08x is executing",
|
||||||
static_cast<unsigned int>(deviceCommandId));
|
static_cast<unsigned int>(deviceCommandId));
|
||||||
@ -1569,7 +1579,7 @@ LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() {
|
|||||||
return &poolManager;
|
return &poolManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t DeviceHandlerBase::getCommanderId(DeviceCommandId_t replyId) const {
|
MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyId) const {
|
||||||
auto commandIter = deviceCommandMap.find(replyId);
|
auto commandIter = deviceCommandMap.find(replyId);
|
||||||
if(commandIter == deviceCommandMap.end()) {
|
if(commandIter == deviceCommandMap.end()) {
|
||||||
return MessageQueueIF::NO_QUEUE;
|
return MessageQueueIF::NO_QUEUE;
|
||||||
|
@ -6,22 +6,22 @@
|
|||||||
#include "DeviceHandlerFailureIsolation.h"
|
#include "DeviceHandlerFailureIsolation.h"
|
||||||
#include "DeviceHandlerThermalSet.h"
|
#include "DeviceHandlerThermalSet.h"
|
||||||
|
|
||||||
#include "../serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "../serviceinterface/serviceInterfaceDefintions.h"
|
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||||
#include "../objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "../tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "../action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "../datapool/PoolVariableIF.h"
|
#include "fsfw/datapool/PoolVariableIF.h"
|
||||||
#include "../modes/HasModesIF.h"
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
#include "../power/PowerSwitchIF.h"
|
#include "fsfw/power/PowerSwitchIF.h"
|
||||||
#include "../ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "../tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "../action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "../health/HealthHelper.h"
|
#include "fsfw/health/HealthHelper.h"
|
||||||
#include "../parameters/ParameterHelper.h"
|
#include "fsfw/parameters/ParameterHelper.h"
|
||||||
#include "../datapoollocal/HasLocalDataPoolIF.h"
|
#include "fsfw/datapoollocal/HasLocalDataPoolIF.h"
|
||||||
#include "../datapoollocal/LocalDataPoolManager.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) = 0;
|
const uint8_t *packet) = 0;
|
||||||
MessageQueueId_t getCommanderId(DeviceCommandId_t replyId) const;
|
MessageQueueId_t getCommanderQueueId(DeviceCommandId_t replyId) const;
|
||||||
/**
|
/**
|
||||||
* Helper function to get pending command. This is useful for devices
|
* Helper function to get pending command. This is useful for devices
|
||||||
* like SPI sensors to identify the last sent command.
|
* like SPI sensors to identify the last sent command.
|
||||||
|
Loading…
Reference in New Issue
Block a user