remove diagnostic HK

This commit is contained in:
Robin Müller 2023-08-15 18:00:37 +02:00
parent 7e1fb04f8a
commit 845f040f13
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
8 changed files with 47 additions and 162 deletions

View File

@ -4,9 +4,9 @@
#include <etl/list.h>
#include <etl/set.h>
#include <array>
#include <optional>
#include <utility>
#include <array>
#include "RemoteConfigTableIF.h"
#include "UserBase.h"

View File

@ -465,70 +465,37 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
ReturnValue_t result = returnvalue::OK;
switch (command) {
// Houskeeping interface handling.
case (HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): {
result = togglePeriodicGeneration(sid, true, true);
break;
}
case (HousekeepingMessage::DISABLE_PERIODIC_DIAGNOSTICS_GENERATION): {
result = togglePeriodicGeneration(sid, false, true);
break;
}
case (HousekeepingMessage::ENABLE_PERIODIC_HK_REPORT_GENERATION): {
result = togglePeriodicGeneration(sid, true, false);
result = togglePeriodicGeneration(sid, true);
break;
}
case (HousekeepingMessage::DISABLE_PERIODIC_HK_REPORT_GENERATION): {
result = togglePeriodicGeneration(sid, false, false);
break;
}
case (HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, true);
if (result == returnvalue::OK) {
return result;
}
result = togglePeriodicGeneration(sid, false);
break;
}
case (HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, false);
result = generateSetStructurePacket(sid);
if (result == returnvalue::OK) {
return result;
}
break;
}
case (HousekeepingMessage::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL):
case (HousekeepingMessage::MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL): {
float newCollIntvl = 0;
HousekeepingMessage::getCollectionIntervalModificationCommand(message, &newCollIntvl);
if (command == HousekeepingMessage::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL) {
result = changeCollectionInterval(sid, newCollIntvl);
} else {
result = changeCollectionInterval(sid, newCollIntvl);
}
break;
}
case (HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT):
case (HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
case (HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT): {
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
if (dataSet == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleHousekeepingMessage",
DATASET_NOT_FOUND);
return DATASET_NOT_FOUND;
}
if (command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT and
LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
result = WRONG_HK_PACKET_TYPE;
break;
} else if (command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT and
not LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
result = WRONG_HK_PACKET_TYPE;
break;
}
return generateHousekeepingPacket(HousekeepingMessage::getSid(message), dataSet, true);
}
@ -697,8 +664,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
}
}
ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool enable,
bool isDiagnostics) {
ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool enable) {
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
if (dataSet == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "togglePeriodicGeneration",
@ -706,11 +672,6 @@ ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool ena
return DATASET_NOT_FOUND;
}
if ((LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and not isDiagnostics) or
(not LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and isDiagnostics)) {
return WRONG_HK_PACKET_TYPE;
}
if ((LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and enable) or
(not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and not enable)) {
return returnvalue::OK;
@ -741,7 +702,7 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool isDiagnostics) {
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid) {
/* Get and check dataset first. */
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
if (dataSet == nullptr) {
@ -750,11 +711,6 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
return DATASET_NOT_FOUND;
}
bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet);
if ((targetIsDiagnostics and not isDiagnostics) or (not targetIsDiagnostics and isDiagnostics)) {
return WRONG_HK_PACKET_TYPE;
}
bool valid = dataSet->isValid();
bool reportingEnabled = LocalPoolDataSetAttorney::getReportingEnabled(*dataSet);
float collectionInterval =
@ -786,11 +742,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
// Send structure reporting reply.
CommandMessage reply;
if (isDiagnostics) {
HousekeepingMessage::setDiagnosticsStuctureReportReply(&reply, sid, storeId);
} else {
HousekeepingMessage::setHkStuctureReportReply(&reply, sid, storeId);
}
result = hkQueue->reply(&reply);
if (result != returnvalue::OK) {

View File

@ -337,8 +337,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
size_t* serializedSize);
void performPeriodicHkGeneration(HkReceiver& hkReceiver);
ReturnValue_t togglePeriodicGeneration(sid_t sid, bool enable, bool isDiagnostics);
ReturnValue_t generateSetStructurePacket(sid_t sid, bool isDiagnostics);
ReturnValue_t togglePeriodicGeneration(sid_t sid, bool enable);
ReturnValue_t generateSetStructurePacket(sid_t sid);
void handleHkUpdateResetListInsertion(DataType dataType, DataId dataId);
void handleChangeResetLogic(DataType type, DataId dataId, MarkChangedIF* toReset);

View File

@ -98,11 +98,6 @@ class ProvidesDataPoolSubscriptionIF {
virtual ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) = 0;
virtual ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) = 0;
// virtual ReturnValue_t
// subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics) {
// return subscribeForUpdatePacket(sid, reportingEnabled, isDiagnostics, objects::NO_OBJECT);
// }
[[deprecated(
"Please use the new API which takes all arguments as one wrapper "
"struct")]] virtual ReturnValue_t

