reverted some changes
This commit is contained in:
parent
edf33cc10a
commit
bdd7d59d82
@ -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) {
|
||||||
@ -667,12 +667,11 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to distinguish here, because a raw command never expects a reply.
|
//We need to distinguish here, because a raw command never expects a reply.
|
||||||
// This could be done in the #enableReplyInReplyMap call,
|
//(Could be done in eRIRM, but then child implementations need to be careful.
|
||||||
// but then child implementations would need to be careful.
|
|
||||||
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
||||||
} else if (result != NO_REPLY_EXPECTED) {
|
} else {
|
||||||
// always generate a failure event, so that FDIR knows what's up
|
//always generate a failure event, so that FDIR knows what's up
|
||||||
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result,
|
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result,
|
||||||
cookieInfo.pendingCommand->first);
|
cookieInfo.pendingCommand->first);
|
||||||
}
|
}
|
||||||
@ -1308,24 +1307,19 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId);
|
DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId);
|
||||||
MessageQueueId_t previousReplyRecipient = iter->second.sendReplyTo;
|
|
||||||
if (iter == deviceCommandMap.end()) {
|
if (iter == deviceCommandMap.end()) {
|
||||||
result = COMMAND_NOT_SUPPORTED;
|
result = COMMAND_NOT_SUPPORTED;
|
||||||
} else if (iter->second.isExecuting) {
|
} else if (iter->second.isExecuting) {
|
||||||
result = COMMAND_ALREADY_SENT;
|
result = COMMAND_ALREADY_SENT;
|
||||||
} else {
|
} else {
|
||||||
// Set this so it can be used to finish a command immediately
|
|
||||||
iter->second.sendReplyTo = commandedBy;
|
|
||||||
result = buildCommandFromCommand(actionId, data, size);
|
result = buildCommandFromCommand(actionId, data, size);
|
||||||
}
|
}
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
|
iter->second.sendReplyTo = commandedBy;
|
||||||
iter->second.isExecuting = true;
|
iter->second.isExecuting = true;
|
||||||
cookieInfo.pendingCommand = iter;
|
cookieInfo.pendingCommand = iter;
|
||||||
cookieInfo.state = COOKIE_WRITE_READY;
|
cookieInfo.state = COOKIE_WRITE_READY;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
iter->second.sendReplyTo = previousReplyRecipient;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1592,11 +1586,3 @@ MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyI
|
|||||||
}
|
}
|
||||||
return commandIter->second.sendReplyTo;
|
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 "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>
|
||||||
|
|
||||||
@ -327,20 +327,15 @@ protected:
|
|||||||
* The existence of the command in the command map and the command size check against 0 are
|
* The existence of the command in the command map and the command size check against 0 are
|
||||||
* done by the base class.
|
* 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 deviceCommand The command to build, already checked against deviceCommandMap
|
||||||
* @param commandData Pointer to the data from the direct command
|
* @param commandData Pointer to the data from the direct command
|
||||||
* @param commandDataLen Length of commandData
|
* @param commandDataLen Length of commandData
|
||||||
* @return
|
* @return
|
||||||
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
||||||
* have been set.
|
* 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
|
* - Anything else triggers an event with the return code as a parameter as well as a
|
||||||
* step reply failed with the return code
|
* step reply failed with the return code
|
||||||
*/
|
*/
|
||||||
@ -405,8 +400,6 @@ 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 getCommanderQueueId(DeviceCommandId_t replyId) const;
|
MessageQueueId_t getCommanderQueueId(DeviceCommandId_t replyId) const;
|
||||||
void finishCommandExecution(DeviceCommandId_t replyId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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