#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_ #define MISSION_DEVICES_P60DOCKHANDLER_H_ #include #include "GomspaceDeviceHandler.h" #include "commonSubsystemIds.h" /** * @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. */ class P60DockHandler : public GomspaceDeviceHandler { public: static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::P60_DOCK_HANDLER; //! [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 static constexpr Event BATT_MODE = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO); //! [EXPORT] : [COMMENT] Battery mode has changed. P1: Old mode. P2: New mode static constexpr Event BATT_MODE_CHANGED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM); P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, FailureIsolationBase* customFdir); virtual ~P60DockHandler(); 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; virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override; /** * This command handles printing the HK table to the console. This is useful for debugging * purposes * @return */ ReturnValue_t printStatus(DeviceCommandId_t cmd) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; void printHkTableSwitchIV(); void printHkTableLatchups(); private: P60Dock::CoreHkSet coreHk; P60Dock::HkTableDataset auxHk; bool firstHk = true; static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 16; PoolEntry hkCurrents = PoolEntry(P60Dock::hk::CHNLS_LEN); PoolEntry hkVoltages = PoolEntry(P60Dock::hk::CHNLS_LEN); PoolEntry outputEnables = PoolEntry(P60Dock::hk::CHNLS_LEN); PoolEntry latchups = PoolEntry(P60Dock::hk::CHNLS_LEN); PoolEntry devicesType = PoolEntry(P60Dock::NUM_DEVS); PoolEntry devicesStatus = PoolEntry(P60Dock::NUM_DEVS); /** * @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); }; #endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */