updated attorneys
This commit is contained in:
parent
bb10c25909
commit
cafc8e4ccb
@ -26,7 +26,7 @@ object_id_t ExtendedControllerBase::getObjectId() const {
|
|||||||
return SystemObject::getObjectId();
|
return SystemObject::getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataPoolManager* ExtendedControllerBase::getHkManagerHandle() {
|
AccessPoolManagerIF* ExtendedControllerBase::getAccessorHandle() {
|
||||||
return &localPoolManager;
|
return &localPoolManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +106,6 @@ MessageQueueId_t ExtendedControllerBase::getCommandQueue() const {
|
|||||||
return commandQueue->getId();
|
return commandQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessLocalPoolIF* ExtendedControllerBase::getAccessorHandle() {
|
|
||||||
return &localPoolManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "ExtendedControllerBase::getDataSetHandle: No child "
|
sif::warning << "ExtendedControllerBase::getDataSetHandle: No child "
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
||||||
AccessLocalPoolIF* getAccessorHandle() override;
|
AccessPoolManagerIF* getAccessorHandle() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LocalDataPoolManager localPoolManager;
|
LocalDataPoolManager localPoolManager;
|
||||||
@ -65,7 +65,6 @@ protected:
|
|||||||
virtual ReturnValue_t initializeLocalDataPool(
|
virtual ReturnValue_t initializeLocalDataPool(
|
||||||
LocalDataPool& localDataPoolMap,
|
LocalDataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
|
||||||
virtual uint32_t getPeriodicOperationFrequency() const override;
|
virtual uint32_t getPeriodicOperationFrequency() const override;
|
||||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
};
|
};
|
||||||
|
@ -1,31 +1,26 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_
|
#ifndef FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_
|
#define FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/locPoolDefinitions.h>
|
//#include "LocalDataPoolManager.h"
|
||||||
#include <fsfw/datapool/PoolEntry.h>
|
|
||||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
|
||||||
#include <fsfw/ipc/MutexIF.h>
|
#include <fsfw/ipc/MutexIF.h>
|
||||||
|
|
||||||
class AccessLocalPoolIF {
|
class LocalDataPoolManager;
|
||||||
public:
|
|
||||||
virtual ~AccessLocalPoolIF() {};
|
|
||||||
|
|
||||||
virtual ReturnValue_t retrieveLocalPoolMutex(MutexIF* mutex) = 0;
|
class AccessPoolManagerIF {
|
||||||
virtual object_id_t getCreatorObjectId() const = 0;
|
public:
|
||||||
|
virtual ~AccessPoolManagerIF() {};
|
||||||
|
|
||||||
|
virtual MutexIF* getLocalPoolMutex() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to get a handle to the local data pool manager.
|
||||||
|
* This function is protected because it should only be used by the
|
||||||
|
* class imlementing the interface.
|
||||||
|
*/
|
||||||
|
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//template <typename T>
|
|
||||||
//class AccessLocalPoolTypedIF {
|
|
||||||
//public:
|
|
||||||
// virtual ~AccessLocalPoolTypedIF() {};
|
|
||||||
//
|
|
||||||
// virtual ReturnValue_t fetchPoolEntry(lp_id_t localPoolId, PoolEntry<T> **poolEntry) = 0;
|
|
||||||
//};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_ */
|
#endif /* FSFW_DATAPOOLLOCAL_ACCESSLOCALPOOLF_H_ */
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class LocalDataPoolManager;
|
|
||||||
class LocalPoolDataSetBase;
|
class LocalPoolDataSetBase;
|
||||||
class LocalPoolObjectBase;
|
class LocalPoolObjectBase;
|
||||||
|
|
||||||
@ -20,31 +19,26 @@ using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
|
|||||||
using LocalDataPoolMapIter = LocalDataPool::iterator;
|
using LocalDataPoolMapIter = LocalDataPool::iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This interface is implemented by classes which posses a local
|
* @brief This interface is implemented by classes which posses a local data pool (not the
|
||||||
* data pool (not the managing class). It defines the relationship
|
* managing class). It defines the relationship between the local data pool owner
|
||||||
* between the local data pool owner and the LocalDataPoolManager.
|
* and the LocalDataPoolManager.
|
||||||
* @details
|
* @details
|
||||||
* Any class implementing this interface shall also have a LocalDataPoolManager
|
* Any class implementing this interface shall also have a LocalDataPoolManager member class which
|
||||||
* member class which contains the actual pool data structure
|
* contains the actual pool data structure and exposes the public interface for it.
|
||||||
* and exposes the public interface for it.
|
* This is required because the pool entries are templates, which makes specifying an interface
|
||||||
* This is required because the pool entries are templates, which makes
|
* rather difficult. The local data pool can be accessed by using the LocalPoolVariable,
|
||||||
* specifying an interface rather difficult. The local data pool can be
|
* LocalPoolVector or LocalDataSet classes.
|
||||||
* accessed by using the LocalPoolVariable, LocalPoolVector or LocalDataSet
|
|
||||||
* classes.
|
|
||||||
*
|
*
|
||||||
* Architectural Note:
|
* Architectural Note:
|
||||||
* This could be circumvented by using a wrapper/accessor function or
|
* This could be circumvented by using a wrapper/accessor function or implementing the templated
|
||||||
* implementing the templated function in this interface..
|
* function in this interface.. The first solution sounds better than the second but the
|
||||||
* The first solution sounds better than the second but
|
* LocalPoolVariable classes are templates as well, so this just shifts the problem somewhere else.
|
||||||
* the LocalPoolVariable classes are templates as well, so this just shifts
|
* Interfaces are nice, but the most pragmatic solution I found was to offer the client the full
|
||||||
* the problem somewhere else. Interfaces are nice, but the most
|
* interface of the LocalDataPoolManager.
|
||||||
* pragmatic solution I found was to offer the client the full interface
|
|
||||||
* of the LocalDataPoolManager.
|
|
||||||
*/
|
*/
|
||||||
class HasLocalDataPoolIF {
|
class HasLocalDataPoolIF {
|
||||||
friend class LocalDataPoolManager;
|
friend class HasLocalDpIFManagerAttorney;
|
||||||
friend class LocalPoolDataSetBase;
|
friend class HasLocalDpIFUserAttorney;
|
||||||
friend class LocalPoolObjectBase;
|
|
||||||
public:
|
public:
|
||||||
virtual~ HasLocalDataPoolIF() {};
|
virtual~ HasLocalDataPoolIF() {};
|
||||||
|
|
||||||
@ -55,6 +49,8 @@ public:
|
|||||||
|
|
||||||
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
|
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
|
||||||
|
|
||||||
|
virtual object_id_t getObjectId() const = 0;
|
||||||
|
|
||||||
/** Command queue for housekeeping messages. */
|
/** Command queue for housekeeping messages. */
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
|
|
||||||
@ -63,8 +59,7 @@ public:
|
|||||||
* The manager instance shall also be passed to this function.
|
* The manager instance shall also be passed to this function.
|
||||||
* It can be used to subscribe for periodic packets for for updates.
|
* It can be used to subscribe for periodic packets for for updates.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t initializeLocalDataPool(
|
virtual ReturnValue_t initializeLocalDataPool(LocalDataPool& localDataPoolMap,
|
||||||
LocalDataPool& localDataPoolMap,
|
|
||||||
LocalDataPoolManager& poolManager) = 0;
|
LocalDataPoolManager& poolManager) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,8 +107,7 @@ public:
|
|||||||
virtual ReturnValue_t removeDataSet(sid_t sid) {
|
virtual ReturnValue_t removeDataSet(sid_t sid) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
};
|
};
|
||||||
virtual ReturnValue_t changeCollectionInterval(sid_t sid,
|
virtual ReturnValue_t changeCollectionInterval(sid_t sid, float newIntervalSeconds) {
|
||||||
float newIntervalSeconds) {
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -124,15 +118,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0;
|
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0;
|
||||||
|
|
||||||
virtual AccessLocalPoolIF* getAccessorHandle() = 0;
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
virtual AccessPoolManagerIF* getAccessorHandle() = 0;
|
||||||
* Can be used to get a handle to the local data pool manager.
|
|
||||||
* This function is protected because it should only be used by the
|
|
||||||
* class imlementing the interface.
|
|
||||||
*/
|
|
||||||
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used by the pool manager to get a valid dataset
|
* This function is used by the pool manager to get a valid dataset
|
||||||
|
38
datapoollocal/HasLocalDataPoolIFAttorney.h
Normal file
38
datapoollocal/HasLocalDataPoolIFAttorney.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIFATTORNEY_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIFATTORNEY_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||||
|
|
||||||
|
class HasLocalDpIFUserAttorney {
|
||||||
|
private:
|
||||||
|
|
||||||
|
static AccessPoolManagerIF* getAccessorHandle(HasLocalDataPoolIF* interface) {
|
||||||
|
return interface->getAccessorHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
friend class LocalPoolObjectBase;
|
||||||
|
friend class LocalPoolDataSetBase;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class HasLocalDpIFManagerAttorney {
|
||||||
|
|
||||||
|
static LocalPoolDataSetBase* getDataSetHandle(HasLocalDataPoolIF* interface, sid_t sid) {
|
||||||
|
return interface->getDataSetHandle(sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
static LocalPoolObjectBase* getPoolObjectHandle(HasLocalDataPoolIF* interface,
|
||||||
|
lp_id_t localPoolId) {
|
||||||
|
return interface->getPoolObjectHandle(localPoolId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static object_id_t getObjectId(HasLocalDataPoolIF* interface) {
|
||||||
|
return interface->getObjectId();
|
||||||
|
}
|
||||||
|
|
||||||
|
friend class LocalDataPoolManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIFATTORNEY_H_ */
|
@ -1,6 +1,8 @@
|
|||||||
#include "LocalDataPoolManager.h"
|
#include "LocalDataPoolManager.h"
|
||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "LocalPoolDataSetBase.h"
|
#include "LocalPoolDataSetBase.h"
|
||||||
|
#include "HasLocalDataPoolIFAttorney.h"
|
||||||
|
#include "LocalPoolDataSetAttorney.h"
|
||||||
|
|
||||||
#include "../housekeeping/HousekeepingPacketUpdate.h"
|
#include "../housekeeping/HousekeepingPacketUpdate.h"
|
||||||
#include "../housekeeping/HousekeepingSetPacket.h"
|
#include "../housekeeping/HousekeepingSetPacket.h"
|
||||||
@ -132,7 +134,7 @@ ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver,
|
|||||||
// Update packets shall only be generated from datasets.
|
// Update packets shall only be generated from datasets.
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
|
||||||
receiver.dataId.sid);
|
receiver.dataId.sid);
|
||||||
if(dataSet->hasChanged()) {
|
if(dataSet->hasChanged()) {
|
||||||
// prepare and send update notification
|
// prepare and send update notification
|
||||||
@ -151,7 +153,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
|
|||||||
ReturnValue_t& status) {
|
ReturnValue_t& status) {
|
||||||
MarkChangedIF* toReset = nullptr;
|
MarkChangedIF* toReset = nullptr;
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(receiver.dataId.localPoolId);
|
LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner,
|
||||||
|
receiver.dataId.localPoolId);
|
||||||
|
//LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(receiver.dataId.localPoolId);
|
||||||
if(poolObj == nullptr) {
|
if(poolObj == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
"handleNotificationUpdate", POOLOBJECT_NOT_FOUND);
|
"handleNotificationUpdate", POOLOBJECT_NOT_FOUND);
|
||||||
@ -172,7 +176,8 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(receiver.dataId.sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
|
||||||
|
receiver.dataId.sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
"handleNotificationUpdate", DATASET_NOT_FOUND);
|
"handleNotificationUpdate", DATASET_NOT_FOUND);
|
||||||
@ -203,7 +208,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
|||||||
MarkChangedIF* toReset = nullptr;
|
MarkChangedIF* toReset = nullptr;
|
||||||
// check whether data has changed and send messages in case it has.
|
// check whether data has changed and send messages in case it has.
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
|
LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner,
|
||||||
receiver.dataId.localPoolId);
|
receiver.dataId.localPoolId);
|
||||||
if(poolObj == nullptr) {
|
if(poolObj == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
@ -221,7 +226,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
|||||||
CCSDSTime::CDS_short cds;
|
CCSDSTime::CDS_short cds;
|
||||||
CCSDSTime::convertToCcsds(&cds, &now);
|
CCSDSTime::convertToCcsds(&cds, &now);
|
||||||
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
||||||
sizeof(cds), owner->getPoolObjectHandle(
|
sizeof(cds), HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner,
|
||||||
receiver.dataId.localPoolId));
|
receiver.dataId.localPoolId));
|
||||||
|
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
@ -241,7 +246,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
|||||||
toReset = poolObj;
|
toReset = poolObj;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
|
||||||
receiver.dataId.sid);
|
receiver.dataId.sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
@ -259,7 +264,8 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
|||||||
CCSDSTime::CDS_short cds;
|
CCSDSTime::CDS_short cds;
|
||||||
CCSDSTime::convertToCcsds(&cds, &now);
|
CCSDSTime::convertToCcsds(&cds, &now);
|
||||||
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
||||||
sizeof(cds), owner->getDataSetHandle(receiver.dataId.sid));
|
sizeof(cds), HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
|
||||||
|
receiver.dataId.sid));
|
||||||
|
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
|
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
|
||||||
@ -363,11 +369,12 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
|
|||||||
hkReceiver.dataType = DataType::DATA_SET;
|
hkReceiver.dataType = DataType::DATA_SET;
|
||||||
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
|
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
|
||||||
|
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
if(dataSet != nullptr) {
|
if(dataSet != nullptr) {
|
||||||
dataSet->setReportingEnabled(enableReporting);
|
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting);
|
||||||
dataSet->setDiagnostic(isDiagnostics);
|
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
|
||||||
dataSet->initializePeriodicHelper(collectionInterval,
|
LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval,
|
||||||
owner->getPeriodicOperationFrequency(), isDiagnostics);
|
owner->getPeriodicOperationFrequency(), isDiagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,10 +400,11 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePackets(sid_t sid,
|
|||||||
hkReceiver.dataType = DataType::DATA_SET;
|
hkReceiver.dataType = DataType::DATA_SET;
|
||||||
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
|
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
|
||||||
|
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
if(dataSet != nullptr) {
|
if(dataSet != nullptr) {
|
||||||
dataSet->setReportingEnabled(true);
|
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true);
|
||||||
dataSet->setDiagnostic(isDiagnostics);
|
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
hkReceiversMap.push_back(hkReceiver);
|
hkReceiversMap.push_back(hkReceiver);
|
||||||
@ -410,7 +418,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessages(
|
|||||||
MessageQueueId_t targetQueueId, bool generateSnapshot) {
|
MessageQueueId_t targetQueueId, bool generateSnapshot) {
|
||||||
struct HkReceiver hkReceiver;
|
struct HkReceiver hkReceiver;
|
||||||
hkReceiver.dataType = DataType::DATA_SET;
|
hkReceiver.dataType = DataType::DATA_SET;
|
||||||
hkReceiver.dataId.sid = sid_t(this->getCreatorObjectId(), setId);
|
hkReceiver.dataId.sid = sid_t(owner->getObjectId(), setId);
|
||||||
hkReceiver.destinationQueue = targetQueueId;
|
hkReceiver.destinationQueue = targetQueueId;
|
||||||
hkReceiver.objectId = destinationObject;
|
hkReceiver.objectId = destinationObject;
|
||||||
if(generateSnapshot) {
|
if(generateSnapshot) {
|
||||||
@ -534,13 +542,14 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(
|
|||||||
|
|
||||||
case(HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT):
|
case(HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT):
|
||||||
case(HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
|
case(HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
LocalPoolDataSetBase* dataSet =HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
if(command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT
|
if(command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT
|
||||||
and dataSet->isDiagnostics()) {
|
and LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||||
return WRONG_HK_PACKET_TYPE;
|
return WRONG_HK_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
else if(command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT
|
else if(command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT
|
||||||
and not dataSet->isDiagnostics()) {
|
and not LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||||
return WRONG_HK_PACKET_TYPE;
|
return WRONG_HK_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
return generateHousekeepingPacket(HousekeepingMessage::getSid(message),
|
return generateHousekeepingPacket(HousekeepingMessage::getSid(message),
|
||||||
@ -629,7 +638,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
|||||||
|
|
||||||
// and now we set a HK message and send it the HK packet destination.
|
// and now we set a HK message and send it the HK packet destination.
|
||||||
CommandMessage hkMessage;
|
CommandMessage hkMessage;
|
||||||
if(dataSet->isDiagnostics()) {
|
if(LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||||
HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId);
|
HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -683,7 +692,8 @@ void LocalDataPoolManager::setNonDiagnosticIntervalFactor(
|
|||||||
|
|
||||||
void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
||||||
sid_t sid = receiver.dataId.sid;
|
sid_t sid = receiver.dataId.sid;
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
"performPeriodicHkGeneration",
|
"performPeriodicHkGeneration",
|
||||||
@ -691,16 +701,19 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(not dataSet->getReportingEnabled()) {
|
if(not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataSet->periodicHelper == nullptr) {
|
PeriodicHousekeepingHelper* periodicHelper =
|
||||||
|
LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet);
|
||||||
|
|
||||||
|
if(periodicHelper == nullptr) {
|
||||||
// Configuration error.
|
// Configuration error.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(not dataSet->periodicHelper->checkOpNecessary()) {
|
if(periodicHelper->checkOpNecessary()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,43 +734,49 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
|||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid,
|
||||||
bool enable, bool isDiagnostics) {
|
bool enable, bool isDiagnostics) {
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
if((dataSet->isDiagnostics() and not isDiagnostics) or
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
(not dataSet->isDiagnostics() and isDiagnostics)) {
|
if((LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and not isDiagnostics) or
|
||||||
|
(not LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and isDiagnostics)) {
|
||||||
return WRONG_HK_PACKET_TYPE;
|
return WRONG_HK_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((dataSet->getReportingEnabled() and enable) or
|
if((LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and enable) or
|
||||||
(not dataSet->getReportingEnabled() and not enable)) {
|
(not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and not enable)) {
|
||||||
return REPORTING_STATUS_UNCHANGED;
|
return REPORTING_STATUS_UNCHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSet->setReportingEnabled(enable);
|
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
||||||
float newCollectionInterval, bool isDiagnostics) {
|
float newCollectionInterval, bool isDiagnostics) {
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
bool targetIsDiagnostics = dataSet->isDiagnostics();
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
|
bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet);
|
||||||
if((targetIsDiagnostics and not isDiagnostics) or
|
if((targetIsDiagnostics and not isDiagnostics) or
|
||||||
(not targetIsDiagnostics and isDiagnostics)) {
|
(not targetIsDiagnostics and isDiagnostics)) {
|
||||||
return WRONG_HK_PACKET_TYPE;
|
return WRONG_HK_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataSet->periodicHelper == nullptr) {
|
PeriodicHousekeepingHelper* periodicHelper =
|
||||||
|
LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet);
|
||||||
|
|
||||||
|
if(periodicHelper == nullptr) {
|
||||||
// config error
|
// config error
|
||||||
return PERIODIC_HELPER_INVALID;
|
return PERIODIC_HELPER_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSet->periodicHelper->changeCollectionInterval(newCollectionInterval);
|
periodicHelper->changeCollectionInterval(newCollectionInterval);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||||
bool isDiagnostics) {
|
bool isDiagnostics) {
|
||||||
// Get and check dataset first.
|
// Get and check dataset first.
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
|
||||||
"performPeriodicHkGeneration",
|
"performPeriodicHkGeneration",
|
||||||
@ -766,16 +785,16 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool targetIsDiagnostics = dataSet->isDiagnostics();
|
bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet);
|
||||||
if((targetIsDiagnostics and not isDiagnostics) or
|
if((targetIsDiagnostics and not isDiagnostics) or
|
||||||
(not targetIsDiagnostics and isDiagnostics)) {
|
(not targetIsDiagnostics and isDiagnostics)) {
|
||||||
return WRONG_HK_PACKET_TYPE;
|
return WRONG_HK_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid = dataSet->isValid();
|
bool valid = dataSet->isValid();
|
||||||
bool reportingEnabled = dataSet->getReportingEnabled();
|
bool reportingEnabled = LocalPoolDataSetAttorney::getReportingEnabled(*dataSet);
|
||||||
float collectionInterval =
|
float collectionInterval = LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet)->
|
||||||
dataSet->periodicHelper->getCollectionIntervalInSeconds();
|
getCollectionIntervalInSeconds();
|
||||||
|
|
||||||
// Generate set packet which can be serialized.
|
// Generate set packet which can be serialized.
|
||||||
HousekeepingSetPacket setPacket(sid,
|
HousekeepingSetPacket setPacket(sid,
|
||||||
@ -822,16 +841,13 @@ void LocalDataPoolManager::clearReceiversList() {
|
|||||||
HkReceivers().swap(hkReceiversMap);
|
HkReceivers().swap(hkReceiversMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::retrieveLocalPoolMutex(MutexIF *mutex) {
|
MutexIF* LocalDataPoolManager::getLocalPoolMutex() {
|
||||||
if(this->mutex == nullptr) {
|
return this->mutex;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
mutex = this->mutex;
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_id_t LocalDataPoolManager::getCreatorObjectId() const {
|
object_id_t LocalDataPoolManager::getCreatorObjectId() const {
|
||||||
return owner->getAccessorHandle()->getCreatorObjectId();
|
return owner->getObjectId();
|
||||||
|
//return owner->getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
|
void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
|
||||||
@ -869,7 +885,7 @@ void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "LocalDataPoolManager::" << functionName
|
sif::warning << "LocalDataPoolManager::" << functionName
|
||||||
<< ": Object ID " << std::setw(8) << std::setfill('0')
|
<< ": Object ID " << std::setw(8) << std::setfill('0')
|
||||||
<< std::hex << this->getCreatorObjectId() << " | " << errorPrint
|
<< std::hex << owner->getObjectId() << " | " << errorPrint
|
||||||
<< std::dec << std::setfill(' ') << std::endl;
|
<< std::dec << std::setfill(' ') << std::endl;
|
||||||
#else
|
#else
|
||||||
fsfw::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
fsfw::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
||||||
@ -880,7 +896,7 @@ void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "LocalDataPoolManager::" << functionName
|
sif::error << "LocalDataPoolManager::" << functionName
|
||||||
<< ": Object ID " << std::setw(8) << std::setfill('0')
|
<< ": Object ID " << std::setw(8) << std::setfill('0')
|
||||||
<< std::hex << this->getCreatorObjectId() << " | " << errorPrint
|
<< std::hex << owner->getObjectId() << " | " << errorPrint
|
||||||
<< std::dec << std::setfill(' ') << std::endl;
|
<< std::dec << std::setfill(' ') << std::endl;
|
||||||
#else
|
#else
|
||||||
fsfw::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
fsfw::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
||||||
@ -888,3 +904,7 @@ void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalDataPoolManager* LocalDataPoolManager::getHkManagerHandle() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@ -51,11 +51,11 @@ class HousekeepingPacketUpdate;
|
|||||||
* @author R. Mueller
|
* @author R. Mueller
|
||||||
*/
|
*/
|
||||||
class LocalDataPoolManager: public ProvidesDataPoolSubscriptionIF,
|
class LocalDataPoolManager: public ProvidesDataPoolSubscriptionIF,
|
||||||
public AccessLocalPoolIF {
|
public AccessPoolManagerIF {
|
||||||
template<typename T> friend class LocalPoolVariable;
|
|
||||||
template<typename T, uint16_t vecSize> friend class LocalPoolVector;
|
|
||||||
//friend class LocalPoolDataSetBase;
|
|
||||||
friend void (Factory::setStaticFrameworkObjectIds)();
|
friend void (Factory::setStaticFrameworkObjectIds)();
|
||||||
|
//! Some classes using the pool manager directly need to access class internals of the
|
||||||
|
//! manager. The attorney provides granular control of access to these internals.
|
||||||
|
friend class LocalDpManagerAttorney;
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ public:
|
|||||||
MessageQueueId_t targetQueueId,
|
MessageQueueId_t targetQueueId,
|
||||||
bool generateSnapshot) override;
|
bool generateSnapshot) override;
|
||||||
|
|
||||||
ReturnValue_t retrieveLocalPoolMutex(MutexIF* mutex) override;
|
MutexIF* getLocalPoolMutex() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-Diagnostics packets usually have a lower minimum sampling frequency
|
* Non-Diagnostics packets usually have a lower minimum sampling frequency
|
||||||
@ -263,7 +263,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
void clearReceiversList();
|
void clearReceiversList();
|
||||||
|
|
||||||
object_id_t getCreatorObjectId() const override;
|
object_id_t getCreatorObjectId() const;
|
||||||
|
|
||||||
|
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
||||||
private:
|
private:
|
||||||
LocalDataPool localPoolMap;
|
LocalDataPool localPoolMap;
|
||||||
//! Every housekeeping data manager has a mutex to protect access
|
//! Every housekeeping data manager has a mutex to protect access
|
||||||
|
32
datapoollocal/LocalDpManagerAttorney.h
Normal file
32
datapoollocal/LocalDpManagerAttorney.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALDPMANAGERATTORNEY_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_LOCALDPMANAGERATTORNEY_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is a helper class implements the Attorney-Client idiom for access to
|
||||||
|
* LocalDataPoolManager internals
|
||||||
|
* @details
|
||||||
|
* This helper class provides better control over which classes are allowed to access
|
||||||
|
* LocalDataPoolManager internals in a granular and encapsulated way when compared to
|
||||||
|
* other methods like direct friend declarations. It allows these classes to use
|
||||||
|
* an explicit subset of the pool manager private/protected functions.
|
||||||
|
* See: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Friendship_and_the_Attorney-Client
|
||||||
|
*/
|
||||||
|
class LocalDpManagerAttorney {
|
||||||
|
private:
|
||||||
|
template<typename T> static ReturnValue_t fetchPoolEntry(LocalDataPoolManager& manager,
|
||||||
|
lp_id_t localPoolId, PoolEntry<T> **poolEntry) {
|
||||||
|
return manager.fetchPoolEntry(localPoolId, poolEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
static MutexIF* getMutexHandle(LocalDataPoolManager& manager) {
|
||||||
|
return manager.getMutexHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T> friend class LocalPoolVariable;
|
||||||
|
template<typename T, uint16_t vecSize> friend class LocalPoolVector;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_LOCALDPMANAGERATTORNEY_H_ */
|
40
datapoollocal/LocalPoolDataSetAttorney.h
Normal file
40
datapoollocal/LocalPoolDataSetAttorney.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalPoolDataSetBase.h>
|
||||||
|
|
||||||
|
class LocalPoolDataSetAttorney {
|
||||||
|
private:
|
||||||
|
static void setDiagnostic(LocalPoolDataSetBase& set, bool diagnostics) {
|
||||||
|
set.setDiagnostic(diagnostics);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isDiagnostics(LocalPoolDataSetBase& set) {
|
||||||
|
return set.isDiagnostics();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void initializePeriodicHelper(LocalPoolDataSetBase& set, float collectionInterval,
|
||||||
|
uint32_t minimumPeriodicIntervalMs,
|
||||||
|
bool isDiagnostics, uint8_t nonDiagIntervalFactor = 5) {
|
||||||
|
set.initializePeriodicHelper(collectionInterval, minimumPeriodicIntervalMs, isDiagnostics,
|
||||||
|
nonDiagIntervalFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setReportingEnabled(LocalPoolDataSetBase& set, bool enabled) {
|
||||||
|
set.setReportingEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool getReportingEnabled(LocalPoolDataSetBase& set) {
|
||||||
|
return set.getReportingEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PeriodicHousekeepingHelper* getPeriodicHelper(LocalPoolDataSetBase& set) {
|
||||||
|
return set.periodicHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend class LocalDataPoolManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ */
|
@ -1,4 +1,5 @@
|
|||||||
#include "LocalPoolDataSetBase.h"
|
#include "LocalPoolDataSetBase.h"
|
||||||
|
#include "HasLocalDataPoolIFAttorney.h"
|
||||||
|
|
||||||
#include "../serviceinterface/ServiceInterface.h"
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "../datapoollocal/LocalDataPoolManager.h"
|
#include "../datapoollocal/LocalDataPoolManager.h"
|
||||||
@ -23,14 +24,14 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
|||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localPoolAccessor = hkOwner->getAccessorHandle();
|
AccessPoolManagerIF* accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
||||||
|
|
||||||
if(localPoolAccessor != nullptr) {
|
if(poolManager != nullptr) {
|
||||||
localPoolAccessor->retrieveLocalPoolMutex(mutexIfSingleDataCreator);
|
poolManager = accessor->getHkManagerHandle();
|
||||||
//mutexIfSingleDataCreator = hkManager->getAc();
|
mutexIfSingleDataCreator = accessor->getLocalPoolMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->sid.objectId = localPoolAccessor->getCreatorObjectId();
|
this->sid.objectId = hkOwner->getObjectId();
|
||||||
this->sid.ownerSetId = setId;
|
this->sid.ownerSetId = setId;
|
||||||
|
|
||||||
// Data creators get a periodic helper for periodic HK data generation.
|
// Data creators get a periodic helper for periodic HK data generation.
|
||||||
@ -43,10 +44,10 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid,
|
|||||||
PoolVariableIF** registeredVariablesArray,
|
PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables):
|
const size_t maxNumberOfVariables):
|
||||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||||
AccessLocalPoolIF* hkOwner = objectManager->get<AccessLocalPoolIF>(
|
AccessPoolManagerIF* hkOwner = objectManager->get<AccessPoolManagerIF>(
|
||||||
sid.objectId);
|
sid.objectId);
|
||||||
if(hkOwner != nullptr) {
|
if(hkOwner != nullptr) {
|
||||||
ReturnValue_t result = hkOwner->retrieveLocalPoolMutex(mutexIfSingleDataCreator);
|
mutexIfSingleDataCreator = hkOwner->getLocalPoolMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(hkManager != nullptr) {
|
//if(hkManager != nullptr) {
|
||||||
@ -310,8 +311,8 @@ void LocalPoolDataSetBase::setValidity(bool valid, bool setEntriesRecursively) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object_id_t LocalPoolDataSetBase::getCreatorObjectId() {
|
object_id_t LocalPoolDataSetBase::getCreatorObjectId() {
|
||||||
if(localPoolAccessor != nullptr) {
|
if(poolManager != nullptr) {
|
||||||
return localPoolAccessor->getCreatorObjectId();
|
return poolManager->getCreatorObjectId();
|
||||||
}
|
}
|
||||||
return objects::NO_OBJECT;
|
return objects::NO_OBJECT;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,8 @@ class PeriodicHousekeepingHelper;
|
|||||||
*/
|
*/
|
||||||
class LocalPoolDataSetBase: public PoolDataSetBase,
|
class LocalPoolDataSetBase: public PoolDataSetBase,
|
||||||
public MarkChangedIF {
|
public MarkChangedIF {
|
||||||
friend class LocalDataPoolManager;
|
//friend class LocalDataPoolManager;
|
||||||
|
friend class LocalPoolDataSetAttorney;
|
||||||
friend class PeriodicHousekeepingHelper;
|
friend class PeriodicHousekeepingHelper;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -217,7 +218,7 @@ protected:
|
|||||||
bool bitGetter(const uint8_t* byte, uint8_t position) const;
|
bool bitGetter(const uint8_t* byte, uint8_t position) const;
|
||||||
|
|
||||||
PeriodicHousekeepingHelper* periodicHelper = nullptr;
|
PeriodicHousekeepingHelper* periodicHelper = nullptr;
|
||||||
AccessLocalPoolIF* localPoolAccessor = nullptr;
|
LocalDataPoolManager* poolManager = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
|
#include "HasLocalDataPoolIFAttorney.h"
|
||||||
|
|
||||||
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
||||||
DataSetIF* dataSet, pool_rwm_t setReadWriteMode):
|
DataSetIF* dataSet, pool_rwm_t setReadWriteMode):
|
||||||
@ -16,7 +17,9 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkO
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
||||||
|
hkManager = poolManAccessor->getHkManagerHandle();
|
||||||
|
//HasLohkOwner->getHkManagerHandle();
|
||||||
if (dataSet != nullptr) {
|
if (dataSet != nullptr) {
|
||||||
dataSet->registerVariable(this);
|
dataSet->registerVariable(this);
|
||||||
}
|
}
|
||||||
@ -41,7 +44,10 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
//hkManager = hkOwner->getHkManagerHandle();
|
||||||
|
AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
||||||
|
//hkManager = HasLocalDpIFUserAttorney::getHkManagerHandle(hkOwner);
|
||||||
|
hkManager = poolManAccessor->getHkManagerHandle();
|
||||||
if(dataSet != nullptr) {
|
if(dataSet != nullptr) {
|
||||||
dataSet->registerVariable(this);
|
dataSet->registerVariable(this);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalDpManagerAttorney.h>
|
||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
#include "LocalDataPoolManager.h"
|
#include "LocalDataPoolManager.h"
|
||||||
#include "AccessLocalPoolF.h"
|
#include "AccessLocalPoolF.h"
|
||||||
|
|
||||||
#include "../datapool/PoolVariableIF.h"
|
#include "../datapool/PoolVariableIF.h"
|
||||||
#include "../datapool/DataSetIF.h"
|
#include "../datapool/DataSetIF.h"
|
||||||
#include "../serviceinterface/ServiceInterface.h"
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
|
@ -26,7 +26,7 @@ inline LocalPoolVariable<T>::LocalPoolVariable(gp_id_t globalPoolId,
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVariable<T>::read(
|
inline ReturnValue_t LocalPoolVariable<T>::read(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(hkManager->getMutexHandle(), timeoutType, timeoutMs);
|
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return readWithoutLock();
|
return readWithoutLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,9 @@ inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
||||||
|
&poolEntry);
|
||||||
|
//ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
|
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVariable", result,
|
reportReadCommitError("LocalPoolVariable", result,
|
||||||
@ -73,7 +75,7 @@ inline ReturnValue_t LocalPoolVariable<T>::commit(bool setValid,
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVariable<T>::commit(
|
inline ReturnValue_t LocalPoolVariable<T>::commit(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(hkManager->getMutexHandle(), timeoutType, timeoutMs);
|
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return commitWithoutLock();
|
return commitWithoutLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +90,9 @@ inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
//ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||||
|
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
||||||
|
&poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
|
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVariable", result,
|
reportReadCommitError("LocalPoolVariable", result,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalDpManagerAttorney.h>
|
||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "../datapool/DataSetIF.h"
|
#include "../datapool/DataSetIF.h"
|
||||||
#include "../datapool/PoolEntry.h"
|
#include "../datapool/PoolEntry.h"
|
||||||
|
@ -26,7 +26,7 @@ inline LocalPoolVector<T, vectorSize>::LocalPoolVector(gp_id_t globalPoolId,
|
|||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(hkManager->getMutexHandle(), timeoutType, timeoutMs);
|
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return readWithoutLock();
|
return readWithoutLock();
|
||||||
}
|
}
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
@ -40,7 +40,8 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
||||||
|
&poolEntry);
|
||||||
memset(this->value, 0, vectorSize * sizeof(T));
|
memset(this->value, 0, vectorSize * sizeof(T));
|
||||||
|
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
@ -64,7 +65,7 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(bool valid,
|
|||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(hkManager->getMutexHandle(), timeoutType, timeoutMs);
|
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return commitWithoutLock();
|
return commitWithoutLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +79,8 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
|||||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||||
}
|
}
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
||||||
|
&poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVector", result, false, targetObjectId,
|
reportReadCommitError("LocalPoolVector", result, false, targetObjectId,
|
||||||
|
@ -1432,11 +1432,6 @@ ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() {
|
|
||||||
return &hkManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
|
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
|
||||||
// In this function, the task handle should be valid if the task
|
// In this function, the task handle should be valid if the task
|
||||||
// was implemented correctly. We still check to be 1000 % sure :-)
|
// was implemented correctly. We still check to be 1000 % sure :-)
|
||||||
@ -1488,7 +1483,7 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessLocalPoolIF* DeviceHandlerBase::getAccessorHandle() {
|
AccessPoolManagerIF* DeviceHandlerBase::getAccessorHandle() {
|
||||||
return &hkManager;
|
return &hkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,11 +519,11 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
/** Get the HK manager object handle */
|
/** Get the HK manager object handle */
|
||||||
LocalDataPoolManager* getHkManagerHandle() override;
|
//LocalDataPoolManager* getHkManagerHandle() override;
|
||||||
|
|
||||||
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
||||||
|
|
||||||
AccessLocalPoolIF* getAccessorHandle() override;
|
AccessPoolManagerIF* getAccessorHandle() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hook function for child handlers which is called once per
|
* @brief Hook function for child handlers which is called once per
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
|
DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
|
||||||
lp_id_t heaterRequestId =
|
lp_id_t heaterRequestId =
|
||||||
DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID):
|
DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID):
|
||||||
DeviceHandlerThermalSet(hkOwner->getAccessorHandle()->getCreatorObjectId(), setId,
|
DeviceHandlerThermalSet(hkOwner->getObjectId(), setId,
|
||||||
thermalStateId, heaterRequestId) {}
|
thermalStateId, heaterRequestId) {}
|
||||||
|
|
||||||
DeviceHandlerThermalSet(object_id_t deviceHandler, uint32_t setId =
|
DeviceHandlerThermalSet(object_id_t deviceHandler, uint32_t setId =
|
||||||
|
@ -134,7 +134,7 @@ uint32_t InternalErrorReporter::getStoreHits() {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessLocalPoolIF* InternalErrorReporter::getAccessorHandle() {
|
AccessPoolManagerIF* InternalErrorReporter::getAccessorHandle() {
|
||||||
return &poolManager;
|
return &poolManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +166,6 @@ ReturnValue_t InternalErrorReporter::initializeLocalDataPool(
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataPoolManager* InternalErrorReporter::getHkManagerHandle() {
|
|
||||||
return &poolManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
dur_millis_t InternalErrorReporter::getPeriodicOperationFrequency() const {
|
dur_millis_t InternalErrorReporter::getPeriodicOperationFrequency() const {
|
||||||
return this->executingTask->getPeriodMs();
|
return this->executingTask->getPeriodMs();
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,10 @@ public:
|
|||||||
virtual ReturnValue_t initializeLocalDataPool(
|
virtual ReturnValue_t initializeLocalDataPool(
|
||||||
LocalDataPool& localDataPoolMap,
|
LocalDataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
|
||||||
virtual dur_millis_t getPeriodicOperationFrequency() const override;
|
virtual dur_millis_t getPeriodicOperationFrequency() const override;
|
||||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
|
||||||
AccessLocalPoolIF* getAccessorHandle() override;
|
AccessPoolManagerIF* getAccessorHandle() override;
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user