Update FSFW #24
@ -461,7 +461,7 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){
|
||||
return iter->second.replyLen;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
||||
@ -612,15 +612,15 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
|
||||
}
|
||||
DeviceCommandInfo* info = &replyInfo.command->second;
|
||||
if (info == nullptr){
|
||||
printWarningOrError(sif::OutputTypes::OUT_ERROR,
|
||||
"replyToReply", HasReturnvaluesIF::RETURN_FAILED,
|
||||
"Command pointer not found");
|
||||
return;
|
||||
printWarningOrError(sif::OutputTypes::OUT_ERROR,
|
||||
"replyToReply", HasReturnvaluesIF::RETURN_FAILED,
|
||||
"Command pointer not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if (info->expectedReplies > 0){
|
||||
// Check before to avoid underflow
|
||||
info->expectedReplies--;
|
||||
// Check before to avoid underflow
|
||||
info->expectedReplies--;
|
||||
}
|
||||
// Check if more replies are expected. If so, do nothing.
|
||||
if (info->expectedReplies == 0) {
|
||||
@ -667,12 +667,11 @@ void DeviceHandlerBase::doGetWrite() {
|
||||
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
||||
}
|
||||
|
||||
// We need to distinguish here, because a raw command never expects a reply.
|
||||
// This could be done in the #enableReplyInReplyMap call,
|
||||
// but then child implementations would need to be careful.
|
||||
//We need to distinguish here, because a raw command never expects a reply.
|
||||
//(Could be done in eRIRM, but then child implementations need to be careful.
|
||||
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
||||
} else if (result != NO_REPLY_EXPECTED) {
|
||||
// always generate a failure event, so that FDIR knows what's up
|
||||
} else {
|
||||
//always generate a failure event, so that FDIR knows what's up
|
||||
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result,
|
||||
cookieInfo.pendingCommand->first);
|
||||
}
|
||||
@ -1308,24 +1307,19 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId,
|
||||
return result;
|
||||
}
|
||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId);
|
||||
MessageQueueId_t previousReplyRecipient = iter->second.sendReplyTo;
|
||||
if (iter == deviceCommandMap.end()) {
|
||||
result = COMMAND_NOT_SUPPORTED;
|
||||
} else if (iter->second.isExecuting) {
|
||||
result = COMMAND_ALREADY_SENT;
|
||||
} else {
|
||||
// Set this so it can be used to finish a command immediately
|
||||
iter->second.sendReplyTo = commandedBy;
|
||||
result = buildCommandFromCommand(actionId, data, size);
|
||||
}
|
||||
if (result == RETURN_OK) {
|
||||
iter->second.sendReplyTo = commandedBy;
|
||||
iter->second.isExecuting = true;
|
||||
cookieInfo.pendingCommand = iter;
|
||||
cookieInfo.state = COOKIE_WRITE_READY;
|
||||
}
|
||||
else {
|
||||
iter->second.sendReplyTo = previousReplyRecipient;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1592,11 +1586,3 @@ MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyI
|
||||
}
|
||||
return commandIter->second.sendReplyTo;
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::finishCommandExecution(DeviceCommandId_t replyId) {
|
||||
auto commandIter = deviceCommandMap.find(replyId);
|
||||
if(commandIter == deviceCommandMap.end()) {
|
||||
return;
|
||||
}
|
||||
commandIter->second.isExecuting = false;
|
||||
}
|
||||
|
@ -6,22 +6,22 @@
|
||||
#include "DeviceHandlerFailureIsolation.h"
|
||||
#include "DeviceHandlerThermalSet.h"
|
||||
|
||||
#include "../serviceinterface/ServiceInterface.h"
|
||||
#include "../serviceinterface/serviceInterfaceDefintions.h"
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../tasks/ExecutableObjectIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../action/HasActionsIF.h"
|
||||
#include "../datapool/PoolVariableIF.h"
|
||||
#include "../modes/HasModesIF.h"
|
||||
#include "../power/PowerSwitchIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
#include "../tasks/PeriodicTaskIF.h"
|
||||
#include "../action/ActionHelper.h"
|
||||
#include "../health/HealthHelper.h"
|
||||
#include "../parameters/ParameterHelper.h"
|
||||
#include "../datapoollocal/HasLocalDataPoolIF.h"
|
||||
#include "../datapoollocal/LocalDataPoolManager.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/datapool/PoolVariableIF.h"
|
||||
#include "fsfw/modes/HasModesIF.h"
|
||||
#include "fsfw/power/PowerSwitchIF.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||
#include "fsfw/action/ActionHelper.h"
|
||||
#include "fsfw/health/HealthHelper.h"
|
||||
#include "fsfw/parameters/ParameterHelper.h"
|
||||
#include "fsfw/datapoollocal/HasLocalDataPoolIF.h"
|
||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -327,20 +327,15 @@ protected:
|
||||
* The existence of the command in the command map and the command size check against 0 are
|
||||
* done by the base class.
|
||||
*
|
||||
* The base class will generate a finish reply or a step automatically as long as the
|
||||
* send success is confirmed in the #getSendSuccess function call of the communication
|
||||
* interface. NO_REPLY_EXPECTED should be returned for a finish reply, RETURN_OK should be
|
||||
* returned for a step reply and everything else will trigger a step failure.
|
||||
*
|
||||
* If the commander ID is required for generating a finish reply immediately, it can be
|
||||
* retrieved using the #getCommanderQueueId function.
|
||||
*
|
||||
* @param deviceCommand The command to build, already checked against deviceCommandMap
|
||||
* @param commandData Pointer to the data from the direct command
|
||||
* @param commandDataLen Length of commandData
|
||||
* @return
|
||||
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
||||
* have been set.
|
||||
* - @c HasActionsIF::EXECUTION_COMPLETE to generate a finish reply immediately. This can
|
||||
* be used if no reply is expected. Otherwise, the developer can call #actionHelper.finish
|
||||
* to finish the command handling.
|
||||
* - Anything else triggers an event with the return code as a parameter as well as a
|
||||
* step reply failed with the return code
|
||||
*/
|
||||
@ -405,8 +400,6 @@ protected:
|
||||
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) = 0;
|
||||
MessageQueueId_t getCommanderQueueId(DeviceCommandId_t replyId) const;
|
||||
void finishCommandExecution(DeviceCommandId_t replyId);
|
||||
|
||||
/**
|
||||
* Helper function to get pending command. This is useful for devices
|
||||
* like SPI sensors to identify the last sent command.
|
||||
|
Loading…
Reference in New Issue
Block a user