diff --git a/datapoollocal/HasLocalDataPoolIF.h b/datapoollocal/HasLocalDataPoolIF.h index acb3d773..d7950b49 100644 --- a/datapoollocal/HasLocalDataPoolIF.h +++ b/datapoollocal/HasLocalDataPoolIF.h @@ -11,6 +11,7 @@ class LocalDataPoolManager; class LocalPoolDataSetBase; +class LocalPoolObjectBase; using LocalDataPool = std::map; using LocalDataPoolMapIter = LocalDataPool::iterator; @@ -76,6 +77,19 @@ public: */ virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) = 0; + /** + * Similar to the function above, but used to get a local pool variable + * handle. This is only needed for update notifications, so it is not + * defined as abstract. + * @param localPoolId + * @return + */ + virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) { + sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden" + << ". Returning nullptr!" << std::endl; + return nullptr; + } + /** * @brief This function will be called by the manager if an update * notification is received. diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 45ad7647..a33f19e5 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -1,4 +1,5 @@ #include "LocalDataPoolManager.h" +#include "LocalPoolObjectBase.h" #include "LocalPoolDataSetBase.h" #include "../housekeeping/HousekeepingSetPacket.h" @@ -101,7 +102,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() { } case(ReportingType::UPDATE_HK): { if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { - // Periodic packets shall only be generated from datasets. + // Update packets shall only be generated from datasets. continue; } LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( @@ -118,10 +119,21 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() { } case(ReportingType::UPDATE_NOTIFICATION): { if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle( + receiver.dataId.localPoolId); + if(poolObj == nullptr) { + continue; + } + if(poolObj->hasChanged()) { + // prepare and send update notification. + } } else { LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( receiver.dataId.sid); + if(dataSet == nullptr) { + continue; + } if(dataSet->hasChanged()) { // prepare and send update notification } @@ -131,10 +143,21 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() { case(ReportingType::UPDATE_SNAPSHOT): { // check whether data has changed and send messages in case it has. if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle( + receiver.dataId.localPoolId); + if(poolObj == nullptr) { + continue; + } + if(poolObj->hasChanged()) { + // prepare and send update snapshot. + } } else { LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( receiver.dataId.sid); + if(dataSet == nullptr) { + continue; + } if(dataSet->hasChanged()) { // prepare and send update snapshot. }