continue cleaning up

This commit is contained in:
Robin Müller 2024-11-05 17:40:56 +01:00
parent 583fe177db
commit d2bc99baf3
10 changed files with 35 additions and 57 deletions

View File

@ -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;
}

View File

@ -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<periodicHk::SetSpecification>& setList) = 0;
virtual ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification>& setList) = 0;
virtual localpool::SharedPool* getOptionalSharedPool() = 0;

View File

@ -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);

View File

@ -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.

View File

@ -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<periodicHk::SetSpecification> &setSpecification) {
setSpecification.push_back(periodicHk::SetSpecification(internalErrorDataset.getSid(),
setSpecification.emplace_back(internalErrorDataset.getSid(),
internalErrorDataset.getSerializedSize(),
generationFrequency));
generationFrequency);
return returnvalue::OK;
}

View File

@ -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<periodicHk::SetSpecification>& 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<uint8_t> setIsValid = PoolEntry<uint8_t>();
PoolEntry<uint32_t> tmHitsEntry = PoolEntry<uint32_t>();
PoolEntry<uint32_t> storeHitsEntry = PoolEntry<uint32_t>();
PoolEntry<uint32_t> queueHitsEntry = PoolEntry<uint32_t>();

View File

@ -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<periodicHk::SetSpecification> &setList) {
return returnvalue::OK;
}

View File

@ -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<periodicHk::SetSpecification> &setList) override;
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification> &setList) override;
localpool::SharedPool *getOptionalSharedPool() override;

View File

@ -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<periodicHk::SetSpecification> &setList) {
return returnvalue::OK;
}

View File

@ -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<periodicHk::SetSpecification>& setList) override;
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification>& setList) override;
localpool::SharedPool* getOptionalSharedPool() override;
ReturnValue_t initialize() override;