From 42cc9c0fa837f53870911904b29c5504aa505e7a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Nov 2023 11:57:49 +0100 Subject: [PATCH] add required fields --- linux/payload/FreshSupvHandler.cpp | 20 ++++++++++++++++++-- linux/payload/FreshSupvHandler.h | 13 ++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/linux/payload/FreshSupvHandler.cpp b/linux/payload/FreshSupvHandler.cpp index 995f3441..31f42924 100644 --- a/linux/payload/FreshSupvHandler.cpp +++ b/linux/payload/FreshSupvHandler.cpp @@ -7,7 +7,16 @@ using namespace returnvalue; std::atomic_bool supv::SUPV_ON = false; -FreshSupvHandler::FreshSupvHandler(DhbConfig cfg) : FreshDeviceHandlerBase(cfg), hkSet(this) {} +FreshSupvHandler::FreshSupvHandler(DhbConfig cfg, CookieIF *comCookie, Gpio uartIsolatorSwitch, + PowerSwitchIF &switchIF, power::Switch_t powerSwitch, + PlocSupvUartManager &supvHelper) + : FreshDeviceHandlerBase(cfg), + hkSet(this), + bootStatusReport(this), + latchupStatusReport(this), + countersReport(this), + adcReport(this), + uartManager(supvHelper) {} void FreshSupvHandler::performDeviceOperation(uint8_t opCode) { if (!transitionActive and mode == MODE_OFF) { @@ -17,7 +26,9 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) { if (opCode == OpCode::DEFAULT_OPERATION) { if (transitionActive) { // TODO: Perform transition handling: OFF to ON and ON to OFF. - + // For OFF to ON, command power switch first, then to isolato switch handling, and lastly + // ensure succesfull communication + // For ON to OFF ???? } else { if (mode == MODE_NORMAL) { // Normal mode handling. Request normal datasets and add them to command map. @@ -117,6 +128,11 @@ ReturnValue_t FreshSupvHandler::initializeLocalDataPool(localpool::DataPool &loc return returnvalue::OK; } +ReturnValue_t FreshSupvHandler::setHealth(HealthState health) { + // TODO: Go to off is the device is commanded faulty. + return returnvalue::OK; +} + ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t *data, size_t size) { // TODO: Handle all commands here. Need to add them to some command map. Send command immediately diff --git a/linux/payload/FreshSupvHandler.h b/linux/payload/FreshSupvHandler.h index 044a0418..fdb38514 100644 --- a/linux/payload/FreshSupvHandler.h +++ b/linux/payload/FreshSupvHandler.h @@ -1,14 +1,21 @@ #ifndef LINUX_PAYLOAD_FRESHSUPVHANDLER_H_ #define LINUX_PAYLOAD_FRESHSUPVHANDLER_H_ +#include + +#include "PlocSupvUartMan.h" #include "fsfw/devicehandlers/FreshDeviceHandlerBase.h" +#include "fsfw/power/definitions.h" +#include "fsfw_hal/linux/gpio/Gpio.h" #include "plocSupvDefs.h" class FreshSupvHandler : public FreshDeviceHandlerBase { public: enum OpCode { DEFAULT_OPERATION = 0, HANDLE_ACTIVE_CMDS = 1 }; - FreshSupvHandler(DhbConfig cfg); + FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uartIsolatorSwitch, + PowerSwitchIF& switchIF, power::Switch_t powerSwitch, + PlocSupvUartManager& supvHelper); /** * Periodic helper executed function, implemented by child class. */ @@ -23,6 +30,8 @@ class FreshSupvHandler : public FreshDeviceHandlerBase { ReturnValue_t handleCommandMessage(CommandMessage* message) override; private: + ReturnValue_t setHealth(HealthState health) override; + // HK manager abstract functions. LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, @@ -36,6 +45,8 @@ class FreshSupvHandler : public FreshDeviceHandlerBase { const uint8_t* data, size_t size) override; private: + PlocSupvUartManager uartManager; + supv::HkSet hkSet; supv::BootStatusReport bootStatusReport; supv::LatchupStatusReport latchupStatusReport;