From a30146a799201473e27c16c6b4fc2d06c0af3c04 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 14 Jul 2023 14:11:22 +0200 Subject: [PATCH] working on TM --- src/fsfw/CMakeLists.txt | 2 +- src/fsfw/action/Action.h | 29 ++++++--- src/fsfw/action/ActionHelper.cpp | 19 +++++- src/fsfw/action/HasActionsIF.h | 3 +- src/fsfw/datapool/DatapoolHelper.cpp | 8 ++- src/fsfw/datapool/DatapoolHelper.h | 17 +++-- src/fsfw/datapool/Dataset.cpp | 39 +++++------ src/fsfw/datapool/Dataset.h | 27 +++----- src/fsfw/datapool/HasDatapoolIF.h | 6 +- src/fsfw/datapool/TemplateSet.h | 4 +- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 2 + src/fsfw/devicehandlers/DeviceHandlerBase.h | 1 + src/fsfw/housekeeping/CMakeLists.txt | 6 +- .../housekeeping/GeneratesHousekeepingIF.h | 12 +++- src/fsfw/housekeeping/HousekeepingHelper.cpp | 25 +++++++- src/fsfw/housekeeping/HousekeepingHelper.h | 8 ++- src/fsfw/housekeeping/HousekeepingSet.cpp | 64 +++++++++++++++++-- src/fsfw/housekeeping/HousekeepingSet.h | 19 +++++- src/fsfw/introspection/HasTmTcParametersIF.h | 13 ++-- src/fsfw/returnvalues/FwClassIds.h | 1 + src/fsfw/tmtc/UdpTmTcBridge.cpp | 2 +- 21 files changed, 213 insertions(+), 94 deletions(-) diff --git a/src/fsfw/CMakeLists.txt b/src/fsfw/CMakeLists.txt index cc6e9975c..f84f4ab8e 100644 --- a/src/fsfw/CMakeLists.txt +++ b/src/fsfw/CMakeLists.txt @@ -13,7 +13,7 @@ add_subdirectory(events) add_subdirectory(fdir) add_subdirectory(globalfunctions) add_subdirectory(health) -#add_subdirectory(housekeeping) +add_subdirectory(housekeeping) add_subdirectory(internalerror) add_subdirectory(introspection) add_subdirectory(ipc) diff --git a/src/fsfw/action/Action.h b/src/fsfw/action/Action.h index f0ca4cc7c..89ed34234 100644 --- a/src/fsfw/action/Action.h +++ b/src/fsfw/action/Action.h @@ -1,29 +1,38 @@ #pragma once +#include +#include #include #include -#include #include "ActionMessage.h" -#include - #ifdef FSFW_INTROSPECTION #include "../introspection/Enum.h" #endif -//TODO ActionId_t +// TODO ActionId_t -class Action: public SerializeIF, public HasTmTcParametersIF { +class Action : public SerializeIF, public HasTmTcParametersIF { public: #ifdef FSFW_INTROSPECTION Action(); - void setEnum(EnumIF* id); + void setEnum(EnumIF *id); const char *getName(); #else Action(ActionId_t id); #endif + + store_address_t getTc(); + size_t getTcOffset(); + + // if an action is triggered by a TC, this should be set to be able to handle replies + // TODO make deleting it safe + // TODO integrate with internal commands + store_address_t tc; + size_t tcOffset; + ActionId_t getId(); MessageQueueId_t commandedBy; @@ -32,19 +41,19 @@ class Action: public SerializeIF, public HasTmTcParametersIF { void registerParameter(ParameterIF *parameter) override; - std::vector const *getParameters() const; + std::vector const *getParameters() const override; ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, - Endianness streamEndianness) const override; + Endianness streamEndianness) const override; size_t getSerializedSize() const override; ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, - Endianness streamEndianness) override; + Endianness streamEndianness) override; private: ActionId_t id; - + #ifdef FSFW_INTROSPECTION const char *name; #endif diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp index 2f24641fb..ee505c9a4 100644 --- a/src/fsfw/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -81,9 +81,22 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, size_t offset, return; } + FsfwProtocolHeader header; + const uint8_t* dataPtr = tcData + offset; size_t size = tcDataSize - offset; + result = header.deSerialize(&dataPtr, &size, SerializeIF::Endianness::NETWORK); + + if (header.getInterface() != HasActionsIF::INTERFACE_ID or + header.getFunction() != HasActionsIF::Functions::EXECUTE_ACTION) { + CommandMessage reply; + ActionMessage::setStepReply(&reply, 0 /*TODO*/, 0, result); + // queueToUse->sendMessage(commandedBy, &reply); + ipcStore->deleteData(dataAddress); + return; + } + ActionId_t actionId; result = @@ -118,8 +131,10 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, size_t offset, action->commandedBy = commandedBy; result = owner->executeAction(action); - result = - tmManager->sendTmPacket(0xff, HasActionsIF::INTERFACE_ID, 0x13, action, dataAddress, offset); + // TODO safetify dynamic cast + result = tmManager->sendTmPacket(dynamic_cast(owner)->getObjectId(), HasActionsIF::INTERFACE_ID, + HasActionsIF::Functions::EXECUTION_IN_PROGRESS, action, + dataAddress, offset); if (result != returnvalue::OK) { sif::error << "replying action failed " << std::hex << result << std::dec << std::endl; } diff --git a/src/fsfw/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h index 604528db3..1a1ca0985 100644 --- a/src/fsfw/action/HasActionsIF.h +++ b/src/fsfw/action/HasActionsIF.h @@ -7,6 +7,7 @@ #include "SimpleActionHelper.h" #include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/returnvalues/returnvalue.h" +#include /** * @brief @@ -42,7 +43,7 @@ class HasActionsIF { static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3); static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4); - enum class FUNCTIONS : uint8_t { EXECUTE_ACTION }; + enum Functions : FsfwProtocolHeader::FunctionType_t { EXECUTE_ACTION, EXECUTION_IN_PROGRESS }; virtual ~HasActionsIF() = default; /** diff --git a/src/fsfw/datapool/DatapoolHelper.cpp b/src/fsfw/datapool/DatapoolHelper.cpp index cd0b2fa84..cb3877245 100644 --- a/src/fsfw/datapool/DatapoolHelper.cpp +++ b/src/fsfw/datapool/DatapoolHelper.cpp @@ -1,10 +1,12 @@ #include "DatapoolHelper.h" -DatapoolHelper::DatapoolHelper() {} +DatapoolHelper::DatapoolHelper(HasDatapoolIF* owner) : HousekeepingHelper(owner) {} -DatapoolHelper::~DatapoolHelper() {} +ReturnValue_t DatapoolHelper::initialize() { + return HousekeepingHelper::initialize(); +} -const Dataset* DatapoolHelper::getDataSet(DataSetId_t id) { +const Dataset* DatapoolHelper::getDataSet(HousekeepingSetId_t id) { auto iter = dataSets.find(id); if (iter == dataSets.end()) { return nullptr; diff --git a/src/fsfw/datapool/DatapoolHelper.h b/src/fsfw/datapool/DatapoolHelper.h index 967c1b561..d4f9a8c35 100644 --- a/src/fsfw/datapool/DatapoolHelper.h +++ b/src/fsfw/datapool/DatapoolHelper.h @@ -1,23 +1,28 @@ #pragma once #include "Dataset.h" +#include "HasDatapoolIF.h" + +#include #include #include -class DatapoolHelper { +class DatapoolHelper : public HousekeepingHelper { public: - DatapoolHelper(); - ~DatapoolHelper(); + DatapoolHelper(HasDatapoolIF *owner); + ~DatapoolHelper() = default; - const Dataset* getDataSet(DataSetId_t id); + const Dataset* getDataSet(HousekeepingSetId_t id); - const std::map* getDatasets() const { + const std::map* getDatasets() const { return &dataSets; } void registerSet(Dataset* set); + ReturnValue_t initialize(); + private: - std::map dataSets; + std::map dataSets; }; diff --git a/src/fsfw/datapool/Dataset.cpp b/src/fsfw/datapool/Dataset.cpp index 1859ada87..9f327db9e 100644 --- a/src/fsfw/datapool/Dataset.cpp +++ b/src/fsfw/datapool/Dataset.cpp @@ -1,35 +1,33 @@ #include "Dataset.h" -#include #include #include +#include + #include "HasDatapoolIF.h" #ifdef FSFW_INTROSPECTION Dataset::Dataset(HasDatapoolIF* owner, bool allowUserCommit) - : allocated(true), allowUserCommit(allowUserCommit) { + : HousekeepingSet(owner), allocated(true), allowUserCommit(allowUserCommit) { this->owner.pointer = owner; mutex = MutexFactory::instance()->createMutex(); } -Dataset::Dataset(uint32_t owner_id ) - : allocated(false), allowUserCommit(false) { +Dataset::Dataset(uint32_t owner_id) + : HousekeepingSet(nullptr), allocated(false), allowUserCommit(false) { this->owner.id = owner_id; } - -void Dataset::setEnum(EnumIF *theEnum) { - id = theEnum->getValue(); - description = theEnum->getDescription(); -} #else -Dataset::Dataset(HasDatapoolIF* owner, DataSetId_t id, bool allowUserCommit) - : allocated(true), allowUserCommit(allowUserCommit), id(id) { +Dataset::Dataset(HasDatapoolIF* owner, HousekeepingSetId_t id, bool allowUserCommit) + : HousekeepingSet(owner, id), allocated(true), allowUserCommit(allowUserCommit) { this->owner.pointer = owner; mutex = MutexFactory::instance()->createMutex(); } -Dataset::Dataset(uint32_t owner_id, DataSetId_t id): id(id) { this->owner.id = owner_id; } +Dataset::Dataset(uint32_t owner_id, HousekeepingSetId_t id) : HousekeepingSet(nullptr, id) { + this->owner.id = owner_id; +} #endif Dataset::~Dataset() { MutexFactory::instance()->deleteMutex(mutex); } @@ -79,20 +77,16 @@ bool Dataset::hasChanged() { bool Dataset::hasChangedOrOlderThan(uint32_t seconds) { bool changed = hasChanged(); - //TODO time + // TODO time read(); return changed; } -uint8_t Dataset::getId() const { - return id; -} - const std::vector* Dataset::getVariables() const { return &variables; } ReturnValue_t Dataset::initialize() { if (allocated) { - //nothing to do + // nothing to do return returnvalue::OK; } HasDatapoolIF* actualOwner = ObjectManager::instance()->get(owner.id); @@ -120,9 +114,6 @@ ReturnValue_t Dataset::initialize() { // operator[] -#ifdef FSFW_INTROSPECTION -const char* Dataset::getDescription() const { return description; } -#endif bool Dataset::registerEntry(DatasetEntryIF* entry) { variables.push_back(entry); @@ -133,10 +124,10 @@ void Dataset::lock() { mutex->lockMutex(MutexIF::TimeoutType::BLOCKING); } void Dataset::unlock() { mutex->unlockMutex(); } -bool Dataset::hasChangedNoRead(){ +bool Dataset::hasChangedNoRead() { bool changed = false; - for (auto variable: variables){ - if (variable->changed()){ + for (auto variable : variables) { + if (variable->changed()) { changed = true; break; } diff --git a/src/fsfw/datapool/Dataset.h b/src/fsfw/datapool/Dataset.h index 38c4a7d86..a1093d5dd 100644 --- a/src/fsfw/datapool/Dataset.h +++ b/src/fsfw/datapool/Dataset.h @@ -4,8 +4,9 @@ #include #include #include -#include +#include +#include #include #include "DatasetEntryIF.h" @@ -14,7 +15,7 @@ // #include "HasDatapoolIF.h" class HasDatapoolIF; -using DataSetId_t = uint32_t; +// TODO allow user commit and reporting TM /** * This class has a dual use @@ -42,18 +43,17 @@ using DataSetId_t = uint32_t; * interpretDeviceReply) */ -class Dataset { +class Dataset: public HousekeepingSet { protected: #ifdef FSFW_INTROSPECTION Dataset(HasDatapoolIF* owner, bool allowUserCommit); Dataset(uint32_t owner_id); - void setEnum(EnumIF* theEnum); #else - Dataset(HasDatapoolIF* owner, DataSetId_t id, bool allowUserCommit); - Dataset(uint32_t owner_id, DataSetId_t id); + Dataset(HasDatapoolIF* owner, HousekeepingSetId_t id, bool allowUserCommit); + Dataset(uint32_t owner_id, HousekeepingSetId_t id); #endif public: - ~Dataset(); + ~Dataset() override; /** * Copy content of local copies into actual variable * @@ -155,26 +155,17 @@ class Dataset { // operator[] - uint8_t getId() const; - -#ifdef FSFW_INTROSPECTION - const char* getDescription() const; -#endif - bool registerEntry(DatasetEntryIF*); protected: bool allocated; bool allowUserCommit; union { - uint32_t id; + object_id_t id; HasDatapoolIF* pointer; } owner; - DataSetId_t id; MutexIF* mutex; -#ifdef FSFW_INTROSPECTION - const char* description; -#endif + std::vector variables; /** diff --git a/src/fsfw/datapool/HasDatapoolIF.h b/src/fsfw/datapool/HasDatapoolIF.h index 5463d88e5..36346a020 100644 --- a/src/fsfw/datapool/HasDatapoolIF.h +++ b/src/fsfw/datapool/HasDatapoolIF.h @@ -1,8 +1,12 @@ #pragma once +//TODO ring +class DatapoolHelper; #include "DatapoolHelper.h" -class HasDatapoolIF { +#include + +class HasDatapoolIF: public GeneratesHousekeepingIF { public: virtual ~HasDatapoolIF() = default; virtual DatapoolHelper* getDatapoolHelper() = 0; diff --git a/src/fsfw/datapool/TemplateSet.h b/src/fsfw/datapool/TemplateSet.h index 1abab9ca9..be554a3e4 100644 --- a/src/fsfw/datapool/TemplateSet.h +++ b/src/fsfw/datapool/TemplateSet.h @@ -16,10 +16,10 @@ class TemplateSet : public Dataset { TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id) { setEnum(&id); } #else TemplateSet(HasDatapoolIF* owner, HkIDs id, bool allowUserCommit) - : Dataset(owner, static_cast(id), allowUserCommit) { + : Dataset(owner, static_cast(id), allowUserCommit) { owner->getDatapoolHelper()->registerSet(this); } - TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id, static_cast(id)) {} + TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id, static_cast(id)) {} #endif virtual ~TemplateSet() = default; }; \ No newline at end of file diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 52f9a21d6..ed1ac280a 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -31,6 +31,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device modeHelper(this), parameterHelper(this), actionHelper(this, nullptr), + datapoolHelper(this), childTransitionFailure(returnvalue::OK), fdirInstance(fdirInstance), defaultFDIRUsed(fdirInstance == nullptr), @@ -1485,6 +1486,7 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() { } DatapoolHelper* DeviceHandlerBase::getDatapoolHelper() { return &datapoolHelper; } +HousekeepingHelper* DeviceHandlerBase::getHousekeepingHelper() { return &datapoolHelper; } void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const char* functionName, ReturnValue_t errorCode, const char* errorPrint) { diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index de17e31bc..521d41c2a 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -528,6 +528,7 @@ class DeviceHandlerBase : public DeviceHandlerIF, virtual void setNormalDatapoolEntriesInvalid(); //TODO DatapoolHelper* getDatapoolHelper() override; + HousekeepingHelper* getHousekeepingHelper() override; /* HasModesIF overrides */ diff --git a/src/fsfw/housekeeping/CMakeLists.txt b/src/fsfw/housekeeping/CMakeLists.txt index 3fc70e047..7ff33d11b 100644 --- a/src/fsfw/housekeeping/CMakeLists.txt +++ b/src/fsfw/housekeeping/CMakeLists.txt @@ -1,4 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE HousekeepingMessage.cpp - PeriodicHousekeepingHelper.cpp - HousekeepingHelper.cpp - HousekeepingSet.cpp) +target_sources(${LIB_FSFW_NAME} PRIVATE HousekeepingHelper.cpp + HousekeepingSet.cpp ) diff --git a/src/fsfw/housekeeping/GeneratesHousekeepingIF.h b/src/fsfw/housekeeping/GeneratesHousekeepingIF.h index 9521b7efd..3372f2b0e 100644 --- a/src/fsfw/housekeeping/GeneratesHousekeepingIF.h +++ b/src/fsfw/housekeeping/GeneratesHousekeepingIF.h @@ -1,10 +1,16 @@ #pragma once +#include + #include "HousekeepingHelper.h" class GeneratesHousekeepingIF { - public: - virtual ~GeneratesHousekeepingIF() = default; + public: + static const uint8_t INTERFACE_ID = CLASS_ID::GENERATES_HOUSEKEEPING; - virtual HousekeepingHelper* getHelper(); + enum Functions : FsfwProtocolHeader::FunctionType_t { REPORT }; + + virtual ~GeneratesHousekeepingIF() = default; + + virtual HousekeepingHelper* getHousekeepingHelper() = 0; }; \ No newline at end of file diff --git a/src/fsfw/housekeeping/HousekeepingHelper.cpp b/src/fsfw/housekeeping/HousekeepingHelper.cpp index 199f06fe0..46a2e9954 100644 --- a/src/fsfw/housekeeping/HousekeepingHelper.cpp +++ b/src/fsfw/housekeeping/HousekeepingHelper.cpp @@ -1,6 +1,17 @@ #include "HousekeepingHelper.h" +#include "GeneratesHousekeepingIF.h" -HousekeepingHelper::HousekeepingHelper() {} +#include + +HousekeepingHelper::HousekeepingHelper(GeneratesHousekeepingIF* owner): owner(owner) {} + +ReturnValue_t HousekeepingHelper::initialize() { + tmManager = ObjectManager::instance()->get(objects::TM_MANAGER); + if (tmManager == nullptr) { + return returnvalue::FAILED; + } + return returnvalue::OK; +} const HousekeepingSet* HousekeepingHelper::getHousekeepingSet(HousekeepingSetId_t id) { auto iter = housekeepingSets.find(id); @@ -14,3 +25,15 @@ void HousekeepingHelper::registerSet(HousekeepingSet* set) { auto id = set->getId(); housekeepingSets.emplace(id, set); } + + +ReturnValue_t HousekeepingHelper::reportHousekeeping(HousekeepingSet* set, const Action* action) { + SystemObjectIF* ownerAsObject = dynamic_cast(owner); + if (ownerAsObject == nullptr) { + sif::error << "Duuuuuuuude, what the hell?" << std::endl; + return returnvalue::FAILED; + } + return tmManager->sendTmPacket(ownerAsObject->getObjectId(), GeneratesHousekeepingIF::INTERFACE_ID, + GeneratesHousekeepingIF::Functions::REPORT, set, + action->tc, action->tcOffset); +} \ No newline at end of file diff --git a/src/fsfw/housekeeping/HousekeepingHelper.h b/src/fsfw/housekeeping/HousekeepingHelper.h index d2cfcc500..996a4b4a8 100644 --- a/src/fsfw/housekeeping/HousekeepingHelper.h +++ b/src/fsfw/housekeeping/HousekeepingHelper.h @@ -2,6 +2,7 @@ #include #include +#include #include @@ -11,7 +12,7 @@ class HousekeepingHelper { friend class HousekeepingSet; public: - HousekeepingHelper(); + HousekeepingHelper(GeneratesHousekeepingIF* owner); ~HousekeepingHelper() = default; const HousekeepingSet* getHousekeepingSet(HousekeepingSetId_t id); @@ -20,7 +21,12 @@ class HousekeepingHelper { return &housekeepingSets; } + ReturnValue_t initialize(); + protected: + GeneratesHousekeepingIF* owner; + TmManager* tmManager = nullptr; + void registerSet(HousekeepingSet* set); ReturnValue_t reportHousekeeping(HousekeepingSet* set, const Action* action = nullptr); diff --git a/src/fsfw/housekeeping/HousekeepingSet.cpp b/src/fsfw/housekeeping/HousekeepingSet.cpp index 1cd07d9ee..86f954aa4 100644 --- a/src/fsfw/housekeeping/HousekeepingSet.cpp +++ b/src/fsfw/housekeeping/HousekeepingSet.cpp @@ -3,9 +3,11 @@ #include "GeneratesHousekeepingIF.h" #ifdef FSFW_INTROSPECTION -HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id) { - helper = owner->getHelper(); - helper->registerSet(this); +HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner) { + if (owner != nullptr) { + helper = owner->getHousekeepingHelper(); + helper->registerSet(this); + } } void HousekeepingSet::setEnum(EnumIF* theEnum) { @@ -14,17 +16,65 @@ void HousekeepingSet::setEnum(EnumIF* theEnum) { } #else HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id) : id(id) { - helper = owner->getHelper(); - helper->registerSet(this); + if (owner != nullptr) { + helper = owner->getHousekeepingHelper(); + helper->registerSet(this); + } } #endif +HousekeepingSet::~HousekeepingSet() {} + void HousekeepingSet::report(const Action* action) { - helper->reportHousekeeping(this, action); + if (helper == nullptr) { + helper->reportHousekeeping(this, action); + } +} + +ReturnValue_t HousekeepingSet::serialize(uint8_t** buffer, size_t* size, size_t maxSize, + Endianness streamEndianness) const { + ReturnValue_t result = SerializeAdapter::serialize(&id, buffer, size, maxSize, streamEndianness); + if (result != returnvalue::OK) { + return result; + } + for (auto parameter : *getParameters()) { + result = parameter->serialize(buffer, size, maxSize, streamEndianness); + if (result != returnvalue::OK) { + return result; + } + } + return result; +} + +size_t HousekeepingSet::getSerializedSize() const { + size_t size = SerializeAdapter::getSerializedSize(&id); + for (auto parameter : *getParameters()) { + size += parameter->getSerializedSize(); + } + return size; +} + +ReturnValue_t HousekeepingSet::deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) { + ReturnValue_t result = returnvalue::OK; + + /** + * When deserializing, the id needs to be deserialized first, to find the correct class to + * deserialize with. Consequentely, it is assumed, that the pointer was already advanced + * + * SerializeAdapter::deSerialize(&id, buffer, size, streamEndianness); if (result != + */ + for (auto parameter : *getParameters()) { + result = parameter->deSerialize(buffer, size, streamEndianness); + if (result != returnvalue::OK) { + return result; + } + } + return result; } void HousekeepingSet::registerParameter(ParameterIF* parameter) { parameterList.push_back(parameter); } -std::vector const* HousekeepingSet::getParameters() { return ¶meterList; } +std::vector const* HousekeepingSet::getParameters() const { return ¶meterList; } diff --git a/src/fsfw/housekeeping/HousekeepingSet.h b/src/fsfw/housekeeping/HousekeepingSet.h index 7d3c9ceb1..2b6fed718 100644 --- a/src/fsfw/housekeeping/HousekeepingSet.h +++ b/src/fsfw/housekeeping/HousekeepingSet.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -24,14 +23,28 @@ class HousekeepingSet : public HasTmTcParametersIF, public SerializeIF { HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id); #endif + virtual ~HousekeepingSet(); + HousekeepingSetId_t getId() const { return id; } void report(const Action* action = nullptr); - std::vector const* getParameters() override; + std::vector const* getParameters() const override; + +#ifdef FSFW_INTROSPECTION + const char* getDescription() const; +#endif + + ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, + Endianness streamEndianness) const override; + + size_t getSerializedSize() const override; + + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) override; protected: - HousekeepingHelper* helper; + HousekeepingHelper* helper = nullptr; HousekeepingSetId_t id; #ifdef FSFW_INTROSPECTION const char* description; diff --git a/src/fsfw/introspection/HasTmTcParametersIF.h b/src/fsfw/introspection/HasTmTcParametersIF.h index 0ffa7b9bb..43952beed 100644 --- a/src/fsfw/introspection/HasTmTcParametersIF.h +++ b/src/fsfw/introspection/HasTmTcParametersIF.h @@ -1,12 +1,13 @@ #pragma once -#include "ParameterIF.h" #include -class HasTmTcParametersIF { - public: - ~HasTmTcParametersIF() = default; +#include "ParameterIF.h" - virtual void registerParameter(ParameterIF *parameter) = 0; - virtual std::vector const *getParameters() const = 0; +class HasTmTcParametersIF { + public: + virtual ~HasTmTcParametersIF() = default; + + virtual void registerParameter(ParameterIF *parameter) = 0; + virtual std::vector const *getParameters() const = 0; }; \ No newline at end of file diff --git a/src/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h index 9a5cc8129..de370b7ef 100644 --- a/src/fsfw/returnvalues/FwClassIds.h +++ b/src/fsfw/returnvalues/FwClassIds.h @@ -84,6 +84,7 @@ enum : uint8_t { MGM_LIS3MDL, // MGMLIS3 MGM_RM3100, // MGMRM3100 SPACE_PACKET_PARSER, // SPPA + GENERATES_HOUSEKEEPING, //GHK FW_CLASS_ID_COUNT // [EXPORT] : [END] }; diff --git a/src/fsfw/tmtc/UdpTmTcBridge.cpp b/src/fsfw/tmtc/UdpTmTcBridge.cpp index 9a32d7464..66e2c3962 100644 --- a/src/fsfw/tmtc/UdpTmTcBridge.cpp +++ b/src/fsfw/tmtc/UdpTmTcBridge.cpp @@ -167,7 +167,7 @@ void UdpTmTcBridgeNew::handleTC() { return; } - ActionMessage::setCommand(&message, header.HEADER_SIZE + 1 + sizeof(sockaddr_in6), storageId); + ActionMessage::setCommand(&message, 1 + sizeof(sockaddr_in6), storageId); result = messageQueue->sendMessage(object->getCommandQueue(), &message); // sif::debug << "UdpTmTcBridge::performOperation: sent " << (int)storageId.raw << std::endl; } break;