#include "PDU2Handler.h" #include #include PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie, uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress) : GomspaceDeviceHandler(objectId, comIF, comCookie, maxConfigTableAddress, maxHkTableAddress, PDU::HK, &pdu2HkTableDataset), pdu2HkTableDataset(this) { } PDU2Handler::~PDU2Handler() { } ReturnValue_t PDU2Handler::buildNormalDeviceCommand( DeviceCommandId_t * id) { *id = GOMSPACE::REQUEST_HK_TABLE; return buildCommandFromCommand(*id, NULL, 0); } void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { ReturnValue_t result; /* Pointer points to beginning of payload data */ pdu2HkTableDataset.read(); const uint8_t* payloadPtr = packet + 12; size_t size = (size_t)hkTableSize; result = pdu2HkTableDataset.deSerialize(&payloadPtr, &size, SerializeIF::Endianness::BIG); if (result != RETURN_OK) { sif::debug << "PDU2Handler::letChildHandleHkReply: Failed to deserialize housekeeping " << "packet array into pdu2HkTableDataset" << std::endl; return; } // FullTableReply fullTableReply(id, HK_TABLE_ID, &pdu2HkTableDataset); // handleDeviceTM(&fullTableReply, id, true); #if OBSW_ENHANCED_PRINTOUT == 1 float temperatureC = pdu2HkTableDataset.temperature.value; sif::info << "PDU2 Temperature: " << temperatureC << "°C" << std::endl; pdu2HkTableDataset.commit(); #endif } ReturnValue_t PDU2Handler::initializeLocalDataPool( localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_Q7S, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_RW, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_SUS_REDUNDANT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_Q7S, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_RW, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VCC, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VBAT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_TEMPERATURE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CONV_EN_1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CONV_EN_2, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_CONV_EN_3, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_CONV_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, new PoolEntry( { 0 })); #if TE0720 == 1 localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry( { 1 })); #else localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); #endif localDataPoolMap.emplace(P60System::PDU2_OUT_EN_SUS_REDUNDANT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_OUT_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCNT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_UPTIME, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_RESETCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BATT_MODE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_BATT_MODE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_Q7S, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_RW, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_0, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_2, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_3, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_4, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_5, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_7, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_0_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_1_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_2_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_3_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_4_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_5_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_6_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_7_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DUMMY_DEVICE_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_GND, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_I2C, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CAN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP2, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_GND_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_I2C_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CAN_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT1, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT2, new PoolEntry( { 0 })); return HasReturnvaluesIF::RETURN_OK; }