From 2b63f1b3f3557ae05bdb55791d90e2febf8a17c8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 23 Aug 2020 21:00:25 +0200 Subject: [PATCH] New reporting mode --- datapoollocal/LocalDataPoolManager.cpp | 22 ++++------------------ datapoollocal/LocalDataPoolManager.h | 14 ++++++++++++-- devicehandlers/DeviceHandlerBase.cpp | 7 +------ devicehandlers/DeviceHandlerBase.h | 2 -- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index a437519e..1121ac7b 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -8,6 +8,8 @@ #include #include +object_id_t LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; + LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse, bool appendValidityBuffer): appendValidityBuffer(appendValidityBuffer) { @@ -31,29 +33,13 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, } ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse, - object_id_t hkDestination, uint8_t nonDiagInvlFactor) { + uint8_t nonDiagInvlFactor) { if(queueToUse == nullptr) { sif::error << "LocalDataPoolManager::initialize: Supplied queue " "invalid!" << std::endl; } hkQueue = queueToUse; - if(hkDestination == objects::NO_OBJECT) { - return initializeHousekeepingPoolEntriesOnce(); - } - - AcceptsHkPacketsIF* hkReceiver = - objectManager->get(hkDestination); - if(hkReceiver != nullptr) { - setHkPacketDestination(hkReceiver->getHkQueue()); - } - else { - sif::warning << "LocalDataPoolManager::initialize: Could not retrieve" - " queue ID from HK destination object ID. " << std::flush; - sif::warning << "Make sure it exists and the object impements " - "AcceptsHkPacketsIF!" << std::endl; - } - setNonDiagnosticIntervalFactor(nonDiagInvlFactor); diagnosticMinimumInterval = owner->getPeriodicOperationFrequency(); regularMinimumInterval = diagnosticMinimumInterval * nonDiagnosticIntervalFactor; @@ -228,7 +214,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() { performPeriodicHkGeneration(receiver); break; } - case(ReportingType::ON_UPDATE): { + case(ReportingType::UPDATE_SNAPSHOT): { // check whether data has changed and send messages in case it has. break; } diff --git a/datapoollocal/LocalDataPoolManager.h b/datapoollocal/LocalDataPoolManager.h index a4113ffe..9403911b 100644 --- a/datapoollocal/LocalDataPoolManager.h +++ b/datapoollocal/LocalDataPoolManager.h @@ -15,8 +15,13 @@ #include +namespace Factory { +void setStaticFrameworkObjectIds(); +} + class LocalDataSetBase; + /** * @brief This class is the managing instance for local data pool. * @details @@ -40,6 +45,7 @@ class LocalDataPoolManager { template friend class LocalPoolVector; friend class LocalPoolDataSetBase; + friend void (Factory::setStaticFrameworkObjectIds)(); public: static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER; @@ -71,7 +77,7 @@ public: * @return */ ReturnValue_t initialize(MessageQueueIF* queueToUse, - object_id_t hkDestination, uint8_t nonDiagInvlFactor = 5); + uint8_t nonDiagInvlFactor = 5); /** * Non-Diagnostics packets usually have a lower minimum sampling frequency @@ -136,9 +142,10 @@ public: enum class ReportingType: uint8_t { // Periodic generation of HK packets. PERIODIC, + UPDATE_NOTIFICATION, // Notification will be sent out as message. // Data is accessed via shared data set or multiple local data sets. - ON_UPDATE, + UPDATE_SNAPSHOT, }; /* Copying forbidden */ @@ -157,6 +164,9 @@ private: dur_millis_t regularMinimumInterval = 0; dur_millis_t diagnosticMinimumInterval = 0; + /** Default receiver for periodic HK packets */ + static object_id_t defaultHkDestination; + /** The data pool manager will keep an internal map of HK receivers. */ struct HkReceiver { /** Different member of this union will be used depending on the diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 8d66411a..a3b861b5 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -19,7 +19,6 @@ object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT; -object_id_t DeviceHandlerBase::defaultHkDestination = objects::NO_OBJECT; DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF * comCookie, @@ -194,11 +193,7 @@ ReturnValue_t DeviceHandlerBase::initialize() { return result; } - if(hkDestination == objects::NO_OBJECT) { - hkDestination = defaultHkDestination; - } - - result = hkManager.initialize(commandQueue, hkDestination); + result = hkManager.initialize(commandQueue); if (result != HasReturnvaluesIF::RETURN_OK) { return result; } diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 4aa54fd6..c3640e2f 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -1043,8 +1043,6 @@ private: /** the object used to set power switches */ PowerSwitchIF *powerSwitcher = nullptr; - /** Cached for initialize() */ - static object_id_t defaultHkDestination; /** HK destination can also be set individually */ object_id_t hkDestination = objects::NO_OBJECT;