visibility changes

This commit is contained in:
Robin Müller 2023-11-09 10:45:21 +01:00
parent 0a40391a75
commit 133ca51d18
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 42 additions and 45 deletions

View File

@ -83,6 +83,7 @@ ReturnValue_t FreshDeviceHandlerBase::handleQueue() {
command.setToUnknownCommand(); command.setToUnknownCommand();
messageQueue->reply(&command); messageQueue->reply(&command);
} }
return result;
} }
HasHealthIF::HealthState FreshDeviceHandlerBase::getHealth() { return healthHelper.getHealth(); } HasHealthIF::HealthState FreshDeviceHandlerBase::getHealth() { return healthHelper.getHealth(); }
@ -112,9 +113,7 @@ ReturnValue_t FreshDeviceHandlerBase::initializeAfterTaskCreation() {
} }
ReturnValue_t FreshDeviceHandlerBase::setHealth(HasHealthIF::HealthState health) { ReturnValue_t FreshDeviceHandlerBase::setHealth(HasHealthIF::HealthState health) {
if (health == HasHealthIF::FAULTY or health == HasHealthIF::PERMANENT_FAULTY) { // Assembly should handle commanding to OFF.
// TODO: Go to off where applicable. Health state machine? How does DHB do it?
}
healthHelper.setHealth(health); healthHelper.setHealth(health);
return returnvalue::OK; return returnvalue::OK;
} }
@ -140,3 +139,4 @@ ReturnValue_t FreshDeviceHandlerBase::initialize() {
} }
return SystemObject::initialize(); return SystemObject::initialize();
} }
void FreshDeviceHandlerBase::setToExternalControl() { setHealth(HealthState::EXTERNAL_CONTROL); }

View File

@ -31,7 +31,12 @@ class FreshDeviceHandlerBase : public SystemObject,
public HasLocalDataPoolIF { public HasLocalDataPoolIF {
public: public:
explicit FreshDeviceHandlerBase(DhbConfig config); explicit FreshDeviceHandlerBase(DhbConfig config);
virtual ~FreshDeviceHandlerBase() override; ~FreshDeviceHandlerBase() override;
/**
* Periodic helper executed function, implemented by child class.
*/
virtual void performDeviceOperation(uint8_t opCode) = 0;
/** /**
* Implemented by child class. Handle all command messages which are * Implemented by child class. Handle all command messages which are
@ -41,60 +46,23 @@ class FreshDeviceHandlerBase : public SystemObject,
*/ */
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0; virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0;
// HK manager abstract functions.
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override = 0;
// Mode abstract functions
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override = 0;
/**
* Periodic helper executed function, implemented by child class.
*/
virtual void performDeviceOperation(uint8_t opCode) = 0;
[[nodiscard]] object_id_t getObjectId() const override; [[nodiscard]] object_id_t getObjectId() const override;
// Executable overrides.
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initializeAfterTaskCreation() override;
// System Object overrides.
ReturnValue_t initialize() override;
[[nodiscard]] MessageQueueId_t getCommandQueue() const override; [[nodiscard]] MessageQueueId_t getCommandQueue() const override;
// Health Overrides.
ReturnValue_t setHealth(HealthState health) override;
HasHealthIF::HealthState getHealth() override; HasHealthIF::HealthState getHealth() override;
// Executable Overrides.
void setTaskIF(PeriodicTaskIF* task) override;
// Mode Tree Overrides. // Mode Tree Overrides.
[[nodiscard]] const HasHealthIF* getOptHealthIF() const override; [[nodiscard]] const HasHealthIF* getOptHealthIF() const override;
[[nodiscard]] const HasModesIF& getModeIF() const override; [[nodiscard]] const HasModesIF& getModeIF() const override;
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override; ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
ModeTreeChildIF& getModeTreeChildIF() override; ModeTreeChildIF& getModeTreeChildIF() override;
// Action overrides.
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) = 0;
[[nodiscard]] uint32_t getPeriodicOperationFrequency() const override; [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override;
protected: protected:
virtual ReturnValue_t handleQueue(); // Pool Manager overrides.
LocalDataPoolManager* getHkManagerHandle() override;
// Mode Helpers.
virtual void modeChanged(Mode_t mode, Submode_t submode);
void startTransition(Mode_t mode, Submode_t submode) override;
void getMode(Mode_t* mode, Submode_t* submode) override;
void setToExternalControl() override;
void announceMode(bool recursive) override;
private:
ActionHelper actionHelper; ActionHelper actionHelper;
ModeHelper modeHelper; ModeHelper modeHelper;
HealthHelper healthHelper; HealthHelper healthHelper;
@ -111,6 +79,35 @@ class FreshDeviceHandlerBase : public SystemObject,
MessageQueueIF* messageQueue; MessageQueueIF* messageQueue;
// Pool Manager overrides. virtual ReturnValue_t handleQueue();
LocalDataPoolManager* getHkManagerHandle() override;
// Mode Helpers.
virtual void modeChanged(Mode_t mode, Submode_t submode);
void startTransition(Mode_t mode, Submode_t submode) override;
void getMode(Mode_t* mode, Submode_t* submode) override;
void setToExternalControl() override;
void announceMode(bool recursive) override;
// System Object overrides.
ReturnValue_t initialize() override;
// HK manager abstract functions.
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override = 0;
// Mode abstract functions
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override = 0;
// Health Overrides.
ReturnValue_t setHealth(HealthState health) override;
// Action override. Forward to user.
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override = 0;
// Executable overrides.
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initializeAfterTaskCreation() override;
private:
// Executable Overrides.
void setTaskIF(PeriodicTaskIF* task) override;
}; };