added report status toggler

This commit is contained in:
Robin Müller 2020-09-11 14:06:08 +02:00
parent 71125c075a
commit f9612afe06
3 changed files with 30 additions and 15 deletions

View File

@ -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());

View File

@ -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));
}

View File

@ -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,