hk messages are cleared properly now

This commit is contained in:
Robin Müller 2020-09-28 22:46:18 +02:00
parent 7e9d095ed1
commit 1d972fcbef
3 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include "HousekeepingMessage.h" #include "HousekeepingMessage.h"
#include <cstring> #include <cstring>
@ -140,3 +141,21 @@ void HousekeepingMessage::setDiagnosticsStuctureReportReply(
setSid(reply, sid); setSid(reply, sid);
reply->setParameter3(storeId.raw); 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<StorageManagerIF>(
objects::IPC_STORE);
if (ipcStore != nullptr) {
ipcStore->deleteData(storeId);
}
}
}
message->setCommand(CommandMessage::CMD_NONE);
}

View File

@ -142,6 +142,7 @@ public:
static sid_t getCollectionIntervalModificationCommand( static sid_t getCollectionIntervalModificationCommand(
const CommandMessage* command, float* newCollectionInterval); const CommandMessage* command, float* newCollectionInterval);
static void clear(CommandMessage* message);
private: private:
static void setSid(CommandMessage* message, sid_t sid); static void setSid(CommandMessage* message, sid_t sid);
}; };

View File

@ -1,4 +1,4 @@
#include "../ipc/CommandMessageCleaner.h" #include "CommandMessageCleaner.h"
#include "../devicehandlers/DeviceHandlerMessage.h" #include "../devicehandlers/DeviceHandlerMessage.h"
#include "../health/HealthMessage.h" #include "../health/HealthMessage.h"
@ -7,6 +7,7 @@
#include "../monitoring/MonitoringMessage.h" #include "../monitoring/MonitoringMessage.h"
#include "../subsystem/modes/ModeSequenceMessage.h" #include "../subsystem/modes/ModeSequenceMessage.h"
#include "../tmstorage/TmStoreMessage.h" #include "../tmstorage/TmStoreMessage.h"
#include "../housekeeping/HousekeepingMessage.h"
#include "../parameters/ParameterMessage.h" #include "../parameters/ParameterMessage.h"
void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) {
@ -38,6 +39,9 @@ void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) {
case messagetypes::PARAMETER: case messagetypes::PARAMETER:
ParameterMessage::clear(message); ParameterMessage::clear(message);
break; break;
case messagetypes::HOUSEKEEPING:
HousekeepingMessage::clear(message);
break;
default: default:
messagetypes::clearMissionMessage(message); messagetypes::clearMissionMessage(message);
break; break;