trying new interface
This commit is contained in:
parent
0bf0d8e743
commit
037bd83af9
@ -113,3 +113,8 @@ LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
|
|||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProvidesDataPoolSubscriptionIF* ExtendedControllerBase::getSubsciptionInterface(
|
||||||
|
) {
|
||||||
|
return &localPoolManager;
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
|
ProvidesDataPoolSubscriptionIF* getSubsciptionInterface() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LocalDataPoolManager localPoolManager;
|
LocalDataPoolManager localPoolManager;
|
||||||
ActionHelper actionHelper;
|
ActionHelper actionHelper;
|
||||||
|
17
datapoollocal/AccessLocalDataPoolIF.h
Normal file
17
datapoollocal/AccessLocalDataPoolIF.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_ACCESSLOCALDATAPOOLIF_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_ACCESSLOCALDATAPOOLIF_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||||
|
|
||||||
|
|
||||||
|
class AccessLocalDataPoolIF {
|
||||||
|
public:
|
||||||
|
virtual ~AccessLocalDataPoolIF() {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_ACCESSLOCALDATAPOOLIF_H_ */
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
#ifndef FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
||||||
|
|
||||||
|
#include "ProvidesDataPoolSubscriptionIF.h"
|
||||||
#include "locPoolDefinitions.h"
|
#include "locPoolDefinitions.h"
|
||||||
|
|
||||||
#include "../datapool/PoolEntryIF.h"
|
#include "../datapool/PoolEntryIF.h"
|
||||||
@ -40,8 +41,9 @@ using LocalDataPoolMapIter = LocalDataPool::iterator;
|
|||||||
* of the LocalDataPoolManager.
|
* of the LocalDataPoolManager.
|
||||||
*/
|
*/
|
||||||
class HasLocalDataPoolIF {
|
class HasLocalDataPoolIF {
|
||||||
friend class LocalPoolDataSetBase;
|
friend class LocalDataPoolManager;
|
||||||
friend class LocalPoolObjectBase;
|
//friend class LocalPoolDataSetBase;
|
||||||
|
//friend class LocalPoolObjectBase;
|
||||||
public:
|
public:
|
||||||
virtual~ HasLocalDataPoolIF() {};
|
virtual~ HasLocalDataPoolIF() {};
|
||||||
|
|
||||||
@ -73,36 +75,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual uint32_t getPeriodicOperationFrequency() const = 0;
|
virtual uint32_t getPeriodicOperationFrequency() const = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used by the pool manager to get a valid dataset
|
|
||||||
* from a SID
|
|
||||||
* @param sid Corresponding structure ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
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) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden"
|
|
||||||
<< ". Returning nullptr!" << std::endl;
|
|
||||||
#else
|
|
||||||
fsfw::printWarning("HasLocalDataPoolIF::getPoolObjectHandle: "
|
|
||||||
"Not overriden. Returning nullptr!\n");
|
|
||||||
#endif
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function will be called by the manager if an update
|
* @brief This function will be called by the manager if an update
|
||||||
* notification is received.
|
* notification is received.
|
||||||
* @details
|
* @details HasLocalDataPoolIF
|
||||||
* Can be overriden by the child class to handle changed datasets.
|
* Can be overriden by the child class to handle changed datasets.
|
||||||
* @param sid
|
* @param sid
|
||||||
* @param storeId If a snapshot was requested, data will be located inside
|
* @param storeId If a snapshot was requested, data will be located inside
|
||||||
@ -127,8 +103,10 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These function can be implemented by pool owner, as they are required
|
/**
|
||||||
* by the housekeeping message interface */
|
* These function can be implemented by pool owner, if they are required
|
||||||
|
* and used by the housekeeping message interface.
|
||||||
|
* */
|
||||||
virtual ReturnValue_t addDataSet(sid_t sid) {
|
virtual ReturnValue_t addDataSet(sid_t sid) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
};
|
};
|
||||||
@ -140,11 +118,50 @@ public:
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function can be used by data pool consumers to retrieve a handle
|
||||||
|
* which allows subscriptions to dataset and variable updates.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
virtual ProvidesDataPoolSubscriptionIF* getSubsciptionInterface() = 0;
|
virtual ProvidesDataPoolSubscriptionIF* getSubsciptionInterface() = 0;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Can be used to get a handle to the local data pool manager. */
|
/**
|
||||||
|
* 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;
|
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used by the pool manager to get a valid dataset
|
||||||
|
* from a SID. This function is protected to prevent users from
|
||||||
|
* using raw data set pointers which could not be thread-safe. Users
|
||||||
|
* should use the #ProvidesDataPoolSubscriptionIF.
|
||||||
|
* @param sid Corresponding structure ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
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. This function is protected to prevent users from
|
||||||
|
* using raw pool variable pointers which could not be thread-safe.
|
||||||
|
* Users should use the #ProvidesDataPoolSubscriptionIF.
|
||||||
|
* @param localPoolId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden"
|
||||||
|
<< ". Returning nullptr!" << std::endl;
|
||||||
|
#else
|
||||||
|
fsfw::printWarning("HasLocalDataPoolIF::getPoolObjectHandle: "
|
||||||
|
"Not overriden. Returning nullptr!\n");
|
||||||
|
#endif
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_ */
|
#endif /* FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_ */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_
|
#define FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h>
|
#include "ProvidesDataPoolSubscriptionIF.h"
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
|
|
||||||
#include "../serviceinterface/ServiceInterface.h"
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
LocalPoolDataSetBase::LocalPoolDataSetBase(AccessLocalDataPoolIF *hkOwner,
|
||||||
uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables, bool periodicHandling):
|
const size_t maxNumberOfVariables, bool periodicHandling):
|
||||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
#include "MarkChangedIF.h"
|
#include "MarkChangedIF.h"
|
||||||
|
#include "AccessLocalDataPoolIF.h"
|
||||||
|
|
||||||
#include "../datapool/DataSetIF.h"
|
#include "../datapool/DataSetIF.h"
|
||||||
#include "../datapool/PoolDataSetBase.h"
|
#include "../datapool/PoolDataSetBase.h"
|
||||||
@ -42,7 +43,8 @@ class PeriodicHousekeepingHelper;
|
|||||||
* @ingroup data_pool
|
* @ingroup data_pool
|
||||||
*/
|
*/
|
||||||
class LocalPoolDataSetBase: public PoolDataSetBase,
|
class LocalPoolDataSetBase: public PoolDataSetBase,
|
||||||
public MarkChangedIF {
|
public MarkChangedIF,
|
||||||
|
public AccessLocalDataPoolIF {
|
||||||
friend class LocalDataPoolManager;
|
friend class LocalDataPoolManager;
|
||||||
friend class PeriodicHousekeepingHelper;
|
friend class PeriodicHousekeepingHelper;
|
||||||
public:
|
public:
|
||||||
@ -52,7 +54,7 @@ public:
|
|||||||
* This constructor also initializes the components required for
|
* This constructor also initializes the components required for
|
||||||
* periodic handling.
|
* periodic handling.
|
||||||
*/
|
*/
|
||||||
LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
LocalPoolDataSetBase(AccessLocalDataPoolIF *hkOwner,
|
||||||
uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables, bool periodicHandling = true);
|
const size_t maxNumberOfVariables, bool periodicHandling = true);
|
||||||
|
|
||||||
@ -218,7 +220,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;
|
||||||
LocalDataPoolManager* hkManager = nullptr;
|
AccessLocalDataPoolIF* hkManager = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ protected:
|
|||||||
ReadWriteMode_t readWriteMode = pool_rwm_t::VAR_READ_WRITE;
|
ReadWriteMode_t readWriteMode = pool_rwm_t::VAR_READ_WRITE;
|
||||||
|
|
||||||
//! @brief Pointer to the class which manages the HK pool.
|
//! @brief Pointer to the class which manages the HK pool.
|
||||||
LocalDataPoolManager* hkManager;
|
LocalDataPoolManager* hkManager = nullptr;
|
||||||
|
|
||||||
void reportReadCommitError(const char* variableType,
|
void reportReadCommitError(const char* variableType,
|
||||||
ReturnValue_t error, bool read, object_id_t objectId, lp_id_t lpId);
|
ReturnValue_t error, bool read, object_id_t objectId, lp_id_t lpId);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/locPoolDefinitions.h>
|
#include <fsfw/datapoollocal/locPoolDefinitions.h>
|
||||||
#include <fsfw/ipc/messageQueueDefinitions.h>
|
#include <fsfw/ipc/messageQueueDefinitions.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProvidesDataPoolSubscriptionIF{
|
class ProvidesDataPoolSubscriptionIF {
|
||||||
public:
|
public:
|
||||||
virtual ~ProvidesDataPoolSubscriptionIF(){};
|
virtual ~ProvidesDataPoolSubscriptionIF(){};
|
||||||
|
|
||||||
@ -77,3 +80,5 @@ public:
|
|||||||
bool generateSnapshot) = 0;
|
bool generateSnapshot) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_ */
|
||||||
|
@ -1532,3 +1532,7 @@ void DeviceHandlerBase::printWarningOrError(fsfw::OutputTypes errorType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProvidesDataPoolSubscriptionIF* DeviceHandlerBase::getSubsciptionInterface() {
|
||||||
|
return &hkManager;
|
||||||
|
}
|
||||||
|
@ -518,7 +518,9 @@ protected:
|
|||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
|
||||||
/** Get the HK manager object handle */
|
/** Get the HK manager object handle */
|
||||||
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
LocalDataPoolManager* getHkManagerHandle() override;
|
||||||
|
|
||||||
|
ProvidesDataPoolSubscriptionIF* getSubsciptionInterface() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hook function for child handlers which is called once per
|
* @brief Hook function for child handlers which is called once per
|
||||||
|
@ -195,3 +195,8 @@ void InternalErrorReporter::setMutexTimeout(MutexIF::TimeoutType timeoutType,
|
|||||||
this->timeoutType = timeoutType;
|
this->timeoutType = timeoutType;
|
||||||
this->timeoutMs = timeoutMs;
|
this->timeoutMs = timeoutMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProvidesDataPoolSubscriptionIF* InternalErrorReporter::getSubsciptionInterface(
|
||||||
|
) {
|
||||||
|
return &poolManager;
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
virtual LocalDataPoolManager* getHkManagerHandle() 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* getSubsciptionInterface() 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