From 6fd39dfac38da3c825f14b8171e05ef961dcb96c Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 26 Sep 2020 15:27:06 +0200 Subject: [PATCH] set struct reporting continued --- datapoollocal/LocalDataPoolManager.cpp | 12 ++++++++++++ housekeeping/HousekeepingMessage.cpp | 14 ++++++++++++++ housekeeping/HousekeepingMessage.h | 6 ++++++ power/PowerComponentIF.h | 5 ++--- power/PowerSwitcher.cpp | 3 ++- 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 635fafce..553d2ec1 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -392,5 +392,17 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, sif::error << "HousekeepingManager::generateSetStructurePacket: " "Expected size is not equal to serialized size" << std::endl; } + + CommandMessage reply; + if(isDiagnostics) { + HousekeepingMessage::setDiagnosticsStuctureReportReply(&reply, + sid, storeId); + } + else { + HousekeepingMessage::setHkStuctureReportReply(&reply, + sid, storeId); + } + + hkQueue->reply(&reply); return result; } diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index 25475072..706bd273 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -126,3 +126,17 @@ sid_t HousekeepingMessage::getSid(const CommandMessage* message) { void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) { std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); } + +void HousekeepingMessage::setHkStuctureReportReply(CommandMessage *reply, + sid_t sid, store_address_t storeId) { + reply->setCommand(HK_DEFINITIONS_REPORT); + setSid(reply, sid); + reply->setParameter3(storeId.raw); +} + +void HousekeepingMessage::setDiagnosticsStuctureReportReply( + CommandMessage *reply, sid_t sid, store_address_t storeId) { + reply->setCommand(DIAGNOSTICS_DEFINITION_REPORT); + setSid(reply, sid); + reply->setParameter3(storeId.raw); +} diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index 5c1b4e55..af89dade 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -121,6 +121,12 @@ public: static void setHkRequestSuccessReply(CommandMessage* reply, sid_t sid); static void setHkRequestFailureReply(CommandMessage* reply, sid_t sid, ReturnValue_t error); + + static void setHkStuctureReportReply(CommandMessage* reply, + sid_t sid, store_address_t storeId); + static void setDiagnosticsStuctureReportReply(CommandMessage* reply, + sid_t sid, store_address_t storeId); + static sid_t getHkRequestFailureReply(const CommandMessage* reply, ReturnValue_t* error); diff --git a/power/PowerComponentIF.h b/power/PowerComponentIF.h index 58f27b6c..f35b4d1d 100644 --- a/power/PowerComponentIF.h +++ b/power/PowerComponentIF.h @@ -3,12 +3,11 @@ #include "../serialize/SerializeIF.h" #include "../parameters/HasParametersIF.h" +#include "../objectmanager/SystemObjectIF.h" class PowerComponentIF : public SerializeIF, public HasParametersIF { public: - virtual ~PowerComponentIF() { - - } + virtual ~PowerComponentIF() {} virtual object_id_t getDeviceObjectId() = 0; diff --git a/power/PowerSwitcher.cpp b/power/PowerSwitcher.cpp index a9ada457..ed37998e 100644 --- a/power/PowerSwitcher.cpp +++ b/power/PowerSwitcher.cpp @@ -23,7 +23,7 @@ ReturnValue_t PowerSwitcher::getStateOfSwitches() { switch (result) { case ONE_SWITCH: return power->getSwitchState(firstSwitch); - case TWO_SWITCHES: + case TWO_SWITCHES: { ReturnValue_t firstSwitchState = power->getSwitchState(firstSwitch); ReturnValue_t secondSwitchState = power->getSwitchState(firstSwitch); if ((firstSwitchState == PowerSwitchIF::SWITCH_ON) @@ -37,6 +37,7 @@ ReturnValue_t PowerSwitcher::getStateOfSwitches() { else { return HasReturnvaluesIF::RETURN_FAILED; } + } default: return HasReturnvaluesIF::RETURN_FAILED; }