hkdisplay.cpp
205 lines
| 10.9 KiB
| text/x-c
|
CppLexer
/ common_PLE / hkdisplay.cpp
r23 | #include "hkdisplay.h" | |||
HKDisplay::HKDisplay(QWidget *parent) : | ||||
QWidget(parent) | ||||
{ | ||||
r24 | mainLayout = new QGridLayout(); | |||
groupbox_lfrStatusWord = new QGroupBox("LFR Status Word"); | ||||
box_lfrStatusWord = new QVBoxLayout(); | ||||
hk_lfr_mode = new QLabel("hk_lfr_mode: -"); | ||||
hk_lfr_dpu_spw_enabled = new QLabel("hk_lfr_dpu_spw_enabled: -"); | ||||
hk_lfr_dpu_link_state = new QLabel("hk_lfr_dpu_link_state: -"); | ||||
sy_lfr_watchdog_enabled = new QLabel("sy_lfr_watchdog_enabled: -"); | ||||
hk_lfr_calib_enabled = new QLabel("hk_lfr_calib_enabled: -"); | ||||
hk_lfr_reset_cause = new QLabel("hk_lfr_reset_cause: -"); | ||||
box_lfrStatusWord->addWidget(hk_lfr_mode); | ||||
box_lfrStatusWord->addWidget(hk_lfr_dpu_spw_enabled); | ||||
box_lfrStatusWord->addWidget(hk_lfr_dpu_link_state); | ||||
box_lfrStatusWord->addWidget(sy_lfr_watchdog_enabled); | ||||
box_lfrStatusWord->addWidget(hk_lfr_calib_enabled); | ||||
box_lfrStatusWord->addWidget(hk_lfr_reset_cause); | ||||
box_lfrStatusWord->insertStretch(6); | ||||
groupbox_lfrStatusWord->setLayout(box_lfrStatusWord); | ||||
groupbox_lfrSWVersion = new QGroupBox("LFR Software Version"); | ||||
box_lfrSWVersion = new QVBoxLayout(); | ||||
sy_lfr_sw_version_n1 = new QLabel("sy_lfr_sw_version_n1: -"); | ||||
sy_lfr_sw_version_n2 = new QLabel("sy_lfr_sw_version_n2: -"); | ||||
sy_lfr_sw_version_n3 = new QLabel("sy_lfr_sw_version_n3: -"); | ||||
sy_lfr_sw_version_n4 = new QLabel("sy_lfr_sw_version_n4: -"); | ||||
box_lfrSWVersion->addWidget(sy_lfr_sw_version_n1); | ||||
box_lfrSWVersion->addWidget(sy_lfr_sw_version_n2); | ||||
box_lfrSWVersion->addWidget(sy_lfr_sw_version_n3); | ||||
box_lfrSWVersion->addWidget(sy_lfr_sw_version_n4); | ||||
box_lfrSWVersion->insertStretch(4); | ||||
groupbox_lfrSWVersion->setLayout(box_lfrSWVersion); | ||||
groupbox_tcStatistics = new QGroupBox("TC Statistics"); | ||||
box_tcStatistics = new QVBoxLayout(); | ||||
hk_lfr_update_info_tc_cnt = new QLabel("hk_lfr_update_info_tc_cnt: -"); | ||||
hk_lfr_update_time_tc_cnt = new QLabel("hk_lfr_update_time_tc_cnt: -"); | ||||
hk_dpu_exe_tc_lfr_cnt = new QLabel("hk_dpu_exe_tc_lfr_cnt: -"); | ||||
hk_dpu_rej_tc_lfr_cnt = new QLabel("hk_dpu_rej_tc_lfr_cnt: -"); | ||||
hk_lfr_last_exe_tc_id = new QLabel("hk_lfr_last_exe_tc_id: -"); | ||||
hk_lfr_last_exe_tc_type = new QLabel("hk_lfr_last_exe_tc_type: -"); | ||||
hk_lfr_last_exe_tc_subtype = new QLabel("hk_lfr_last_exe_tc_subtype: -"); | ||||
hk_lfr_last_exe_tc_time = new QLabel("hk_lfr_last_exe_tc_time: -"); | ||||
hk_lfr_last_rej_tc_id = new QLabel("hk_lfr_last_rej_tc_id: -"); | ||||
hk_lfr_last_rej_tc_type = new QLabel("hk_lfr_last_rej_tc_type: -"); | ||||
hk_lfr_last_rej_tc_subtype = new QLabel("hk_lfr_last_rej_tc_subtype: -"); | ||||
hk_lfr_last_rej_tc_time = new QLabel("hk_lfr_last_rej_tc_time: -"); | ||||
box_tcStatistics->addWidget(hk_lfr_update_info_tc_cnt); | ||||
box_tcStatistics->addWidget(hk_lfr_update_time_tc_cnt); | ||||
box_tcStatistics->addWidget(hk_dpu_exe_tc_lfr_cnt); | ||||
box_tcStatistics->addWidget(hk_dpu_rej_tc_lfr_cnt); | ||||
box_tcStatistics->addWidget(hk_lfr_last_exe_tc_id); | ||||
box_tcStatistics->addWidget(hk_lfr_last_exe_tc_type); | ||||
box_tcStatistics->addWidget(hk_lfr_last_exe_tc_subtype); | ||||
box_tcStatistics->addWidget(hk_lfr_last_exe_tc_time); | ||||
box_tcStatistics->addWidget(hk_lfr_last_rej_tc_id); | ||||
box_tcStatistics->addWidget(hk_lfr_last_rej_tc_type); | ||||
box_tcStatistics->addWidget(hk_lfr_last_rej_tc_subtype); | ||||
box_tcStatistics->addWidget(hk_lfr_last_rej_tc_time); | ||||
box_tcStatistics->insertStretch(12, 1); | ||||
groupbox_tcStatistics->setLayout(box_tcStatistics); | ||||
groupbox_anomalyStatistics = new QGroupBox("Anomaly Statistics"); | ||||
box_anomalyStatistics = new QVBoxLayout(); | ||||
hk_lfr_le_cnt = new QLabel("hk_lfr_le_cnt: -"); | ||||
hk_lfr_me_cnt = new QLabel("hk_lfr_me_cnt: -"); | ||||
hk_lfr_he_cnt = new QLabel("hk_lfr_he_cnt: -"); | ||||
hk_lfr_last_er_rid = new QLabel("hk_lfr_last_er_rid: -"); | ||||
hk_lfr_last_er_code = new QLabel("hk_lfr_last_er_code: -"); | ||||
hk_lfr_last_er_time = new QLabel("hk_lfr_last_er_time: -"); | ||||
box_anomalyStatistics->addWidget(hk_lfr_le_cnt); | ||||
box_anomalyStatistics->addWidget(hk_lfr_me_cnt); | ||||
box_anomalyStatistics->addWidget(hk_lfr_he_cnt); | ||||
box_anomalyStatistics->addWidget(hk_lfr_last_er_rid); | ||||
box_anomalyStatistics->addWidget(hk_lfr_last_er_code); | ||||
box_anomalyStatistics->addWidget(hk_lfr_last_er_time); | ||||
box_anomalyStatistics->insertStretch(6, 1); | ||||
groupbox_anomalyStatistics->setLayout(box_anomalyStatistics); | ||||
mainLayout->addWidget(groupbox_lfrStatusWord, 0,0,1,1); | ||||
mainLayout->addWidget(groupbox_lfrSWVersion, 0,1,1,1); | ||||
mainLayout->addWidget(groupbox_tcStatistics, 1,0,1,1); | ||||
mainLayout->addWidget(groupbox_anomalyStatistics, 1,1,1,1); | ||||
this->setLayout(mainLayout); | ||||
r23 | } | |||
r24 | ||||
void HKDisplay::displayPacket(TMPacketToRead *tmPacketToRead) | ||||
{ | ||||
Packet_TM_LFR_HK_t *housekeepingPacket; | ||||
if (tmPacketToRead->size != HK_PACKET_SIZE) { | ||||
emit displayMessage("in displayPacket *** HK packet size is " | ||||
+ QString::number(tmPacketToRead->size) | ||||
+ " instead of " | ||||
+ QString::number(HK_PACKET_SIZE)); | ||||
} | ||||
else { | ||||
housekeepingPacket = (Packet_TM_LFR_HK_t *) tmPacketToRead->Value; | ||||
updateLFRMode(housekeepingPacket); | ||||
updateSWVersion(housekeepingPacket); | ||||
updateTCStatistics(housekeepingPacket); | ||||
} | ||||
} | ||||
void HKDisplay::updateLFRMode(Packet_TM_LFR_HK_t *housekeepingPacket) | ||||
{ | ||||
hk_lfr_mode->setText("hk_lfr_mode: " | ||||
+QString::number( ( (housekeepingPacket->lfr_status_word[0] & 0x70) >> 4 ) ) | ||||
); | ||||
} | ||||
void HKDisplay::updateSWVersion(Packet_TM_LFR_HK_t *housekeepingPacket) | ||||
{ | ||||
sy_lfr_sw_version_n1->setText("sy_lfr_sw_version_n1: " | ||||
+QString::number( housekeepingPacket->lfr_sw_version[0] ) | ||||
); | ||||
sy_lfr_sw_version_n2->setText("sy_lfr_sw_version_n2: " | ||||
+QString::number( housekeepingPacket->lfr_sw_version[1] ) | ||||
); | ||||
sy_lfr_sw_version_n3->setText("sy_lfr_sw_version_n3: " | ||||
+QString::number( housekeepingPacket->lfr_sw_version[2] ) | ||||
); | ||||
sy_lfr_sw_version_n4->setText("sy_lfr_sw_version_n4: " | ||||
+QString::number( housekeepingPacket->lfr_sw_version[3] ) | ||||
); | ||||
} | ||||
void HKDisplay::updateTCStatistics(Packet_TM_LFR_HK_t *housekeepingPacket) | ||||
{ | ||||
// TC Statistics | ||||
hk_lfr_update_info_tc_cnt->setText("hk_lfr_update_info_tc_cnt: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_update_info_tc_cnt[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_update_info_tc_cnt[1]) | ||||
); | ||||
hk_lfr_update_time_tc_cnt->setText("hk_lfr_update_time_tc_cnt: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_update_time_tc_cnt[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_update_time_tc_cnt[1]) | ||||
); | ||||
hk_dpu_exe_tc_lfr_cnt->setText("hk_dpu_exe_tc_lfr_cnt: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_dpu_exe_tc_lfr_cnt[0] * 256 | ||||
+ housekeepingPacket->hk_dpu_exe_tc_lfr_cnt[1]) | ||||
); | ||||
hk_dpu_rej_tc_lfr_cnt->setText("hk_dpu_rej_tc_lfr_cnt: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_dpu_rej_tc_lfr_cnt[0] * 256 | ||||
+ housekeepingPacket->hk_dpu_rej_tc_lfr_cnt[1]) | ||||
); | ||||
hk_lfr_last_exe_tc_id->setText("hk_lfr_last_exe_tc_id: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_exe_tc_id[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_exe_tc_id[1], 16) | ||||
); | ||||
hk_lfr_last_exe_tc_type->setText("hk_lfr_last_exe_tc_type: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_exe_tc_type[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_exe_tc_type[1]) | ||||
); | ||||
hk_lfr_last_exe_tc_subtype->setText("hk_lfr_last_exe_tc_subtype: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_exe_tc_subtype[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_exe_tc_subtype[1]) | ||||
); | ||||
hk_lfr_last_exe_tc_time->setText("hk_lfr_last_exe_tc_time: " | ||||
+ QString::number( | ||||
(housekeepingPacket->hk_lfr_last_exe_tc_time[0] << 24) | ||||
+ (housekeepingPacket->hk_lfr_last_exe_tc_time[1] << 16) | ||||
+ (housekeepingPacket->hk_lfr_last_exe_tc_time[2] << 8) | ||||
+ (housekeepingPacket->hk_lfr_last_exe_tc_time[3]), 16 | ||||
) | ||||
); | ||||
hk_lfr_last_rej_tc_id->setText("hk_lfr_last_rej_tc_id: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_rej_tc_id[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_rej_tc_id[1], 16) | ||||
); | ||||
hk_lfr_last_rej_tc_type->setText("hk_lfr_last_rej_tc_type: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_rej_tc_type[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_rej_tc_type[1]) | ||||
); | ||||
hk_lfr_last_rej_tc_subtype->setText("hk_lfr_last_rej_tc_subtype: " | ||||
+ QString::number( | ||||
housekeepingPacket->hk_lfr_last_rej_tc_subtype[0] * 256 | ||||
+ housekeepingPacket->hk_lfr_last_rej_tc_subtype[1]) | ||||
); | ||||
hk_lfr_last_rej_tc_time->setText("hk_lfr_last_rej_tc_time: " | ||||
+ QString::number( | ||||
(housekeepingPacket->hk_lfr_last_rej_tc_time[0] << 24) | ||||
+ (housekeepingPacket->hk_lfr_last_rej_tc_time[1] << 16) | ||||
+ (housekeepingPacket->hk_lfr_last_rej_tc_time[2] << 8) | ||||
+ (housekeepingPacket->hk_lfr_last_rej_tc_time[3]), 16 | ||||
) | ||||
); | ||||
} | ||||