eive-obsw/linux/payload/FreshSupvHandler.h

68 lines
2.4 KiB
C
Raw Normal View History

2023-11-09 11:11:47 +01:00
#ifndef LINUX_PAYLOAD_FRESHSUPVHANDLER_H_
#define LINUX_PAYLOAD_FRESHSUPVHANDLER_H_
2023-11-09 11:57:49 +01:00
#include <fsfw/power/PowerSwitchIF.h>
#include "PlocSupvUartMan.h"
2023-11-09 11:11:47 +01:00
#include "fsfw/devicehandlers/FreshDeviceHandlerBase.h"
2023-11-09 11:57:49 +01:00
#include "fsfw/power/definitions.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
2023-11-09 11:44:00 +01:00
#include "plocSupvDefs.h"
2023-11-09 11:35:28 +01:00
class FreshSupvHandler : public FreshDeviceHandlerBase {
public:
enum OpCode { DEFAULT_OPERATION = 0, HANDLE_ACTIVE_CMDS = 1 };
2023-11-09 11:57:49 +01:00
FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uartIsolatorSwitch,
PowerSwitchIF& switchIF, power::Switch_t powerSwitch,
PlocSupvUartManager& supvHelper);
2023-11-09 11:35:28 +01:00
/**
* Periodic helper executed function, implemented by child class.
*/
void performDeviceOperation(uint8_t opCode) override;
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
/**
* Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages.
* @param message
* @return
*/
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
private:
2023-11-09 11:57:49 +01:00
ReturnValue_t setHealth(HealthState health) override;
2023-11-09 11:35:28 +01:00
// HK manager abstract functions.
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
// Mode abstract functions
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
// Action override. Forward to user.
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
private:
2023-11-09 11:57:49 +01:00
PlocSupvUartManager uartManager;
2023-11-09 11:44:00 +01:00
supv::HkSet hkSet;
supv::BootStatusReport bootStatusReport;
supv::LatchupStatusReport latchupStatusReport;
supv::CountersReport countersReport;
supv::AdcReport adcReport;
2023-11-09 11:35:28 +01:00
bool transitionActive = false;
2023-11-09 11:44:00 +01:00
PoolEntry<uint16_t> adcRawEntry = PoolEntry<uint16_t>(16);
PoolEntry<uint16_t> adcEngEntry = PoolEntry<uint16_t>(16);
PoolEntry<uint32_t> latchupCounters = PoolEntry<uint32_t>(7);
PoolEntry<uint8_t> fmcStateEntry = PoolEntry<uint8_t>(1);
PoolEntry<uint8_t> bootStateEntry = PoolEntry<uint8_t>(1);
PoolEntry<uint8_t> bootCyclesEntry = PoolEntry<uint8_t>(1);
PoolEntry<uint32_t> tempSupEntry = PoolEntry<uint32_t>(1);
2023-11-09 11:35:28 +01:00
};
2023-11-09 11:11:47 +01:00
#endif /* LINUX_PAYLOAD_FRESHSUPVHANDLER_H_ */