set struct reporting continued

This commit is contained in:
Robin Müller 2020-09-26 15:27:06 +02:00
parent 08d0e09493
commit 6fd39dfac3
5 changed files with 36 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

View File

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