From 1d972fcbef9e935121ad5a168ec1f5f6f2c8619d Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 28 Sep 2020 22:46:18 +0200 Subject: [PATCH] hk messages are cleared properly now --- housekeeping/HousekeepingMessage.cpp | 19 +++++++++++++++++++ housekeeping/HousekeepingMessage.h | 1 + ipc/CommandMessageCleaner.cpp | 6 +++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index 706bd273..7c3e04f7 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -1,3 +1,4 @@ +#include #include "HousekeepingMessage.h" #include @@ -140,3 +141,21 @@ void HousekeepingMessage::setDiagnosticsStuctureReportReply( setSid(reply, sid); reply->setParameter3(storeId.raw); } + +void HousekeepingMessage::clear(CommandMessage* message) { + switch(message->getCommand()) { + case(HK_REPORT): + case(DIAGNOSTICS_REPORT): + case(HK_DEFINITIONS_REPORT): + case(DIAGNOSTICS_DEFINITION_REPORT): { + store_address_t storeId; + getHkDataReply(message, &storeId); + StorageManagerIF *ipcStore = objectManager->get( + objects::IPC_STORE); + if (ipcStore != nullptr) { + ipcStore->deleteData(storeId); + } + } + } + message->setCommand(CommandMessage::CMD_NONE); +} diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index af89dade..f276e263 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -142,6 +142,7 @@ public: static sid_t getCollectionIntervalModificationCommand( const CommandMessage* command, float* newCollectionInterval); + static void clear(CommandMessage* message); private: static void setSid(CommandMessage* message, sid_t sid); }; diff --git a/ipc/CommandMessageCleaner.cpp b/ipc/CommandMessageCleaner.cpp index 6a99b4d2..fa03a9a3 100644 --- a/ipc/CommandMessageCleaner.cpp +++ b/ipc/CommandMessageCleaner.cpp @@ -1,4 +1,4 @@ -#include "../ipc/CommandMessageCleaner.h" +#include "CommandMessageCleaner.h" #include "../devicehandlers/DeviceHandlerMessage.h" #include "../health/HealthMessage.h" @@ -7,6 +7,7 @@ #include "../monitoring/MonitoringMessage.h" #include "../subsystem/modes/ModeSequenceMessage.h" #include "../tmstorage/TmStoreMessage.h" +#include "../housekeeping/HousekeepingMessage.h" #include "../parameters/ParameterMessage.h" void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { @@ -38,6 +39,9 @@ void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { case messagetypes::PARAMETER: ParameterMessage::clear(message); break; + case messagetypes::HOUSEKEEPING: + HousekeepingMessage::clear(message); + break; default: messagetypes::clearMissionMessage(message); break;