working on TM
This commit is contained in:
parent
ae2823ba2d
commit
a30146a799
@ -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)
|
||||
|
@ -1,29 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||
#include <fsfw/serialize/SerializeIF.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <fsfw/serialize/SerializeIF.h>
|
||||
#include "ActionMessage.h"
|
||||
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||
|
||||
|
||||
#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,15 +41,15 @@ class Action: public SerializeIF, public HasTmTcParametersIF {
|
||||
|
||||
void registerParameter(ParameterIF *parameter) override;
|
||||
|
||||
std::vector<ParameterIF *> const *getParameters() const;
|
||||
std::vector<ParameterIF *> 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;
|
||||
|
@ -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<SystemObjectIF*>(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;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "SimpleActionHelper.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include <fsfw/tmtc/FsfwProtocolHeader.h>
|
||||
|
||||
/**
|
||||
* @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;
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -1,23 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dataset.h"
|
||||
#include "HasDatapoolIF.h"
|
||||
|
||||
#include <fsfw/housekeeping/HousekeepingHelper.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
|
||||
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<DataSetId_t, Dataset*>* getDatasets() const {
|
||||
const std::map<HousekeepingSetId_t, Dataset*>* getDatasets() const {
|
||||
return &dataSets;
|
||||
}
|
||||
|
||||
void registerSet(Dataset* set);
|
||||
|
||||
ReturnValue_t initialize();
|
||||
|
||||
private:
|
||||
std::map<DataSetId_t, Dataset*> dataSets;
|
||||
std::map<HousekeepingSetId_t, Dataset*> dataSets;
|
||||
};
|
||||
|
@ -1,35 +1,33 @@
|
||||
#include "Dataset.h"
|
||||
|
||||
#include <fsfw/returnvalues/returnvalue.h>
|
||||
#include <fsfw/ipc/MutexFactory.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/returnvalues/returnvalue.h>
|
||||
|
||||
|
||||
#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<DatasetEntryIF*>* 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<HasDatapoolIF>(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;
|
||||
}
|
||||
|
@ -4,8 +4,9 @@
|
||||
#include <fsfw/ipc/MutexIF.h>
|
||||
#include <fsfw/returnvalues/returnvalue.h>
|
||||
#include <fsfw/storagemanager/storeAddress.h>
|
||||
#include <stdint.h>
|
||||
#include <fsfw/housekeeping/HousekeepingSet.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#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<DatasetEntryIF*> variables;
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
//TODO ring
|
||||
class DatapoolHelper;
|
||||
#include "DatapoolHelper.h"
|
||||
|
||||
class HasDatapoolIF {
|
||||
#include <fsfw/housekeeping/GeneratesHousekeepingIF.h>
|
||||
|
||||
class HasDatapoolIF: public GeneratesHousekeepingIF {
|
||||
public:
|
||||
virtual ~HasDatapoolIF() = default;
|
||||
virtual DatapoolHelper* getDatapoolHelper() = 0;
|
||||
|
@ -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<DataSetId_t>(id), allowUserCommit) {
|
||||
: Dataset(owner, static_cast<HousekeepingSetId_t>(id), allowUserCommit) {
|
||||
owner->getDatapoolHelper()->registerSet(this);
|
||||
}
|
||||
TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id, static_cast<DataSetId_t>(id)) {}
|
||||
TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id, static_cast<HousekeepingSetId_t>(id)) {}
|
||||
#endif
|
||||
virtual ~TemplateSet() = default;
|
||||
};
|
@ -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) {
|
||||
|
@ -528,6 +528,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
virtual void setNormalDatapoolEntriesInvalid(); //TODO
|
||||
|
||||
DatapoolHelper* getDatapoolHelper() override;
|
||||
HousekeepingHelper* getHousekeepingHelper() override;
|
||||
|
||||
|
||||
/* HasModesIF overrides */
|
||||
|
@ -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 )
|
||||
|
@ -1,10 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/tmtc/FsfwProtocolHeader.h>
|
||||
|
||||
#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;
|
||||
};
|
@ -1,6 +1,17 @@
|
||||
#include "HousekeepingHelper.h"
|
||||
#include "GeneratesHousekeepingIF.h"
|
||||
|
||||
HousekeepingHelper::HousekeepingHelper() {}
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
HousekeepingHelper::HousekeepingHelper(GeneratesHousekeepingIF* owner): owner(owner) {}
|
||||
|
||||
ReturnValue_t HousekeepingHelper::initialize() {
|
||||
tmManager = ObjectManager::instance()->get<TmManager>(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<SystemObjectIF*>(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);
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <fsfw/returnvalues/returnvalue.h>
|
||||
#include <fsfw/serialize/SerializeIF.h>
|
||||
#include <fsfw/tmtc/TmManager.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -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);
|
||||
|
@ -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<ParameterIF*> const* HousekeepingSet::getParameters() { return ¶meterList; }
|
||||
std::vector<ParameterIF*> const* HousekeepingSet::getParameters() const { return ¶meterList; }
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <fsfw/action/Action.h>
|
||||
#include <fsfw/introspection/Enum.h>
|
||||
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||
#include <fsfw/introspection/ParameterIF.h>
|
||||
#include <fsfw/serialize/SerializeIF.h>
|
||||
|
||||
#include <cstdint>
|
||||
@ -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<ParameterIF*> const* getParameters() override;
|
||||
std::vector<ParameterIF*> 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;
|
||||
|
@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "ParameterIF.h"
|
||||
#include <vector>
|
||||
|
||||
class HasTmTcParametersIF {
|
||||
public:
|
||||
~HasTmTcParametersIF() = default;
|
||||
#include "ParameterIF.h"
|
||||
|
||||
virtual void registerParameter(ParameterIF *parameter) = 0;
|
||||
virtual std::vector<ParameterIF *> const *getParameters() const = 0;
|
||||
class HasTmTcParametersIF {
|
||||
public:
|
||||
virtual ~HasTmTcParametersIF() = default;
|
||||
|
||||
virtual void registerParameter(ParameterIF *parameter) = 0;
|
||||
virtual std::vector<ParameterIF *> const *getParameters() const = 0;
|
||||
};
|
@ -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]
|
||||
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user