working on TM
This commit is contained in:
parent
ae2823ba2d
commit
a30146a799
@ -13,7 +13,7 @@ add_subdirectory(events)
|
|||||||
add_subdirectory(fdir)
|
add_subdirectory(fdir)
|
||||||
add_subdirectory(globalfunctions)
|
add_subdirectory(globalfunctions)
|
||||||
add_subdirectory(health)
|
add_subdirectory(health)
|
||||||
#add_subdirectory(housekeeping)
|
add_subdirectory(housekeeping)
|
||||||
add_subdirectory(internalerror)
|
add_subdirectory(internalerror)
|
||||||
add_subdirectory(introspection)
|
add_subdirectory(introspection)
|
||||||
add_subdirectory(ipc)
|
add_subdirectory(ipc)
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||||
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
#include "../introspection/Enum.h"
|
#include "../introspection/Enum.h"
|
||||||
@ -24,6 +23,16 @@ class Action: public SerializeIF, public HasTmTcParametersIF {
|
|||||||
#else
|
#else
|
||||||
Action(ActionId_t id);
|
Action(ActionId_t id);
|
||||||
#endif
|
#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();
|
ActionId_t getId();
|
||||||
|
|
||||||
MessageQueueId_t commandedBy;
|
MessageQueueId_t commandedBy;
|
||||||
@ -32,7 +41,7 @@ class Action: public SerializeIF, public HasTmTcParametersIF {
|
|||||||
|
|
||||||
void registerParameter(ParameterIF *parameter) override;
|
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,
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
|
@ -81,9 +81,22 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, size_t offset,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FsfwProtocolHeader header;
|
||||||
|
|
||||||
const uint8_t* dataPtr = tcData + offset;
|
const uint8_t* dataPtr = tcData + offset;
|
||||||
size_t size = tcDataSize - 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;
|
ActionId_t actionId;
|
||||||
|
|
||||||
result =
|
result =
|
||||||
@ -118,8 +131,10 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, size_t offset,
|
|||||||
action->commandedBy = commandedBy;
|
action->commandedBy = commandedBy;
|
||||||
result = owner->executeAction(action);
|
result = owner->executeAction(action);
|
||||||
|
|
||||||
result =
|
// TODO safetify dynamic cast
|
||||||
tmManager->sendTmPacket(0xff, HasActionsIF::INTERFACE_ID, 0x13, action, dataAddress, offset);
|
result = tmManager->sendTmPacket(dynamic_cast<SystemObjectIF*>(owner)->getObjectId(), HasActionsIF::INTERFACE_ID,
|
||||||
|
HasActionsIF::Functions::EXECUTION_IN_PROGRESS, action,
|
||||||
|
dataAddress, offset);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "replying action failed " << std::hex << result << std::dec << std::endl;
|
sif::error << "replying action failed " << std::hex << result << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "SimpleActionHelper.h"
|
#include "SimpleActionHelper.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
#include <fsfw/tmtc/FsfwProtocolHeader.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -42,7 +43,7 @@ class HasActionsIF {
|
|||||||
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
||||||
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
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;
|
virtual ~HasActionsIF() = default;
|
||||||
/**
|
/**
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#include "DatapoolHelper.h"
|
#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);
|
auto iter = dataSets.find(id);
|
||||||
if (iter == dataSets.end()) {
|
if (iter == dataSets.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Dataset.h"
|
#include "Dataset.h"
|
||||||
|
#include "HasDatapoolIF.h"
|
||||||
|
|
||||||
|
#include <fsfw/housekeeping/HousekeepingHelper.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class DatapoolHelper {
|
class DatapoolHelper : public HousekeepingHelper {
|
||||||
public:
|
public:
|
||||||
DatapoolHelper();
|
DatapoolHelper(HasDatapoolIF *owner);
|
||||||
~DatapoolHelper();
|
~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;
|
return &dataSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerSet(Dataset* set);
|
void registerSet(Dataset* set);
|
||||||
|
|
||||||
|
ReturnValue_t initialize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<DataSetId_t, Dataset*> dataSets;
|
std::map<HousekeepingSetId_t, Dataset*> dataSets;
|
||||||
};
|
};
|
||||||
|
@ -1,35 +1,33 @@
|
|||||||
#include "Dataset.h"
|
#include "Dataset.h"
|
||||||
|
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
|
||||||
#include <fsfw/ipc/MutexFactory.h>
|
#include <fsfw/ipc/MutexFactory.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
|
|
||||||
#include "HasDatapoolIF.h"
|
#include "HasDatapoolIF.h"
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
Dataset::Dataset(HasDatapoolIF* owner, bool allowUserCommit)
|
Dataset::Dataset(HasDatapoolIF* owner, bool allowUserCommit)
|
||||||
: allocated(true), allowUserCommit(allowUserCommit) {
|
: HousekeepingSet(owner), allocated(true), allowUserCommit(allowUserCommit) {
|
||||||
this->owner.pointer = owner;
|
this->owner.pointer = owner;
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dataset::Dataset(uint32_t owner_id)
|
Dataset::Dataset(uint32_t owner_id)
|
||||||
: allocated(false), allowUserCommit(false) {
|
: HousekeepingSet(nullptr), allocated(false), allowUserCommit(false) {
|
||||||
this->owner.id = owner_id;
|
this->owner.id = owner_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dataset::setEnum(EnumIF *theEnum) {
|
|
||||||
id = theEnum->getValue();
|
|
||||||
description = theEnum->getDescription();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
Dataset::Dataset(HasDatapoolIF* owner, DataSetId_t id, bool allowUserCommit)
|
Dataset::Dataset(HasDatapoolIF* owner, HousekeepingSetId_t id, bool allowUserCommit)
|
||||||
: allocated(true), allowUserCommit(allowUserCommit), id(id) {
|
: HousekeepingSet(owner, id), allocated(true), allowUserCommit(allowUserCommit) {
|
||||||
this->owner.pointer = owner;
|
this->owner.pointer = owner;
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
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
|
#endif
|
||||||
|
|
||||||
Dataset::~Dataset() { MutexFactory::instance()->deleteMutex(mutex); }
|
Dataset::~Dataset() { MutexFactory::instance()->deleteMutex(mutex); }
|
||||||
@ -84,10 +82,6 @@ bool Dataset::hasChangedOrOlderThan(uint32_t seconds) {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Dataset::getId() const {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<DatasetEntryIF*>* Dataset::getVariables() const { return &variables; }
|
const std::vector<DatasetEntryIF*>* Dataset::getVariables() const { return &variables; }
|
||||||
|
|
||||||
ReturnValue_t Dataset::initialize() {
|
ReturnValue_t Dataset::initialize() {
|
||||||
@ -120,9 +114,6 @@ ReturnValue_t Dataset::initialize() {
|
|||||||
|
|
||||||
// operator[]
|
// operator[]
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
|
||||||
const char* Dataset::getDescription() const { return description; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool Dataset::registerEntry(DatasetEntryIF* entry) {
|
bool Dataset::registerEntry(DatasetEntryIF* entry) {
|
||||||
variables.push_back(entry);
|
variables.push_back(entry);
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
#include <fsfw/ipc/MutexIF.h>
|
#include <fsfw/ipc/MutexIF.h>
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/storagemanager/storeAddress.h>
|
#include <fsfw/storagemanager/storeAddress.h>
|
||||||
#include <stdint.h>
|
#include <fsfw/housekeeping/HousekeepingSet.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "DatasetEntryIF.h"
|
#include "DatasetEntryIF.h"
|
||||||
@ -14,7 +15,7 @@
|
|||||||
// #include "HasDatapoolIF.h"
|
// #include "HasDatapoolIF.h"
|
||||||
class HasDatapoolIF;
|
class HasDatapoolIF;
|
||||||
|
|
||||||
using DataSetId_t = uint32_t;
|
// TODO allow user commit and reporting TM
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class has a dual use
|
* This class has a dual use
|
||||||
@ -42,18 +43,17 @@ using DataSetId_t = uint32_t;
|
|||||||
* interpretDeviceReply)
|
* interpretDeviceReply)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Dataset {
|
class Dataset: public HousekeepingSet {
|
||||||
protected:
|
protected:
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
Dataset(HasDatapoolIF* owner, bool allowUserCommit);
|
Dataset(HasDatapoolIF* owner, bool allowUserCommit);
|
||||||
Dataset(uint32_t owner_id);
|
Dataset(uint32_t owner_id);
|
||||||
void setEnum(EnumIF* theEnum);
|
|
||||||
#else
|
#else
|
||||||
Dataset(HasDatapoolIF* owner, DataSetId_t id, bool allowUserCommit);
|
Dataset(HasDatapoolIF* owner, HousekeepingSetId_t id, bool allowUserCommit);
|
||||||
Dataset(uint32_t owner_id, DataSetId_t id);
|
Dataset(uint32_t owner_id, HousekeepingSetId_t id);
|
||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
~Dataset();
|
~Dataset() override;
|
||||||
/**
|
/**
|
||||||
* Copy content of local copies into actual variable
|
* Copy content of local copies into actual variable
|
||||||
*
|
*
|
||||||
@ -155,26 +155,17 @@ class Dataset {
|
|||||||
|
|
||||||
// operator[]
|
// operator[]
|
||||||
|
|
||||||
uint8_t getId() const;
|
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
|
||||||
const char* getDescription() const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool registerEntry(DatasetEntryIF*);
|
bool registerEntry(DatasetEntryIF*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool allocated;
|
bool allocated;
|
||||||
bool allowUserCommit;
|
bool allowUserCommit;
|
||||||
union {
|
union {
|
||||||
uint32_t id;
|
object_id_t id;
|
||||||
HasDatapoolIF* pointer;
|
HasDatapoolIF* pointer;
|
||||||
} owner;
|
} owner;
|
||||||
DataSetId_t id;
|
|
||||||
MutexIF* mutex;
|
MutexIF* mutex;
|
||||||
#ifdef FSFW_INTROSPECTION
|
|
||||||
const char* description;
|
|
||||||
#endif
|
|
||||||
std::vector<DatasetEntryIF*> variables;
|
std::vector<DatasetEntryIF*> variables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
//TODO ring
|
||||||
|
class DatapoolHelper;
|
||||||
#include "DatapoolHelper.h"
|
#include "DatapoolHelper.h"
|
||||||
|
|
||||||
class HasDatapoolIF {
|
#include <fsfw/housekeeping/GeneratesHousekeepingIF.h>
|
||||||
|
|
||||||
|
class HasDatapoolIF: public GeneratesHousekeepingIF {
|
||||||
public:
|
public:
|
||||||
virtual ~HasDatapoolIF() = default;
|
virtual ~HasDatapoolIF() = default;
|
||||||
virtual DatapoolHelper* getDatapoolHelper() = 0;
|
virtual DatapoolHelper* getDatapoolHelper() = 0;
|
||||||
|
@ -16,10 +16,10 @@ class TemplateSet : public Dataset {
|
|||||||
TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id) { setEnum(&id); }
|
TemplateSet(uint32_t owner_id, HkIDs id) : Dataset(owner_id) { setEnum(&id); }
|
||||||
#else
|
#else
|
||||||
TemplateSet(HasDatapoolIF* owner, HkIDs id, bool allowUserCommit)
|
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);
|
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
|
#endif
|
||||||
virtual ~TemplateSet() = default;
|
virtual ~TemplateSet() = default;
|
||||||
};
|
};
|
@ -31,6 +31,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
|
|||||||
modeHelper(this),
|
modeHelper(this),
|
||||||
parameterHelper(this),
|
parameterHelper(this),
|
||||||
actionHelper(this, nullptr),
|
actionHelper(this, nullptr),
|
||||||
|
datapoolHelper(this),
|
||||||
childTransitionFailure(returnvalue::OK),
|
childTransitionFailure(returnvalue::OK),
|
||||||
fdirInstance(fdirInstance),
|
fdirInstance(fdirInstance),
|
||||||
defaultFDIRUsed(fdirInstance == nullptr),
|
defaultFDIRUsed(fdirInstance == nullptr),
|
||||||
@ -1485,6 +1486,7 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatapoolHelper* DeviceHandlerBase::getDatapoolHelper() { return &datapoolHelper; }
|
DatapoolHelper* DeviceHandlerBase::getDatapoolHelper() { return &datapoolHelper; }
|
||||||
|
HousekeepingHelper* DeviceHandlerBase::getHousekeepingHelper() { return &datapoolHelper; }
|
||||||
|
|
||||||
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const char* functionName,
|
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const char* functionName,
|
||||||
ReturnValue_t errorCode, const char* errorPrint) {
|
ReturnValue_t errorCode, const char* errorPrint) {
|
||||||
|
@ -528,6 +528,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
virtual void setNormalDatapoolEntriesInvalid(); //TODO
|
virtual void setNormalDatapoolEntriesInvalid(); //TODO
|
||||||
|
|
||||||
DatapoolHelper* getDatapoolHelper() override;
|
DatapoolHelper* getDatapoolHelper() override;
|
||||||
|
HousekeepingHelper* getHousekeepingHelper() override;
|
||||||
|
|
||||||
|
|
||||||
/* HasModesIF overrides */
|
/* HasModesIF overrides */
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE HousekeepingMessage.cpp
|
target_sources(${LIB_FSFW_NAME} PRIVATE HousekeepingHelper.cpp
|
||||||
PeriodicHousekeepingHelper.cpp
|
|
||||||
HousekeepingHelper.cpp
|
|
||||||
HousekeepingSet.cpp )
|
HousekeepingSet.cpp )
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/tmtc/FsfwProtocolHeader.h>
|
||||||
|
|
||||||
#include "HousekeepingHelper.h"
|
#include "HousekeepingHelper.h"
|
||||||
|
|
||||||
class GeneratesHousekeepingIF {
|
class GeneratesHousekeepingIF {
|
||||||
public:
|
public:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::GENERATES_HOUSEKEEPING;
|
||||||
|
|
||||||
|
enum Functions : FsfwProtocolHeader::FunctionType_t { REPORT };
|
||||||
|
|
||||||
virtual ~GeneratesHousekeepingIF() = default;
|
virtual ~GeneratesHousekeepingIF() = default;
|
||||||
|
|
||||||
virtual HousekeepingHelper* getHelper();
|
virtual HousekeepingHelper* getHousekeepingHelper() = 0;
|
||||||
};
|
};
|
@ -1,6 +1,17 @@
|
|||||||
#include "HousekeepingHelper.h"
|
#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) {
|
const HousekeepingSet* HousekeepingHelper::getHousekeepingSet(HousekeepingSetId_t id) {
|
||||||
auto iter = housekeepingSets.find(id);
|
auto iter = housekeepingSets.find(id);
|
||||||
@ -14,3 +25,15 @@ void HousekeepingHelper::registerSet(HousekeepingSet* set) {
|
|||||||
auto id = set->getId();
|
auto id = set->getId();
|
||||||
housekeepingSets.emplace(id, set);
|
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/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
|
#include <fsfw/tmtc/TmManager.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ class HousekeepingHelper {
|
|||||||
friend class HousekeepingSet;
|
friend class HousekeepingSet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HousekeepingHelper();
|
HousekeepingHelper(GeneratesHousekeepingIF* owner);
|
||||||
~HousekeepingHelper() = default;
|
~HousekeepingHelper() = default;
|
||||||
|
|
||||||
const HousekeepingSet* getHousekeepingSet(HousekeepingSetId_t id);
|
const HousekeepingSet* getHousekeepingSet(HousekeepingSetId_t id);
|
||||||
@ -20,7 +21,12 @@ class HousekeepingHelper {
|
|||||||
return &housekeepingSets;
|
return &housekeepingSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t initialize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
GeneratesHousekeepingIF* owner;
|
||||||
|
TmManager* tmManager = nullptr;
|
||||||
|
|
||||||
void registerSet(HousekeepingSet* set);
|
void registerSet(HousekeepingSet* set);
|
||||||
|
|
||||||
ReturnValue_t reportHousekeeping(HousekeepingSet* set, const Action* action = nullptr);
|
ReturnValue_t reportHousekeeping(HousekeepingSet* set, const Action* action = nullptr);
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
#include "GeneratesHousekeepingIF.h"
|
#include "GeneratesHousekeepingIF.h"
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id) {
|
HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner) {
|
||||||
helper = owner->getHelper();
|
if (owner != nullptr) {
|
||||||
|
helper = owner->getHousekeepingHelper();
|
||||||
helper->registerSet(this);
|
helper->registerSet(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HousekeepingSet::setEnum(EnumIF* theEnum) {
|
void HousekeepingSet::setEnum(EnumIF* theEnum) {
|
||||||
id = theEnum->getValue();
|
id = theEnum->getValue();
|
||||||
@ -14,17 +16,65 @@ void HousekeepingSet::setEnum(EnumIF* theEnum) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id) : id(id) {
|
HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id) : id(id) {
|
||||||
helper = owner->getHelper();
|
if (owner != nullptr) {
|
||||||
|
helper = owner->getHousekeepingHelper();
|
||||||
helper->registerSet(this);
|
helper->registerSet(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HousekeepingSet::~HousekeepingSet() {}
|
||||||
|
|
||||||
void HousekeepingSet::report(const Action* action) {
|
void HousekeepingSet::report(const Action* action) {
|
||||||
|
if (helper == nullptr) {
|
||||||
helper->reportHousekeeping(this, action);
|
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) {
|
void HousekeepingSet::registerParameter(ParameterIF* parameter) {
|
||||||
parameterList.push_back(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/action/Action.h>
|
||||||
#include <fsfw/introspection/Enum.h>
|
#include <fsfw/introspection/Enum.h>
|
||||||
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||||
#include <fsfw/introspection/ParameterIF.h>
|
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -24,14 +23,28 @@ class HousekeepingSet : public HasTmTcParametersIF, public SerializeIF {
|
|||||||
HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id);
|
HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual ~HousekeepingSet();
|
||||||
|
|
||||||
HousekeepingSetId_t getId() const { return id; }
|
HousekeepingSetId_t getId() const { return id; }
|
||||||
|
|
||||||
void report(const Action* action = nullptr);
|
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:
|
protected:
|
||||||
HousekeepingHelper* helper;
|
HousekeepingHelper* helper = nullptr;
|
||||||
HousekeepingSetId_t id;
|
HousekeepingSetId_t id;
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
const char* description;
|
const char* description;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ParameterIF.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ParameterIF.h"
|
||||||
|
|
||||||
class HasTmTcParametersIF {
|
class HasTmTcParametersIF {
|
||||||
public:
|
public:
|
||||||
~HasTmTcParametersIF() = default;
|
virtual ~HasTmTcParametersIF() = default;
|
||||||
|
|
||||||
virtual void registerParameter(ParameterIF *parameter) = 0;
|
virtual void registerParameter(ParameterIF *parameter) = 0;
|
||||||
virtual std::vector<ParameterIF *> const *getParameters() const = 0;
|
virtual std::vector<ParameterIF *> const *getParameters() const = 0;
|
||||||
|
@ -84,6 +84,7 @@ enum : uint8_t {
|
|||||||
MGM_LIS3MDL, // MGMLIS3
|
MGM_LIS3MDL, // MGMLIS3
|
||||||
MGM_RM3100, // MGMRM3100
|
MGM_RM3100, // MGMRM3100
|
||||||
SPACE_PACKET_PARSER, // SPPA
|
SPACE_PACKET_PARSER, // SPPA
|
||||||
|
GENERATES_HOUSEKEEPING, //GHK
|
||||||
FW_CLASS_ID_COUNT // [EXPORT] : [END]
|
FW_CLASS_ID_COUNT // [EXPORT] : [END]
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -167,7 +167,7 @@ void UdpTmTcBridgeNew::handleTC() {
|
|||||||
return;
|
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);
|
result = messageQueue->sendMessage(object->getCommandQueue(), &message);
|
||||||
// sif::debug << "UdpTmTcBridge::performOperation: sent " << (int)storageId.raw << std::endl;
|
// sif::debug << "UdpTmTcBridge::performOperation: sent " << (int)storageId.raw << std::endl;
|
||||||
} break;
|
} break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user