From 5b96161331519c43d9ea8903d0ad7d7029d8f410 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 14 Oct 2020 16:46:00 +0200 Subject: [PATCH] optimization and printout improvements --- datapoollocal/LocalDataPoolManager.cpp | 27 +++++++++++++------ datapoollocal/LocalDataPoolManager.h | 36 ++++++++++++++++++++------ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index a2a087e8..13225e78 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -287,14 +287,20 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePackets(sid_t sid, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t LocalDataPoolManager::subscribeForUpdateMessages(sid_t sid, - object_id_t destinationObject, MessageQueueId_t targetQueueId) { +ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessages( + const uint32_t setId, object_id_t destinationObject, + MessageQueueId_t targetQueueId, bool generateSnapshot) { struct HkReceiver hkReceiver; hkReceiver.dataType = DataType::DATA_SET; - hkReceiver.dataId.sid = sid; + hkReceiver.dataId.sid = sid_t(this->getOwner()->getObjectId(), setId); hkReceiver.destinationQueue = targetQueueId; hkReceiver.objectId = destinationObject; - hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + if(generateSnapshot) { + hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; + } + else { + hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + } hkReceiversMap.push_back(hkReceiver); @@ -302,15 +308,20 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdateMessages(sid_t sid, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t LocalDataPoolManager::subscribeForUpdateMessages( - lp_id_t localPoolId, object_id_t destinationObject, - MessageQueueId_t targetQueueId) { +ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessages( + const lp_id_t localPoolId, object_id_t destinationObject, + MessageQueueId_t targetQueueId, bool generateSnapshot) { struct HkReceiver hkReceiver; hkReceiver.dataType = DataType::LOCAL_POOL_VARIABLE; hkReceiver.dataId.localPoolId = localPoolId; hkReceiver.destinationQueue = targetQueueId; hkReceiver.objectId = destinationObject; - hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + if(generateSnapshot) { + hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; + } + else { + hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + } hkReceiversMap.push_back(hkReceiver); diff --git a/datapoollocal/LocalDataPoolManager.h b/datapoollocal/LocalDataPoolManager.h index cc9364e7..afe82760 100644 --- a/datapoollocal/LocalDataPoolManager.h +++ b/datapoollocal/LocalDataPoolManager.h @@ -102,8 +102,8 @@ public: /** * @brief Subscribe for the generation of periodic packets. * @details - * This will most commonly be used to generate housekeeping packets - * which are downlinked directly. + * This subscription mechanism will generally be used by the data creator + * to generate housekeeping packets which are downlinked directly. * @return */ ReturnValue_t subscribeForPeriodicPacket(sid_t sid, bool enableReporting, @@ -113,6 +113,8 @@ public: /** * @brief Subscribe for the generation of packets if the dataset * is marked as changed. + * @details + * This subscription mechanism will generally be used by the data creator. * @param sid * @param isDiagnostics * @param packetDestination @@ -125,22 +127,40 @@ public: /** * @brief Subscribe for a notification message which will be sent * if a dataset has changed. - * @param sid + * @details + * This subscription mechanism will generally be used internally by + * other software components. + * @param setId Set ID of the set to receive update messages from. + * @param destinationObject * @param targetQueueId + * @param generateSnapshot If this is set to true, a copy of the current + * data with a timestamp will be generated and sent via message. + * Otherwise, only an notification message is sent. * @return */ - ReturnValue_t subscribeForUpdateMessages(sid_t sid, - object_id_t destinationObject, MessageQueueId_t targetQueueId); + ReturnValue_t subscribeForSetUpdateMessages(const uint32_t setId, + object_id_t destinationObject, + MessageQueueId_t targetQueueId, + bool generateSnapshot); /** * @brief Subscribe for an notification message which will be sent if a * pool variable has changed. - * @param sid + * @details + * This subscription mechanism will generally be used internally by + * other software components. + * @param localPoolId Pool ID of the pool variable + * @param destinationObject * @param targetQueueId + * @param generateSnapshot If this is set to true, a copy of the current + * data with a timestamp will be generated and sent via message. + * Otherwise, only an notification message is sent. * @return */ - ReturnValue_t subscribeForUpdateMessages(lp_id_t localPoolId, - object_id_t destinationObject, MessageQueueId_t targetQueueId); + ReturnValue_t subscribeForVariableUpdateMessages(const lp_id_t localPoolId, + object_id_t destinationObject, + MessageQueueId_t targetQueueId, + bool generateSnapshot); /** * Non-Diagnostics packets usually have a lower minimum sampling frequency