|
|
@ -20,6 +20,8 @@ using namespace iflytop; |
|
|
|
typedef enum { |
|
|
|
kone_lead_ecg, |
|
|
|
kthree_lead_ecg, |
|
|
|
kone_lead_ecg_v2, |
|
|
|
|
|
|
|
} device_type_t; |
|
|
|
|
|
|
|
static MainWindow *m_mainWindow; |
|
|
@ -226,12 +228,15 @@ void MainWindow::constructUI() { |
|
|
|
{ |
|
|
|
ui->deviceType->addItem("单导联一代(M1001)"); |
|
|
|
ui->deviceType->addItem("三导联一代(M1002)"); |
|
|
|
ui->deviceType->addItem("单导联二代(M1003)"); |
|
|
|
ui->deviceType->setCurrentIndex(0); |
|
|
|
connect(ui->deviceType, &QComboBox::currentTextChanged, this, [this](const QString &text) { |
|
|
|
if (text == "单导联一代(M1001)") { |
|
|
|
m_devicetype = kone_lead_ecg; |
|
|
|
} else if (text == "三导联一代(M1002)") { |
|
|
|
m_devicetype = kthree_lead_ecg; |
|
|
|
} else if (text == "单导联二代(M1003)") { |
|
|
|
m_devicetype = kone_lead_ecg_v2; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -242,15 +247,24 @@ void MainWindow::constructUI() { |
|
|
|
switch (reportType) { |
|
|
|
case ify_hrs_report_heartrate_data: { |
|
|
|
heartrate_report_packet_t *heartrate_report = (heartrate_report_packet_t *)report_packet; |
|
|
|
|
|
|
|
if (m_devicetype == kone_lead_ecg) { |
|
|
|
static uint32_t lastpacket_index = 0; |
|
|
|
static uint32_t lostpacket = 0; |
|
|
|
if ((lastpacket_index + 5) != (heartrate_report->sample_data_index)) { |
|
|
|
lostpacket++; |
|
|
|
} |
|
|
|
lastpacket_index = heartrate_report->sample_data_index; |
|
|
|
reportPreviewShow("[preview data ] lost:%d index %d", lostpacket, heartrate_report->sample_data_index); |
|
|
|
|
|
|
|
if (checkok) { |
|
|
|
uint16_t data0 = (uint16_t)(heartrate_report->data[0]) + ((uint16_t)heartrate_report->data[1] << 8); |
|
|
|
uint16_t data1 = (uint16_t)(heartrate_report->data[2]) + ((uint16_t)heartrate_report->data[3] << 8); |
|
|
|
uint16_t data2 = (uint16_t)(heartrate_report->data[4]) + ((uint16_t)heartrate_report->data[5] << 8); |
|
|
|
uint16_t data3 = (uint16_t)(heartrate_report->data[6]) + ((uint16_t)heartrate_report->data[7] << 8); |
|
|
|
uint16_t data4 = (uint16_t)(heartrate_report->data[8]) + ((uint16_t)heartrate_report->data[9] << 8); |
|
|
|
|
|
|
|
emit doinui_signal(QFunction([this, data0, data1, data2, data3, data4]() { //
|
|
|
|
reportPreviewShow("[preview data ] index %llu %d", data0); |
|
|
|
wp2d->addData("心电", data0, 0); |
|
|
|
wp2d->addData("心电", data1, 2); |
|
|
|
wp2d->addData("心电", data2, 4); |
|
|
@ -262,23 +276,25 @@ void MainWindow::constructUI() { |
|
|
|
})); |
|
|
|
} |
|
|
|
} else if (m_devicetype == kthree_lead_ecg) { |
|
|
|
} else if (m_devicetype == kone_lead_ecg_v2) { |
|
|
|
if (checkok) { |
|
|
|
uint32_t packetlen = len - sizeof(heartrate_report_packet_t); |
|
|
|
static uint32_t lastpacket_index = 0; |
|
|
|
static uint32_t lostpacket = 0; |
|
|
|
if ((lastpacket_index + 50) != (heartrate_report->sample_data_index)) { |
|
|
|
lostpacket++; |
|
|
|
} |
|
|
|
lastpacket_index = heartrate_report->sample_data_index; |
|
|
|
reportPreviewShow("[preview data ] lost:%d index %d %d", lostpacket, heartrate_report->sample_data_index, packetlen); |
|
|
|
|
|
|
|
// heartrate_report->data[]
|
|
|
|
|
|
|
|
// uin
|
|
|
|
// uint16_t header = 0xA55A;
|
|
|
|
// uint16_t tail = 0xB55B;
|
|
|
|
// G_WaveDataChannel.send((uint8_t *)&header, sizeof(header));
|
|
|
|
// G_WaveDataChannel.send((uint8_t *)report_packet, len);
|
|
|
|
// G_WaveDataChannel.send((uint8_t *)&tail, sizeof(tail));
|
|
|
|
|
|
|
|
// if (m_devicetype == kone_lead_ecg) {
|
|
|
|
// reportPreviewShow("[preview data ] checksum_ok:%d index %llu", checkok, heartrate_report->sample_data_index);
|
|
|
|
// } else if (m_devicetype == kthree_lead_ecg) {
|
|
|
|
// displayWave(heartrate_report->data[0], heartrate_report->data[1], heartrate_report->data[2]);
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
int32_t *frame = (int32_t *)heartrate_report->data; |
|
|
|
for (int i = 0; i < 50; i++) { |
|
|
|
int32_t data = frame[i]; |
|
|
|
emit doinui_signal(QFunction([this, data, i]() { wp2d->addData("心电", data, i * 2); })); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
case ify_hrs_report_battery_level: { |
|
|
|
reportPreviewShow("[battery_level ]"); |
|
|
|