diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index 28557916..705b692b 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -155,7 +155,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, result = queueToUse->sendMessage(reportTo, &reply); } - if (result != HasReturnvaluesIF::RETURN_OK){ + if (result != HasReturnvaluesIF::RETURN_OK) { ipcStore->deleteData(storeAddress); } return result; diff --git a/action/ActionHelper.h b/action/ActionHelper.h index a91722f3..d379e716 100644 --- a/action/ActionHelper.h +++ b/action/ActionHelper.h @@ -99,7 +99,7 @@ public: */ void setQueueToUse(MessageQueueIF *queue); protected: - //!< Increase of value of this per step + //! Increase of value of this per step static const uint8_t STEP_OFFSET = 1; HasActionsIF* owner;//!< Pointer to the owner //! Queue to be used as response sender, has to be set in ctor or with diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index ed5c8bda..ed5c1fa7 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1203,7 +1203,7 @@ ReturnValue_t DeviceHandlerBase::letChildHandleMessage( } void DeviceHandlerBase::handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, - bool forceDirectTm = false) { + bool forceDirectTm) { if(dataSet == nullptr) { return; } @@ -1224,7 +1224,7 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t r actionHelper.reportData(queueId, replyId, dataSet); } - //This check should make sure we get any TM but don't get anything doubled. + /* This check should make sure we get any TM but don't get anything doubled. */ if (wiretappingMode == TM && (requestedRawTraffic != queueId)) { DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet); actionHelper.reportData(requestedRawTraffic, replyId, &wrapper); @@ -1246,9 +1246,14 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t r if (wiretappingMode == TM) { actionHelper.reportData(requestedRawTraffic, replyId, &wrapper); } - else if (forceDirectTm and defaultRawReceiver != - MessageQueueIF::NO_QUEUE) + if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) { +// sid_t setSid = sid_t(this->getObjectId(), replyId); +// LocalPoolDataSetBase* dataset = getDataSetHandle(setSid); +// if(dataset != nullptr) { +// poolManager.generateHousekeepingPacket(setSid, dataset, true); +// } + // hiding of sender needed so the service will handle it as // unexpected Data, no matter what state (progress or completed) // it is in @@ -1527,3 +1532,11 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() { return &poolManager; } + +MessageQueueId_t DeviceHandlerBase::getCommanderId(DeviceCommandId_t replyId) const { + auto commandIter = deviceCommandMap.find(replyId); + if(commandIter == deviceCommandMap.end()) { + return MessageQueueIF::NO_QUEUE; + } + return commandIter->second.sendReplyTo; +} diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 52ec665f..92dc9201 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -189,6 +189,38 @@ public: /** Destructor. */ virtual ~DeviceHandlerBase(); + + /** + * Implementation of ExecutableObjectIF function + * Used to setup the reference of the task, that executes this component + * @param task_ Pointer to the taskIF of this task + */ + virtual void setTaskIF(PeriodicTaskIF* task_) override; + virtual MessageQueueId_t getCommandQueue(void) const override; + + /** Explicit interface implementation of getObjectId */ + virtual object_id_t getObjectId() const override; + + /** + * @param parentQueueId + */ + virtual void setParentQueue(MessageQueueId_t parentQueueId); + + /** @brief Implementation required for HasActionIF */ + ReturnValue_t executeAction(ActionId_t actionId, + MessageQueueId_t commandedBy, const uint8_t* data, + size_t size) override; + + Mode_t getTransitionSourceMode() const; + Submode_t getTransitionSourceSubMode() const; + virtual void getMode(Mode_t *mode, Submode_t *submode); + HealthState getHealth(); + ReturnValue_t setHealth(HealthState health); + virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId, + ParameterWrapper *parameterWrapper, + const ParameterWrapper *newValues, uint16_t startAtIndex) override; + + protected: /** * @brief This is used to let the child class handle the transition from @@ -535,37 +567,6 @@ protected: */ virtual void performOperationHook(); -public: - /** Explicit interface implementation of getObjectId */ - virtual object_id_t getObjectId() const override; - - /** - * @param parentQueueId - */ - virtual void setParentQueue(MessageQueueId_t parentQueueId); - - /** @brief Implementation required for HasActionIF */ - ReturnValue_t executeAction(ActionId_t actionId, - MessageQueueId_t commandedBy, const uint8_t* data, - size_t size) override; - - Mode_t getTransitionSourceMode() const; - Submode_t getTransitionSourceSubMode() const; - virtual void getMode(Mode_t *mode, Submode_t *submode); - HealthState getHealth(); - ReturnValue_t setHealth(HealthState health); - virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId, - ParameterWrapper *parameterWrapper, - const ParameterWrapper *newValues, uint16_t startAtIndex) override; - /** - * Implementation of ExecutableObjectIF function - * - * Used to setup the reference of the task, that executes this component - * @param task_ Pointer to the taskIF of this task - */ - virtual void setTaskIF(PeriodicTaskIF* task_); - virtual MessageQueueId_t getCommandQueue(void) const; - protected: /** * The Returnvalues id of this class, required by HasReturnvaluesIF @@ -573,16 +574,16 @@ protected: static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_BASE; static const ReturnValue_t INVALID_CHANNEL = MAKE_RETURN_CODE(0xA0); - // Returnvalues for scanForReply() + /* Return codes for scanForReply */ static const ReturnValue_t APERIODIC_REPLY = MAKE_RETURN_CODE(0xB0); //!< This is used to specify for replies from a device which are not replies to requests static const ReturnValue_t IGNORE_REPLY_DATA = MAKE_RETURN_CODE(0xB1); //!< Ignore parts of the received packet static const ReturnValue_t IGNORE_FULL_PACKET = MAKE_RETURN_CODE(0xB2); //!< Ignore full received packet - // Returnvalues for command building + /* Return codes for command building */ static const ReturnValue_t NOTHING_TO_SEND = MAKE_RETURN_CODE(0xC0); //!< Return this if no command sending in required static const ReturnValue_t COMMAND_MAP_ERROR = MAKE_RETURN_CODE(0xC2); - // Returnvalues for getSwitches() + // Return codes for getSwitches */ static const ReturnValue_t NO_SWITCH = MAKE_RETURN_CODE(0xD0); - // Mode handling error Codes + /* Mode handling error Codes */ static const ReturnValue_t CHILD_TIMEOUT = MAKE_RETURN_CODE(0xE0); static const ReturnValue_t SWITCH_FAILED = MAKE_RETURN_CODE(0xE1); @@ -769,6 +770,8 @@ protected: */ virtual void setNormalDatapoolEntriesInvalid(); + MessageQueueId_t getCommanderId(DeviceCommandId_t replyId) const; + /** * Helper function to get pending command. This is useful for devices * like SPI sensors to identify the last sent command. @@ -1003,8 +1006,8 @@ protected: void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false); - void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId, - bool forceDirectTm); +// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId, +// bool forceDirectTm); virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t *msToReachTheMode); @@ -1070,6 +1073,7 @@ protected: * @param onOff on == @c SWITCH_ON; off != @c SWITCH_ON */ void commandSwitch(ReturnValue_t onOff); + private: /** diff --git a/pus/Service8FunctionManagement.cpp b/pus/Service8FunctionManagement.cpp index e389b0b9..a2202abc 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/pus/Service8FunctionManagement.cpp @@ -104,13 +104,14 @@ ReturnValue_t Service8FunctionManagement::handleReply( break; } case ActionMessage::DATA_REPLY: { + /* Multiple data replies are possible, so declare data reply as step */ *isStep = true; result = handleDataReply(reply, objectId, actionId); break; } case ActionMessage::STEP_FAILED: *isStep = true; - /*No break, falls through*/ + /* No break, falls through */ case ActionMessage::COMPLETION_FAILED: result = ActionMessage::getReturnCode(reply); break;