moved action parameters to a generic place to use them for HK TM
This commit is contained in:
parent
d766469f1e
commit
3a433915f1
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
#include "ParameterIF.h"
|
#include <fsfw/introspection/HasTmTcParametersIF.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
//TODO ActionId_t
|
//TODO ActionId_t
|
||||||
|
|
||||||
class Action: public SerializeIF {
|
class Action: public SerializeIF, public HasTmTcParametersIF {
|
||||||
public:
|
public:
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
Action();
|
Action();
|
||||||
@ -30,7 +30,7 @@ class Action: public SerializeIF {
|
|||||||
|
|
||||||
[[nodiscard]] virtual ReturnValue_t handle() = 0;
|
[[nodiscard]] virtual ReturnValue_t handle() = 0;
|
||||||
|
|
||||||
void registerParameter(ParameterIF *parameter);
|
void registerParameter(ParameterIF *parameter) override;
|
||||||
|
|
||||||
std::vector<ParameterIF *> const *getParameters() const;
|
std::vector<ParameterIF *> const *getParameters() const;
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class HousekeepingEntryIF {
|
|
||||||
|
|
||||||
};
|
|
@ -16,3 +16,10 @@ HousekeepingSet::HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSet
|
|||||||
owner->getHelper()->registerSet(this);
|
owner->getHelper()->registerSet(this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void HousekeepingSet::registerParameter(ParameterIF* parameter) {
|
||||||
|
parameterList.push_back(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<ParameterIF*> const* HousekeepingSet::getParameters() { return ¶meterList; }
|
||||||
|
@ -2,34 +2,37 @@
|
|||||||
|
|
||||||
#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/ParameterIF.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "HousekeepingEntryIF.h"
|
|
||||||
|
|
||||||
class HousekeepingHelper;
|
class HousekeepingHelper;
|
||||||
class GeneratesHousekeepingIF;
|
class GeneratesHousekeepingIF;
|
||||||
|
|
||||||
using HousekeepingSetId_t = uint32_t;
|
using HousekeepingSetId_t = uint32_t;
|
||||||
|
|
||||||
class HousekeepingSet {
|
class HousekeepingSet : public HasTmTcParametersIF {
|
||||||
public:
|
public:
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
HousekeepingSet(GeneratesHousekeepingIF* owner);
|
HousekeepingSet(GeneratesHousekeepingIF* owner);
|
||||||
void setEnum(EnumIF* theEnum);
|
void setEnum(EnumIF* theEnum);
|
||||||
#else
|
#else
|
||||||
HousekeepingSet(GeneratesHousekeepingIF* owner, HousekeepingSetId_t id);
|
HousekeepingSet(GeneratesHousekeepingIF *owner, HousekeepingSetId_t id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HousekeepingSetId_t getId() const { return id; }
|
HousekeepingSetId_t getId() const { return id; }
|
||||||
|
|
||||||
void report(const Action* action = nullptr);
|
void report(const Action* action = nullptr);
|
||||||
|
|
||||||
|
void registerParameter(ParameterIF* parameter) override;
|
||||||
|
std::vector<ParameterIF*> const* getParameters() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HousekeepingHelper* helper;
|
HousekeepingHelper* helper;
|
||||||
HousekeepingSetId_t id;
|
HousekeepingSetId_t id;
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
const char* description;
|
const char* description;
|
||||||
#endif
|
#endif
|
||||||
std::vector<HousekeepingEntryIF*> variables;
|
std::vector<ParameterIF*> parameterList;
|
||||||
};
|
};
|
12
src/fsfw/introspection/HasTmTcParametersIF.h
Normal file
12
src/fsfw/introspection/HasTmTcParametersIF.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ParameterIF.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class HasTmTcParametersIF {
|
||||||
|
public:
|
||||||
|
~HasTmTcParametersIF() = default;
|
||||||
|
|
||||||
|
virtual void registerParameter(ParameterIF *parameter) = 0;
|
||||||
|
virtual std::vector<ParameterIF *> const *getParameters() const = 0;
|
||||||
|
};
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Action.h"
|
#include "HasTmTcParametersIF.h"
|
||||||
#include <fsfw/introspection/Types.h>
|
#include <fsfw/introspection/Types.h>
|
||||||
#include <fsfw/introspection/TypesHelper.h>
|
#include <fsfw/introspection/TypesHelper.h>
|
||||||
#include "ParameterIF.h"
|
#include "ParameterIF.h"
|
||||||
@ -14,10 +14,10 @@ template <typename T>
|
|||||||
class Parameter : public ParameterIF {
|
class Parameter : public ParameterIF {
|
||||||
protected:
|
protected:
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
Parameter(Action *owner, const char *name)
|
Parameter(HasTmTcParametersIF *owner, const char *name)
|
||||||
: name(name)
|
: name(name)
|
||||||
#else
|
#else
|
||||||
Parameter(Action *owner)
|
Parameter(HasTmTcParametersIF *owner)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
owner->registerParameter(this);
|
owner->registerParameter(this);
|
||||||
@ -25,11 +25,11 @@ class Parameter : public ParameterIF {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
static Parameter createParameter(Action *owner, const char *name) {
|
static Parameter createParameter(HasTmTcParametersIF *owner, const char *name) {
|
||||||
return Parameter(owner, name);
|
return Parameter(owner, name);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static Parameter createParameter(Action *owner) { return Parameter(owner); }
|
static Parameter createParameter(HasTmTcParametersIF *owner) { return Parameter(owner); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isValid() override {
|
bool isValid() override {
|
@ -3,6 +3,7 @@
|
|||||||
//maybe call them MIB types as these are the ones exposed to the MIB?
|
//maybe call them MIB types as these are the ones exposed to the MIB?
|
||||||
// Note: some DBs (Postgress, Mongo) only support signed 64bit integers. To have a common denominator, all integers are int64_t.
|
// Note: some DBs (Postgress, Mongo) only support signed 64bit integers. To have a common denominator, all integers are int64_t.
|
||||||
// As such, ther is no unsigned Type, as there can not be a uint64_t and uint32_t completely fits into int64_t
|
// As such, ther is no unsigned Type, as there can not be a uint64_t and uint32_t completely fits into int64_t
|
||||||
|
// Floating is IEEE double
|
||||||
namespace Types {
|
namespace Types {
|
||||||
enum ParameterType { SIGNED, FLOATING, ENUM, UNSUPPORTED };
|
enum ParameterType { SIGNED, FLOATING, ENUM, UNSUPPORTED };
|
||||||
} // namespace Types
|
} // namespace Types
|
@ -31,7 +31,7 @@ class enumHelper<true> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<int64_t> getEnumValues() { return std::vector<int64_t>(); }
|
//TODO needed?: static std::vector<int64_t> getEnumValues() { return std::vector<int64_t>(); }
|
||||||
|
|
||||||
static std::vector<int64_t> getEnumValues(EnumIF *anEnum) {
|
static std::vector<int64_t> getEnumValues(EnumIF *anEnum) {
|
||||||
std::vector<int64_t> vector;
|
std::vector<int64_t> vector;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user