diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index fe55059c..1dfbe229 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -59,8 +59,7 @@ ReturnValue_t Service5EventReporting::generateEventReport( } ReturnValue_t Service5EventReporting::handleRequest(uint8_t subservice) { - switch(subservice) - { + switch(subservice) { case Subservice::ENABLE: { enableEventReport = true; return HasReturnvaluesIF::RETURN_OK; diff --git a/pus/Service8FunctionManagement.cpp b/pus/Service8FunctionManagement.cpp index 24338464..812398b9 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/pus/Service8FunctionManagement.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -54,12 +53,8 @@ ReturnValue_t Service8FunctionManagement::checkInterfaceAndAcquireMessageQueue( ReturnValue_t Service8FunctionManagement::prepareCommand( CommandMessage* message, uint8_t subservice, const uint8_t* tcData, size_t tcDataLen, uint32_t* state, object_id_t objectId) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; - if(subservice == static_cast(Subservice::DIRECT_COMMANDING)) { - result = prepareDirectCommand(dynamic_cast(message), + return prepareDirectCommand(dynamic_cast(message), tcData, tcDataLen); - } - return result; } ReturnValue_t Service8FunctionManagement::prepareDirectCommand( @@ -100,18 +95,7 @@ ReturnValue_t Service8FunctionManagement::handleReply( break; } case ActionMessage::DATA_REPLY: { - store_address_t storeId = ActionMessage::getStoreId(reply); - size_t size = 0; - const uint8_t * buffer = nullptr; - result = IPCStore->getData(storeId, &buffer, &size); - if(result != RETURN_OK) { - sif::error << "Service 8: Could not retrieve data for data reply"; - return result; - } - DataReply dataReply(objectId,actionId,buffer,size); - sendTmPacket(static_cast( - Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply); - result = IPCStore ->deleteData(storeId); + result = handleDataReply(reply, objectId, actionId); break; } case ActionMessage::STEP_FAILED: @@ -126,4 +110,26 @@ ReturnValue_t Service8FunctionManagement::handleReply( return result; } +ReturnValue_t Service8FunctionManagement::handleDataReply( + const CommandMessage* reply, object_id_t objectId, + ActionId_t actionId) { + store_address_t storeId = ActionMessage::getStoreId(reply); + size_t size = 0; + const uint8_t * buffer = nullptr; + ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size); + if(result != RETURN_OK) { + sif::error << "Service 8: Could not retrieve data for data reply" + << std::endl; + return result; + } + DataReply dataReply(objectId, actionId, buffer, size); + result = sendTmPacket(static_cast( + Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply); + auto deletionResult = IPCStore->deleteData(storeId); + if(deletionResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Service8FunctionManagement::handleReply: Deletion" + << " of data in pool failed." << std::endl; + } + return result; +} diff --git a/pus/Service8FunctionManagement.h b/pus/Service8FunctionManagement.h index 54c98b97..e2c7a84f 100644 --- a/pus/Service8FunctionManagement.h +++ b/pus/Service8FunctionManagement.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ #define FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ +#include #include /** @@ -59,6 +60,8 @@ private: MessageQueueId_t* messageQueueToSet, object_id_t* objectId); ReturnValue_t prepareDirectCommand(CommandMessage* message, const uint8_t* tcData, size_t tcDataLen); + ReturnValue_t handleDataReply(const CommandMessage* reply, + object_id_t objectId, ActionId_t actionId); }; #endif /* FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ */ diff --git a/storagemanager/StorageAccessor.h b/storagemanager/StorageAccessor.h index 4b3f1ea9..d75e06ac 100644 --- a/storagemanager/StorageAccessor.h +++ b/storagemanager/StorageAccessor.h @@ -17,21 +17,17 @@ class StorageAccessor: public ConstStorageAccessor { public: StorageAccessor(store_address_t storeId); StorageAccessor(store_address_t storeId, StorageManagerIF* store); + /** * @brief Move ctor and move assignment allow returning accessors as - * a returnvalue. They prevent resource being free prematurely. - * Refer to: https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/ - * move-constructors-and-move-assignment-operators-cpp.md + * a returnvalue. They prevent resource being freed prematurely. + * See: https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/ + * move-constructors-and-move-assignment-operators-cpp.md * @param * @return */ -<<<<<<< Updated upstream - StorageAccessor& operator= (StorageAccessor&&); - StorageAccessor (StorageAccessor&&); -======= StorageAccessor& operator=(StorageAccessor&&); StorageAccessor(StorageAccessor&&); ->>>>>>> Stashed changes ReturnValue_t write(uint8_t *data, size_t size, uint16_t offset = 0);