multiple stuff, need to leave
Some checks failed
fsfw/fsfw/pipeline/head There was a failure building this commit

This commit is contained in:
Ulrich Mohr 2023-07-21 14:23:55 +02:00
parent d328f3e190
commit 732419e239
4 changed files with 53 additions and 17 deletions

View File

@ -12,7 +12,7 @@ ControllerBase::ControllerBase(object_id_t setObjectId, object_id_t parentId,
mode(MODE_OFF), mode(MODE_OFF),
submode(SUBMODE_NONE), submode(SUBMODE_NONE),
modeHelper(this), modeHelper(this),
healthHelper(this, setObjectId) { healthHelper(this, setObjectId), actionHelper(this, commandQueue), datapoolHelper(this), housekeepingHelper(this) {
commandQueue = QueueFactory::instance()->createMessageQueue(commandQueueDepth); commandQueue = QueueFactory::instance()->createMessageQueue(commandQueueDepth);
} }
@ -45,6 +45,21 @@ ReturnValue_t ControllerBase::initialize() {
return result; return result;
} }
result = actionHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
result = housekeepingHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
result = datapoolHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK; return returnvalue::OK;
} }
@ -64,6 +79,12 @@ void ControllerBase::handleQueue() {
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = actionHelper.handleActionMessage(&command);
if (result == returnvalue::OK) {
continue;
}
result = handleCommandMessage(&command); result = handleCommandMessage(&command);
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
continue; continue;

View File

@ -1,14 +1,15 @@
#ifndef FSFW_CONTROLLER_CONTROLLERBASE_H_ #ifndef FSFW_CONTROLLER_CONTROLLERBASE_H_
#define FSFW_CONTROLLER_CONTROLLERBASE_H_ #define FSFW_CONTROLLER_CONTROLLERBASE_H_
#include "fsfw/health/HasHealthIF.h" #include <fsfw/health/HasHealthIF.h>
#include "fsfw/health/HealthHelper.h" #include <fsfw/health/HealthHelper.h>
#include "fsfw/introspection/ClasslessEnum.h" #include <fsfw/introspection/ClasslessEnum.h>
#include "fsfw/modes/HasModesIF.h" #include <fsfw/modes/HasModesIF.h>
#include "fsfw/modes/ModeHelper.h" #include <fsfw/action/HasActionsIF.h>
#include "fsfw/objectmanager/SystemObject.h" #include <fsfw/datapool/HasDatapoolIF.h>
#include "fsfw/tasks/ExecutableObjectIF.h" #include <fsfw/objectmanager/SystemObject.h>
#include "fsfw/tasks/PeriodicTaskIF.h" #include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
/** /**
* @brief Generic base class for controller classes * @brief Generic base class for controller classes
@ -18,6 +19,8 @@
*/ */
class ControllerBase : public HasModesIF, class ControllerBase : public HasModesIF,
public HasHealthIF, public HasHealthIF,
public HasDatapoolIF,
public HasActionsIF,
public ExecutableObjectIF, public ExecutableObjectIF,
public SystemObject { public SystemObject {
public: public:
@ -42,9 +45,17 @@ class ControllerBase : public HasModesIF,
void setTaskIF(PeriodicTaskIF *task) override; void setTaskIF(PeriodicTaskIF *task) override;
ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
/** HasModeIF override */ /** HasModeIF overrides */
const ModeHelper *getModeHelper() const override; const ModeHelper *getModeHelper() const override;
/** HasActionsIF override */
ActionHelper* getActionHelper() override;
ReturnValue_t executeAction(Action* action) override;
/** HasDatapoolIF overrides */
DatapoolHelper* getDatapoolHelper() override;
HousekeepingHelper* getHousekeepingHelper() override;
protected: protected:
/** /**
* Implemented by child class. Handle command messages which are not * Implemented by child class. Handle command messages which are not
@ -74,6 +85,12 @@ class ControllerBase : public HasModesIF,
HealthHelper healthHelper; HealthHelper healthHelper;
ActionHelper actionHelper;
DatapoolHelper datapoolHelper;
HousekeepingHelper housekeepingHelper;
/** /**
* Pointer to the task which executes this component, * Pointer to the task which executes this component,
* is invalid before setTaskIF was called. * is invalid before setTaskIF was called.

View File

@ -25,7 +25,7 @@ class DatasetEntry : public Parameter<T>, public DatasetEntryIF {
return; return;
} }
storedValue = new T(); storedValue = new T();
storedValid = new bool storedValid = new bool;
} }
public: public:
@ -48,6 +48,8 @@ class DatasetEntry : public Parameter<T>, public DatasetEntryIF {
virtual bool getValid() { return valid; } virtual bool getValid() { return valid; }
T value; //TODO can this be private?
protected: protected:
virtual void commit() { virtual void commit() {
*storedValue = value; *storedValue = value;
@ -59,7 +61,7 @@ class DatasetEntry : public Parameter<T>, public DatasetEntryIF {
} }
virtual void connect(DatasetEntryIF *entry) { virtual void connect(DatasetEntryIF *entry) {
HousekeepingEntry<T> *theOther = dynamic_cast<HousekeepingEntry<T> *>(entry); DatasetEntry<T> *theOther = dynamic_cast<DatasetEntry<T> *>(entry);
if (theOther == nullptr) { if (theOther == nullptr) {
// Configuration error // Configuration error
return; return;
@ -71,7 +73,7 @@ class DatasetEntry : public Parameter<T>, public DatasetEntryIF {
virtual bool changed() { return ((value != *storedValue) || (valid != *storedValid)); } virtual bool changed() { return ((value != *storedValue) || (valid != *storedValid)); }
private: private:
T value;
T *storedValue; T *storedValue;
bool *storedValid; bool *storedValid;
bool valid; bool valid;

View File

@ -26,10 +26,6 @@ class DatasetEntryIF {
virtual void read() = 0; virtual void read() = 0;
virtual void connect(DatasetEntryIF* entry) = 0; virtual void connect(DatasetEntryIF* entry) = 0;
/**
* create actualValue
*/
virtual void allocate() = 0;
/** /**
* returns if value and actual value is different * returns if value and actual value is different