refactor periodic HK helpers

This commit is contained in:
2024-11-04 17:32:21 +01:00
parent f90241bdd6
commit b1bd0d3af7
66 changed files with 993 additions and 1710 deletions

View File

@ -17,7 +17,7 @@ ReturnValue_t LocalPoolOwnerBase::initializeHkManager() {
}
ReturnValue_t LocalPoolOwnerBase::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
PeriodicHkGenerationHelper &poolManager) {
// Default initialization empty for now.
localDataPoolMap.emplace(lpool::uint8VarId, &u8PoolEntry);
localDataPoolMap.emplace(lpool::floatVarId, &floatPoolEntry);
@ -45,7 +45,7 @@ LocalPoolObjectBase *LocalPoolOwnerBase::getPoolObjectHandle(lp_id_t localPoolId
}
ReturnValue_t LocalPoolOwnerBase::reset() {
resetSubscriptionList();
// resetSubscriptionList();
ReturnValue_t status = returnvalue::OK;
{
PoolReadGuard readHelper(&dataset);
@ -57,7 +57,7 @@ ReturnValue_t LocalPoolOwnerBase::reset() {
dataset.localPoolUint16Vec.value[0] = 0;
dataset.localPoolUint16Vec.value[1] = 0;
dataset.localPoolUint16Vec.value[2] = 0;
dataset.setValidity(false, true);
// dataset.setValidity(false, true);
}
{
@ -66,7 +66,7 @@ ReturnValue_t LocalPoolOwnerBase::reset() {
status = readHelper.getReadResult();
}
testUint32.value = 0;
testUint32.setValid(false);
// testUint32.setValid(false);
}
{
@ -76,7 +76,7 @@ ReturnValue_t LocalPoolOwnerBase::reset() {
}
testInt64Vec.value[0] = 0;
testInt64Vec.value[1] = 0;
testInt64Vec.setValid(false);
// testInt64Vec.setValid(false);
}
return status;
}
@ -93,11 +93,13 @@ bool LocalPoolOwnerBase::changedDataSetCallbackWasCalled(sid_t &sid, store_addre
return condition;
}
/*
void LocalPoolOwnerBase::handleChangedDataset(sid_t sid, store_address_t storeId,
bool *clearMessage) {
this->changedDatasetSid = sid;
this->storeIdForChangedSet = storeId;
}
*/
bool LocalPoolOwnerBase::changedVariableCallbackWasCalled(gp_id_t &gpid, store_address_t &storeId) {
bool condition = false;
@ -119,10 +121,12 @@ ReturnValue_t LocalPoolOwnerBase::initializeHkManagerAfterTaskCreation() {
return returnvalue::OK;
}
/*
void LocalPoolOwnerBase::handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
bool *clearMessage) {
this->changedPoolVariableGpid = globPoolId;
this->storeIdForChangedVariable = storeId;
}
*/
void LocalPoolOwnerBase::setHkDestId(MessageQueueId_t id) { poolManager.setHkDestinationId(id); }

View File

@ -37,7 +37,7 @@ class LocalPoolStaticTestDataSet : public StaticLocalDataSet<3> {
public:
LocalPoolStaticTestDataSet() : StaticLocalDataSet(lpool::testSid) {}
LocalPoolStaticTestDataSet(HasLocalDataPoolIF* owner, uint32_t setId)
LocalPoolStaticTestDataSet(PeriodicHkGenerationIF* owner, uint32_t setId)
: StaticLocalDataSet(owner, setId) {}
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
@ -51,7 +51,7 @@ class LocalPoolTestDataSet : public LocalDataSet {
public:
LocalPoolTestDataSet() : LocalDataSet(lpool::testSid, lpool::dataSetMaxVariables) {}
LocalPoolTestDataSet(HasLocalDataPoolIF* owner, uint32_t setId)
LocalPoolTestDataSet(PeriodicHkGenerationIF* owner, uint32_t setId)
: LocalDataSet(owner, setId, lpool::dataSetMaxVariables) {}
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
@ -61,7 +61,7 @@ class LocalPoolTestDataSet : public LocalDataSet {
private:
};
class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
class LocalPoolOwnerBase : public SystemObject, public PeriodicHkGenerationIF {
public:
explicit LocalPoolOwnerBase(MessageQueueIF& queue,
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE);
@ -81,11 +81,11 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
// This is called by initializeAfterTaskCreation of the HK manager.
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
PeriodicHkGenerationHelper& poolManager) override;
LocalDataPoolManager* getHkManagerHandle() override { return &poolManager; }
PeriodicHkGenerationHelper* getHkManagerHandle() override { return &poolManager; }
[[nodiscard]] dur_millis_t getPeriodicOperationFrequency() const override { return 200; }
//[[nodiscard]] dur_millis_t getPeriodicOperationFrequency() const override { return 200; }
/**
* This function is used by the pool manager to get a valid dataset
@ -102,7 +102,7 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
}
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
return poolManager.subscribeForRegularPeriodicPacket(
return poolManager.enableRegularPeriodicPacket(
subdp::RegularHkPeriodicParams(lpool::testSid, enableReporting, 0.2));
}
@ -145,21 +145,21 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
ReturnValue_t reset();
void resetSubscriptionList() { poolManager.clearReceiversList(); }
// void resetSubscriptionList() { poolManager.clearReceiversList(); }
bool changedDataSetCallbackWasCalled(sid_t& sid, store_address_t& storeId);
bool changedVariableCallbackWasCalled(gp_id_t& gpid, store_address_t& storeId);
LocalDataPoolManager poolManager;
PeriodicHkGenerationHelper poolManager;
LocalPoolTestDataSet dataset;
private:
void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override;
// void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override;
sid_t changedDatasetSid;
store_address_t storeIdForChangedSet;
void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
bool* clearMessage) override;
// void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
// bool* clearMessage) override;
gp_id_t changedPoolVariableGpid;
store_address_t storeIdForChangedVariable;