diff --git a/src/fsfw/datapoollocal/PeriodicHkGenerationHelper.cpp b/src/fsfw/datapoollocal/PeriodicHkGenerationHelper.cpp index f3cf5670..191b6010 100644 --- a/src/fsfw/datapoollocal/PeriodicHkGenerationHelper.cpp +++ b/src/fsfw/datapoollocal/PeriodicHkGenerationHelper.cpp @@ -55,7 +55,7 @@ ReturnValue_t PeriodicHkGenerationHelper::initialize(MessageQueueIF* queueToUse) } } - owner->specifyDatasets(setList); + owner->specifyHkDatasets(setList); return returnvalue::OK; } @@ -150,7 +150,7 @@ ReturnValue_t PeriodicHkGenerationHelper::generateHousekeepingPacket(sid_t sid, if (result != returnvalue::OK) { return result; } - result = owner->serializeDataset(sid, dataPtr, maxSize); + result = owner->serializeHkDataset(sid, dataPtr, maxSize); if (result != returnvalue::OK) { return result; } diff --git a/src/fsfw/datapoollocal/PeriodicHkGenerationIF.h b/src/fsfw/datapoollocal/PeriodicHkGenerationIF.h index b6b76eb9..469812ef 100644 --- a/src/fsfw/datapoollocal/PeriodicHkGenerationIF.h +++ b/src/fsfw/datapoollocal/PeriodicHkGenerationIF.h @@ -53,9 +53,9 @@ class PeriodicHkGenerationIF { /** Command queue for housekeeping messages. */ [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0; - virtual ReturnValue_t serializeDataset(sid_t structureId, uint8_t* buf, size_t maxSize) = 0; + virtual ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t* buf, size_t maxSize) = 0; - virtual ReturnValue_t specifyDatasets(std::vector& setList) = 0; + virtual ReturnValue_t specifyHkDatasets(std::vector& setList) = 0; virtual localpool::SharedPool* getOptionalSharedPool() = 0; diff --git a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp index 810f3438..93097919 100644 --- a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.cpp @@ -127,17 +127,6 @@ ReturnValue_t FreshDeviceHandlerBase::connectModeTreeParent(HasModeTreeChildrenI // Executable Overrides. void FreshDeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; } -// Pool Manager overrides. -// PeriodicHkGenerationHelper* FreshDeviceHandlerBase::getHkManagerHandle() { return &hkHelper; } - -//[[nodiscard]] uint32_t FreshDeviceHandlerBase::getPeriodicOperationFrequency() const { -// return this->executingTask->getPeriodMs(); -//} - -ReturnValue_t FreshDeviceHandlerBase::initializeAfterTaskCreation() { - // return poolManager.initializeAfterTaskCreation(); -} - ReturnValue_t FreshDeviceHandlerBase::setHealth(HasHealthIF::HealthState health) { // Assembly should handle commanding to OFF. healthHelper.setHealth(health); diff --git a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h index 775b0b03..549c7193 100644 --- a/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/FreshDeviceHandlerBase.h @@ -56,11 +56,7 @@ class FreshDeviceHandlerBase : public SystemObject, ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override; ModeTreeChildIF& getModeTreeChildIF() override; - // [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override; - protected: - // Pool Manager overrides. - // PeriodicHkGenerationHelper* getHkManagerHandle() override; ActionHelper actionHelper; ModeHelper modeHelper; HealthHelper healthHelper; @@ -129,7 +125,6 @@ class FreshDeviceHandlerBase : public SystemObject, const uint8_t* data, size_t size) override = 0; // Executable overrides. virtual ReturnValue_t performOperation(uint8_t opCode) override; - ReturnValue_t initializeAfterTaskCreation() override; /** * This calls the FDIR instance event trigger function. diff --git a/src/fsfw/internalerror/InternalErrorReporter.cpp b/src/fsfw/internalerror/InternalErrorReporter.cpp index e2cd292f..c4e4a781 100644 --- a/src/fsfw/internalerror/InternalErrorReporter.cpp +++ b/src/fsfw/internalerror/InternalErrorReporter.cpp @@ -31,6 +31,20 @@ void InternalErrorReporter::setDiagnosticPrintout(bool enable) { this->diagnosticPrintout = enable; } +ReturnValue_t InternalErrorReporter::initialize() { + ReturnValue_t result = hkHelper.initialize(commandQueue); + if (result != returnvalue::OK) { + return result; + } + + sharedPool.addPoolEntry(errorPoolIds::STORE_HITS, &storeHitsEntry); + sharedPool.addPoolEntry(errorPoolIds::TM_HITS, &tmHitsEntry); + sharedPool.addPoolEntry(errorPoolIds::QUEUE_HITS, &queueHitsEntry); + sharedPool.addPoolEntry(errorPoolIds::VALID, &setIsValid); + internalErrorDataset.valid= false; + return SystemObject::initialize(); +} + ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) { CommandMessage message; ReturnValue_t result = commandQueue->receiveMessage(&message); @@ -131,36 +145,15 @@ MessageQueueId_t InternalErrorReporter::getCommandQueue() const { return this->commandQueue->getId(); } -// TODO: Fix -/* -ReturnValue_t InternalErrorReporter::initializeLocalDataPool( - localpool::DataPool &localDataPoolMap, PeriodicHkGenerationHelper &poolManager) { - localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry); - localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry); - localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry); - poolManager.enablePeriodicPacket(internalErrorSid, generationFrequency); - internalErrorDataset.valid = false; - return returnvalue::OK; -} - */ - void InternalErrorReporter::setTaskIF(PeriodicTaskIF *task) { this->executingTask = task; } -ReturnValue_t InternalErrorReporter::initialize() { - ReturnValue_t result = hkHelper.initialize(commandQueue); - if (result != returnvalue::OK) { - return result; - } - return SystemObject::initialize(); -} - void InternalErrorReporter::setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) { this->timeoutType = timeoutType; this->timeoutMs = timeoutMs; } -ReturnValue_t InternalErrorReporter::serializeDataset(sid_t structureId, uint8_t *buf, - size_t maxSize) { +ReturnValue_t InternalErrorReporter::serializeHkDataset(sid_t structureId, uint8_t *buf, + size_t maxSize) { if (structureId == internalErrorDataset.getSid()) { size_t serSize = 0; return internalErrorDataset.serialize(buf, serSize, maxSize, SerializeIF::Endianness::NETWORK); @@ -168,11 +161,11 @@ ReturnValue_t InternalErrorReporter::serializeDataset(sid_t structureId, uint8_t return returnvalue::FAILED; } -ReturnValue_t InternalErrorReporter::specifyDatasets( +ReturnValue_t InternalErrorReporter::specifyHkDatasets( std::vector &setSpecification) { - setSpecification.push_back(periodicHk::SetSpecification(internalErrorDataset.getSid(), + setSpecification.emplace_back(internalErrorDataset.getSid(), internalErrorDataset.getSerializedSize(), - generationFrequency)); + generationFrequency); return returnvalue::OK; } diff --git a/src/fsfw/internalerror/InternalErrorReporter.h b/src/fsfw/internalerror/InternalErrorReporter.h index 22943000..43f03bcd 100644 --- a/src/fsfw/internalerror/InternalErrorReporter.h +++ b/src/fsfw/internalerror/InternalErrorReporter.h @@ -40,9 +40,9 @@ class InternalErrorReporter : public SystemObject, localpool::SharedPool* getOptionalSharedPool() override; - ReturnValue_t serializeDataset(sid_t structureId, uint8_t* buf, size_t maxSize) override; + ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t* buf, size_t maxSize) override; - ReturnValue_t specifyDatasets( + ReturnValue_t specifyHkDatasets( std::vector& setSpecification) override; ReturnValue_t initialize() override; @@ -77,6 +77,7 @@ class InternalErrorReporter : public SystemObject, uint32_t queueHits = 0; uint32_t tmHits = 0; uint32_t storeHits = 0; + PoolEntry setIsValid = PoolEntry(); PoolEntry tmHitsEntry = PoolEntry(); PoolEntry storeHitsEntry = PoolEntry(); PoolEntry queueHitsEntry = PoolEntry(); diff --git a/unittests/mocks/DeviceHandlerMock.cpp b/unittests/mocks/DeviceHandlerMock.cpp index 73ae2f7f..56502f3d 100644 --- a/unittests/mocks/DeviceHandlerMock.cpp +++ b/unittests/mocks/DeviceHandlerMock.cpp @@ -109,11 +109,11 @@ ReturnValue_t DeviceHandlerMock::initialize() { return result; } -ReturnValue_t DeviceHandlerMock::serializeDataset(sid_t structureId, uint8_t *buf, size_t maxSize) { +ReturnValue_t DeviceHandlerMock::serializeHkDataset(sid_t structureId, uint8_t *buf, size_t maxSize) { return returnvalue::OK; } -ReturnValue_t DeviceHandlerMock::specifyDatasets( +ReturnValue_t DeviceHandlerMock::specifyHkDatasets( std::vector &setList) { return returnvalue::OK; } diff --git a/unittests/mocks/DeviceHandlerMock.h b/unittests/mocks/DeviceHandlerMock.h index 788554bb..0de1ad38 100644 --- a/unittests/mocks/DeviceHandlerMock.h +++ b/unittests/mocks/DeviceHandlerMock.h @@ -23,9 +23,9 @@ class DeviceHandlerMock : public DeviceHandlerBase { ReturnValue_t initialize() override; - ReturnValue_t serializeDataset(sid_t structureId, uint8_t *buf, size_t maxSize) override; + ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t *buf, size_t maxSize) override; - ReturnValue_t specifyDatasets(std::vector &setList) override; + ReturnValue_t specifyHkDatasets(std::vector &setList) override; localpool::SharedPool *getOptionalSharedPool() override; diff --git a/unittests/mocks/LocalPoolOwnerBase.cpp b/unittests/mocks/LocalPoolOwnerBase.cpp index 781cd38b..f4e88fb0 100644 --- a/unittests/mocks/LocalPoolOwnerBase.cpp +++ b/unittests/mocks/LocalPoolOwnerBase.cpp @@ -24,12 +24,12 @@ ReturnValue_t LocalPoolOwnerBase::initialize() { localpool::SharedPool *LocalPoolOwnerBase::getOptionalSharedPool() { return &sharedPool; } -ReturnValue_t LocalPoolOwnerBase::serializeDataset(sid_t structureId, uint8_t *buf, - size_t maxSize) { +ReturnValue_t LocalPoolOwnerBase::serializeHkDataset(sid_t structureId, uint8_t *buf, + size_t maxSize) { return returnvalue::OK; } -ReturnValue_t LocalPoolOwnerBase::specifyDatasets( +ReturnValue_t LocalPoolOwnerBase::specifyHkDatasets( std::vector &setList) { return returnvalue::OK; } diff --git a/unittests/mocks/LocalPoolOwnerBase.h b/unittests/mocks/LocalPoolOwnerBase.h index 1299c50c..d1437f26 100644 --- a/unittests/mocks/LocalPoolOwnerBase.h +++ b/unittests/mocks/LocalPoolOwnerBase.h @@ -70,9 +70,9 @@ class LocalPoolOwnerBase : public SystemObject, public PeriodicHkGenerationIF { [[nodiscard]] object_id_t getObjectId() const override { return SystemObject::getObjectId(); } - ReturnValue_t serializeDataset(sid_t structureId, uint8_t* buf, size_t maxSize) override; + ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t* buf, size_t maxSize) override; - ReturnValue_t specifyDatasets(std::vector& setList) override; + ReturnValue_t specifyHkDatasets(std::vector& setList) override; localpool::SharedPool* getOptionalSharedPool() override; ReturnValue_t initialize() override;