View File

@ -31,55 +31,32 @@ sid_t HousekeepingMessage::getHkDataReply(const CommandMessage *message,
}
void HousekeepingMessage::setToggleReportingCommand(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 {
bool enableReporting) {
if (enableReporting) {
message->setCommand(ENABLE_PERIODIC_HK_REPORT_GENERATION);
} else {
message->setCommand(DISABLE_PERIODIC_HK_REPORT_GENERATION);
}
}
setSid(message, sid);
}
void HousekeepingMessage::setStructureReportingCommand(CommandMessage *command, sid_t sid,
bool isDiagnostics) {
if (isDiagnostics) {
command->setCommand(REPORT_DIAGNOSTICS_REPORT_STRUCTURES);
} else {
void HousekeepingMessage::setStructureReportingCommand(CommandMessage *command, sid_t sid) {
command->setCommand(REPORT_HK_REPORT_STRUCTURES);
}
setSid(command, sid);
}
void HousekeepingMessage::setOneShotReportCommand(CommandMessage *command, sid_t sid,
bool isDiagnostics) {
if (isDiagnostics) {
command->setCommand(GENERATE_ONE_DIAGNOSTICS_REPORT);
} else {
void HousekeepingMessage::setOneShotReportCommand(CommandMessage *command, sid_t sid) {
command->setCommand(GENERATE_ONE_PARAMETER_REPORT);
}
setSid(command, sid);
}
void HousekeepingMessage::setCollectionIntervalModificationCommand(CommandMessage *command,
sid_t sid,
float collectionInterval,
bool isDiagnostics) {
if (isDiagnostics) {
command->setCommand(MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL);
} else {
float collectionInterval) {
command->setCommand(MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL);
}
/* Raw storage of the float in the message. Do not use setParameter3, does
implicit conversion to integer type! */
@ -138,19 +115,11 @@ void HousekeepingMessage::setHkStuctureReportReply(CommandMessage *reply, sid_t
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);
}
void HousekeepingMessage::clear(CommandMessage *message) {
switch (message->getCommand()) {
case (HK_REPORT):
case (DIAGNOSTICS_REPORT):
case (HK_DEFINITIONS_REPORT):
case (DIAGNOSTICS_DEFINITION_REPORT):
case (UPDATE_SNAPSHOT_SET):
case (UPDATE_SNAPSHOT_VARIABLE): {
store_address_t storeId;

View File

@ -30,23 +30,16 @@ class HousekeepingMessage {
static constexpr Command_t ENABLE_PERIODIC_HK_REPORT_GENERATION = MAKE_COMMAND_ID(5);
static constexpr Command_t DISABLE_PERIODIC_HK_REPORT_GENERATION = MAKE_COMMAND_ID(6);
static constexpr Command_t ENABLE_PERIODIC_DIAGNOSTICS_GENERATION = MAKE_COMMAND_ID(7);
static constexpr Command_t DISABLE_PERIODIC_DIAGNOSTICS_GENERATION = MAKE_COMMAND_ID(8);
static constexpr Command_t REPORT_HK_REPORT_STRUCTURES = MAKE_COMMAND_ID(9);
static constexpr Command_t REPORT_DIAGNOSTICS_REPORT_STRUCTURES = MAKE_COMMAND_ID(11);
static constexpr Command_t HK_DEFINITIONS_REPORT = MAKE_COMMAND_ID(10);
static constexpr Command_t DIAGNOSTICS_DEFINITION_REPORT = MAKE_COMMAND_ID(12);
static constexpr Command_t HK_REPORT = MAKE_COMMAND_ID(25);
static constexpr Command_t DIAGNOSTICS_REPORT = MAKE_COMMAND_ID(26);
static constexpr Command_t GENERATE_ONE_PARAMETER_REPORT = MAKE_COMMAND_ID(27);
static constexpr Command_t GENERATE_ONE_DIAGNOSTICS_REPORT = MAKE_COMMAND_ID(28);
static constexpr Command_t MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL = MAKE_COMMAND_ID(31);
static constexpr Command_t MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL = MAKE_COMMAND_ID(32);
static constexpr Command_t HK_REQUEST_SUCCESS = MAKE_COMMAND_ID(128);
static constexpr Command_t HK_REQUEST_FAILURE = MAKE_COMMAND_ID(129);
@ -64,13 +57,11 @@ class HousekeepingMessage {
/* Housekeeping Interface Messages */
static void setToggleReportingCommand(CommandMessage* command, sid_t sid, bool enableReporting,
bool isDiagnostics);
static void setStructureReportingCommand(CommandMessage* command, sid_t sid, bool isDiagnostics);
static void setOneShotReportCommand(CommandMessage* command, sid_t sid, bool isDiagnostics);
static void setToggleReportingCommand(CommandMessage* command, sid_t sid, bool enableReporting);
static void setStructureReportingCommand(CommandMessage* command, sid_t sid);
static void setOneShotReportCommand(CommandMessage* command, sid_t sid);
static void setCollectionIntervalModificationCommand(CommandMessage* command, sid_t sid,
float collectionInterval,
bool isDiagnostics);
float collectionInterval);
static void setHkReportReply(CommandMessage* reply, sid_t sid, store_address_t storeId);
static void setHkDiagnosticsReply(CommandMessage* reply, sid_t sid, store_address_t storeId);
@ -79,8 +70,6 @@ class HousekeepingMessage {
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

@ -72,27 +72,15 @@ ReturnValue_t Service3Housekeeping::prepareCommand(CommandMessage* message, uint
uint32_t* state, object_id_t objectId) {
switch (static_cast<Subservice>(subservice)) {
case Subservice::ENABLE_PERIODIC_HK_REPORT_GENERATION:
return prepareReportingTogglingCommand(message, objectId, true, false, tcData, tcDataLen);
return prepareReportingTogglingCommand(message, objectId, true, tcData, tcDataLen);
case Subservice::DISABLE_PERIODIC_HK_REPORT_GENERATION:
return prepareReportingTogglingCommand(message, objectId, false, false, tcData, tcDataLen);
case Subservice::ENABLE_PERIODIC_DIAGNOSTICS_REPORT_GENERATION:
return prepareReportingTogglingCommand(message, objectId, true, true, tcData, tcDataLen);
case Subservice::DISABLE_PERIODIC_DIAGNOSTICS_REPORT_GENERATION:
return prepareReportingTogglingCommand(message, objectId, false, true, tcData, tcDataLen);
return prepareReportingTogglingCommand(message, objectId, false, tcData, tcDataLen);
case Subservice::REPORT_HK_REPORT_STRUCTURES:
return prepareStructureReportingCommand(message, objectId, false, tcData, tcDataLen);
case Subservice::REPORT_DIAGNOSTICS_REPORT_STRUCTURES:
return prepareStructureReportingCommand(message, objectId, true, tcData, tcDataLen);
return prepareStructureReportingCommand(message, objectId, tcData, tcDataLen);
case Subservice::GENERATE_ONE_PARAMETER_REPORT:
return prepareOneShotReportCommand(message, objectId, false, tcData, tcDataLen);
case Subservice::GENERATE_ONE_DIAGNOSTICS_REPORT:
return prepareOneShotReportCommand(message, objectId, true, tcData, tcDataLen);
return prepareOneShotReportCommand(message, objectId, tcData, tcDataLen);
case Subservice::MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL:
return prepareCollectionIntervalModificationCommand(message, objectId, false, tcData,
tcDataLen);
case Subservice::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL:
return prepareCollectionIntervalModificationCommand(message, objectId, true, tcData,
tcDataLen);
return prepareCollectionIntervalModificationCommand(message, objectId, tcData, tcDataLen);
case Subservice::HK_DEFINITIONS_REPORT:
case Subservice::DIAGNOSTICS_DEFINITION_REPORT:
case Subservice::HK_REPORT:
@ -106,23 +94,23 @@ ReturnValue_t Service3Housekeeping::prepareCommand(CommandMessage* message, uint
return returnvalue::OK;
}
ReturnValue_t Service3Housekeeping::prepareReportingTogglingCommand(
CommandMessage* command, object_id_t objectId, bool enableReporting, bool isDiagnostics,
const uint8_t* tcData, size_t tcDataLen) {
ReturnValue_t Service3Housekeeping::prepareReportingTogglingCommand(CommandMessage* command,
object_id_t objectId,
bool enableReporting,
const uint8_t* tcData,
size_t tcDataLen) {
if (tcDataLen < sizeof(sid_t)) {
// TC data should consist of object ID and set ID.
return CommandingServiceBase::INVALID_TC;
}
sid_t targetSid = buildSid(objectId, &tcData, &tcDataLen);
HousekeepingMessage::setToggleReportingCommand(command, targetSid, enableReporting,
isDiagnostics);
HousekeepingMessage::setToggleReportingCommand(command, targetSid, enableReporting);
return returnvalue::OK;
}
ReturnValue_t Service3Housekeeping::prepareStructureReportingCommand(CommandMessage* command,
object_id_t objectId,
bool isDiagnostics,
const uint8_t* tcData,
size_t tcDataLen) {
if (tcDataLen < sizeof(sid_t)) {
@ -131,13 +119,13 @@ ReturnValue_t Service3Housekeeping::prepareStructureReportingCommand(CommandMess
}
sid_t targetSid = buildSid(objectId, &tcData, &tcDataLen);
HousekeepingMessage::setStructureReportingCommand(command, targetSid, isDiagnostics);
HousekeepingMessage::setStructureReportingCommand(command, targetSid);
return returnvalue::OK;
}
ReturnValue_t Service3Housekeeping::prepareOneShotReportCommand(CommandMessage* command,
object_id_t objectId,
bool isDiagnostics,
const uint8_t* tcData,
size_t tcDataLen) {
if (tcDataLen < sizeof(sid_t)) {
@ -146,13 +134,12 @@ ReturnValue_t Service3Housekeeping::prepareOneShotReportCommand(CommandMessage*
}
sid_t targetSid = buildSid(objectId, &tcData, &tcDataLen);
HousekeepingMessage::setOneShotReportCommand(command, targetSid, isDiagnostics);
HousekeepingMessage::setOneShotReportCommand(command, targetSid);
return returnvalue::OK;
}
ReturnValue_t Service3Housekeeping::prepareCollectionIntervalModificationCommand(
CommandMessage* command, object_id_t objectId, bool isDiagnostics, const uint8_t* tcData,
size_t tcDataLen) {
CommandMessage* command, object_id_t objectId, const uint8_t* tcData, size_t tcDataLen) {
if (tcDataLen < sizeof(sid_t) + sizeof(float)) {
/* SID plus the size of the new collection interval. */
return CommandingServiceBase::INVALID_TC;
@ -162,8 +149,8 @@ ReturnValue_t Service3Housekeeping::prepareCollectionIntervalModificationCommand
float newCollectionInterval = 0;
SerializeAdapter::deSerialize(&newCollectionInterval, &tcData, &tcDataLen,
SerializeIF::Endianness::BIG);
HousekeepingMessage::setCollectionIntervalModificationCommand(
command, targetSid, newCollectionInterval, isDiagnostics);
HousekeepingMessage::setCollectionIntervalModificationCommand(command, targetSid,
newCollectionInterval);
return returnvalue::OK;
}
@ -194,11 +181,6 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply,
return generateHkReply(reply, static_cast<uint8_t>(Subservice::HK_DEFINITIONS_REPORT));
break;
}
case (HousekeepingMessage::DIAGNOSTICS_DEFINITION_REPORT): {
return generateHkReply(reply,
static_cast<uint8_t>(Subservice::DIAGNOSTICS_DEFINITION_REPORT));
break;
}
case (HousekeepingMessage::HK_REQUEST_SUCCESS): {
return CommandingServiceBase::EXECUTION_COMPLETE;

View File

@ -84,17 +84,15 @@ class Service3Housekeeping : public CommandingServiceBase, public AcceptsHkPacke
ReturnValue_t generateHkReply(const CommandMessage* hkMessage, uint8_t subserviceId);
ReturnValue_t prepareReportingTogglingCommand(CommandMessage* command, object_id_t objectId,
bool enableReporting, bool isDiagnostics,
const uint8_t* tcData, size_t tcDataLen);
bool enableReporting, const uint8_t* tcData,
size_t tcDataLen);
ReturnValue_t prepareStructureReportingCommand(CommandMessage* command, object_id_t objectId,
bool isDiagnostics, const uint8_t* tcData,
size_t tcDataLen);
const uint8_t* tcData, size_t tcDataLen);
ReturnValue_t prepareOneShotReportCommand(CommandMessage* command, object_id_t objectId,
bool isDiagnostics, const uint8_t* tcData,
size_t tcDataLen);
const uint8_t* tcData, size_t tcDataLen);
ReturnValue_t prepareCollectionIntervalModificationCommand(CommandMessage* command,
object_id_t objectId,
bool isDiagnostics,
const uint8_t* tcData,
size_t tcDataLen);