diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index f33cd8ab..c97bbfd2 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -140,11 +140,6 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage( CommandMessage* message) { Command_t command = message->getCommand(); switch(command) { - // I think those are the only commands which can be handled here.. - case(HousekeepingMessage::ADD_HK_REPORT_STRUCT): - case(HousekeepingMessage::ADD_DIAGNOSTICS_REPORT_STRUCT): - // We should use OwnsLocalPoolDataIF to specify those functions.. - return HasReturnvaluesIF::RETURN_OK; case(HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): case(HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): //return generateSetStructurePacket(message->getSid()); diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index e354f8ff..f96f4d34 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -27,6 +27,29 @@ sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message, return getSid(message); } +void HousekeepingMessage::setToggleReportingMessage(CommandMessage *message, + sid_t sid, bool enableReporting, bool isDiagnostics) { + if(isDiagnostics) { + if(enableReporting) { + message->setCommand(ENABLE_PERIODIC_DIAGNOSTICS_GENERATION); + } + else { + message->setCommand(DISABLE_PERIODIC_DIAGNOSTICS_GENERATION); + } + } + else { + if(enableReporting) { + message->setCommand(ENABLE_PERIODIC_HK_GENERATION); + } + else { + message->setCommand(DISABLE_PERIODIC_HK_REPORT_GENERATION); + } + } + + setSid(message, sid); +} + + sid_t HousekeepingMessage::getSid(const CommandMessage* message) { sid_t sid; std::memcpy(&sid.raw, message->getData(), sizeof(sid.raw)); @@ -36,4 +59,3 @@ sid_t HousekeepingMessage::getSid(const CommandMessage* message) { void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) { std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); } - diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index 75b31505..ab8fd7ac 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -58,15 +58,6 @@ public: static constexpr uint8_t MESSAGE_ID = messagetypes::HOUSEKEEPING; - static constexpr Command_t ADD_HK_REPORT_STRUCT = - MAKE_COMMAND_ID(1); - static constexpr Command_t ADD_DIAGNOSTICS_REPORT_STRUCT = - MAKE_COMMAND_ID(2); - - static constexpr Command_t DELETE_HK_REPORT_STRUCT = MAKE_COMMAND_ID(3); - static constexpr Command_t DELETE_DIAGNOSTICS_REPORT_STRUCT = - MAKE_COMMAND_ID(4); - static constexpr Command_t ENABLE_PERIODIC_HK_GENERATION = MAKE_COMMAND_ID(5); static constexpr Command_t DISABLE_PERIODIC_HK_REPORT_GENERATION = @@ -77,6 +68,11 @@ public: static constexpr Command_t DISABLE_PERIODIC_DIAGNOSTICS_GENERATION = MAKE_COMMAND_ID(8); + static constexpr Command_t REPORTING_TOGGLE_SUCCESS = + MAKE_COMMAND_ID(128); + static constexpr Command_t REPORTING_TOGGLE_FAILURE = + MAKE_COMMAND_ID(129); + static constexpr Command_t REPORT_HK_REPORT_STRUCTURES = MAKE_COMMAND_ID(9); static constexpr Command_t REPORT_DIAGNOSTICS_REPORT_STRUCTURES = MAKE_COMMAND_ID(11); @@ -104,6 +100,8 @@ public: static sid_t getSid(const CommandMessage* message); + static void setToggleReportingMessage(CommandMessage* message, sid_t sid, + bool enableReporting, bool isDiagnostics); static void setHkReportMessage(CommandMessage* message, sid_t sid, store_address_t storeId); static void setHkDiagnosticsMessage(CommandMessage* message, sid_t sid,