eive-obsw/mission/devices/P60DockHandler.h

75 lines
3.0 KiB
C
Raw Normal View History

2021-01-28 14:55:21 +01:00
#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_
#define MISSION_DEVICES_P60DOCKHANDLER_H_
2021-02-03 08:09:54 +01:00
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
2021-01-28 14:55:21 +01:00
2022-01-17 15:58:27 +01:00
#include "GomspaceDeviceHandler.h"
2022-09-16 12:28:39 +02:00
#include "eive/eventSubsystemIds.h"
2021-01-28 14:55:21 +01:00
/**
* @brief Device handler for the P60Dock. The P60Dock serves as carrier for the ACU, PDU1 and
* PDU2. Via the P60Dock each of these modules can be turned on and off individually.
*/
2022-01-17 15:58:27 +01:00
class P60DockHandler : public GomspaceDeviceHandler {
public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::P60_DOCK_HANDLER;
2022-04-07 13:11:20 +02:00
//! [EXPORT] : [COMMENT] P60 boot count is broadcasted once at SW startup. P1: Boot count
static constexpr Event P60_BOOT_COUNT = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
//! [EXPORT] : [COMMENT] Battery mode is broadcasted at startup. P1: Mode
2022-04-07 13:11:20 +02:00
static constexpr Event BATT_MODE = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
//! [EXPORT] : [COMMENT] Battery mode has changed. P1: Old mode. P2: New mode
2022-04-07 13:11:20 +02:00
static constexpr Event BATT_MODE_CHANGED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
2022-04-28 15:58:31 +02:00
P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir);
2022-01-17 15:58:27 +01:00
virtual ~P60DockHandler();
2022-04-26 10:37:25 +02:00
void setDebugMode(bool enable);
2022-01-17 15:58:27 +01:00
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
protected:
/**
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
2022-08-27 01:02:08 +02:00
void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t* packet) override;
2022-01-17 15:58:27 +01:00
/**
* This command handles printing the HK table to the console. This is useful for debugging
* purposes
* @return
*/
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
2022-04-07 12:22:08 +02:00
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
2022-01-17 15:58:27 +01:00
void printHkTableSwitchIV();
void printHkTableLatchups();
2022-01-17 15:58:27 +01:00
private:
2022-04-07 12:22:08 +02:00
P60Dock::CoreHkSet coreHk;
P60Dock::HkTableDataset auxHk;
2022-08-26 14:28:06 +02:00
TableConfig cfg;
bool firstHk = true;
2022-04-26 10:37:25 +02:00
bool debugMode = false;
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 16;
2022-01-17 15:58:27 +01:00
2022-04-04 17:16:52 +02:00
PoolEntry<int16_t> hkCurrents = PoolEntry<int16_t>(P60Dock::hk::CHNLS_LEN);
PoolEntry<uint16_t> hkVoltages = PoolEntry<uint16_t>(P60Dock::hk::CHNLS_LEN);
PoolEntry<uint8_t> outputEnables = PoolEntry<uint8_t>(P60Dock::hk::CHNLS_LEN);
PoolEntry<uint16_t> latchups = PoolEntry<uint16_t>(P60Dock::hk::CHNLS_LEN);
PoolEntry<uint8_t> devicesType = PoolEntry<uint8_t>(P60Dock::NUM_DEVS);
PoolEntry<uint8_t> devicesStatus = PoolEntry<uint8_t>(P60Dock::NUM_DEVS);
2022-01-17 15:58:27 +01:00
/**
* @brief Function extracts the hk table information from the received csp packet and stores
* the values in the p60dockHkTableDataset.
*/
void parseHkTableReply(const uint8_t* packet);
2021-01-28 14:55:21 +01:00
};
#endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */