diff --git a/CableTool/widget.cpp b/CableTool/widget.cpp index 967640e..75a55c8 100644 --- a/CableTool/widget.cpp +++ b/CableTool/widget.cpp @@ -161,7 +161,7 @@ int Widget::readData() int len = qarry.size(); qDebug() << __FUNCTION__ << "LEN=" << len << endl; - HexPrint(__FUNCTION__, buf, len); + //HexPrint(__FUNCTION__, buf, len); if (len < 0 || len > USART_BUF_SIZE) { @@ -246,6 +246,16 @@ int Widget::protoDevInfoGet(char *pdata, int len) return 0; } +int Widget::protoDevConfigGet(char *pdata, int len) +{ + memcpy(&clientDevConfig, pdata, len); +} + +int Widget::protoDevCsgConfigGet(char *pdata, int len) +{ + memcpy(&csgConfig, pdata, len); +} + /* 按钮使能操作. */ void Widget::buttonEnable(bool flag) { @@ -433,6 +443,9 @@ int Widget::paraseProtocols(char *data) } case DEBUG_C_DEV_CONFIG: // 获取配置成功后更新页面 { + char *pbody = data + sizeof(proto_head_t); + protoDevConfigGet(pbody, sizeof(devConfig)); + uiDevConfigRefresh(); break; } case DEBUG_C_DEV_CONFIG_SET: @@ -484,9 +497,13 @@ int Widget::paraseProtocols(char *data) case DEBUG_PRV_ADJ_MANUAL: //_debug_pkt_adj_manual(); break; - case DEBUG_PRV_CSG_CONFIG: - //_debug_pkt_csg_config_get(); - break; + case DEBUG_PRV_CSG_CONFIG: // 获取配置成功后更新页面 + { + char *pbody = data + sizeof(proto_head_t); + protoDevCsgConfigGet(pbody, sizeof(csgConfig)); + uiDevConfigRefresh(); + break; + } case DEBUG_PRV_CSG_CONFIG_SET: //_debug_pkt_csg_config_set(); break; @@ -511,7 +528,7 @@ int Widget::snedMsgDeviceInfoGet() *crc = crc32(buf, header->len); //printHexArray(__FUNCTION__, buf, header->len + 4); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -623,7 +640,7 @@ int Widget::sendMsgDeviceConfigSet() devConfig *data = reinterpret_cast(buf + sizeof(proto_head_t)); /* 初始化报文头. */ - protoHeaderInit(header, sizeof(proto_head_t) + sizeof(devConfig), clientDevInfo.id, DEBUG_CT_REQUEST, DEBUG_C_DEV_CONFIG); + protoHeaderInit(header, sizeof(proto_head_t) + sizeof(devConfig), clientDevInfo.id, DEBUG_CT_REQUEST, DEBUG_C_DEV_CONFIG_SET); memcpy(data, &clientDevConfig, sizeof(devConfig)); @@ -632,7 +649,7 @@ int Widget::sendMsgDeviceConfigSet() *crc = crc32(buf, header->len); //printHexArray(__FUNCTION__, buf, header->len + 4); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -668,7 +685,7 @@ int Widget::sendMsgDeviceCsgConfigGet() crc = reinterpret_cast(buf + header->len); *crc = crc32(buf, header->len); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -688,7 +705,7 @@ int Widget::sendMsgDeviceCsgConfigSet() crc = reinterpret_cast(buf + header->len); *crc = crc32(buf, header->len); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -706,7 +723,7 @@ int Widget::sendMsgDeviceRealDataGet() crc = reinterpret_cast(buf + header->len); *crc = crc32(buf, header->len); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -724,7 +741,7 @@ int Widget::sendMsgWaveCol() crc = reinterpret_cast(buf + header->len); *crc = crc32(buf, header->len); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } @@ -745,13 +762,11 @@ int Widget::senMsgWaveCal() crc = reinterpret_cast(buf + header->len); *crc = crc32(buf, header->len); - HexPrint(__FUNCTION__, buf, header->len + 4); + //HexPrint(__FUNCTION__, buf, header->len + 4); writeData(buf, header->len + 4); return 0; } - - int Widget::replyUpdate(char *data, int fileType) { mul_head_t *header = reinterpret_cast(data + sizeof(proto_head_t)); @@ -971,7 +986,6 @@ void Widget::on_updateButton_clicked() void Widget::on_configSetButton_clicked() { - qDebug() << "Hello world\n"; if (0 == ui->debugModeBox->currentIndex()) { MONITOR_BITMAP_SET(clientDevConfig.flag, DEV_FLAG_CLI); diff --git a/CableTool/widget.h b/CableTool/widget.h index 7dbcb49..e397d41 100644 --- a/CableTool/widget.h +++ b/CableTool/widget.h @@ -80,6 +80,10 @@ private: int protoHeaderInit(proto_head_t * header, uint16_t len, uint32_t id, uint8_t cmd_type, uint8_t cmd); int protoDevInfoGet(char *pdata, int len); + + int protoDevConfigGet(char *pdata, int len); + + int protoDevCsgConfigGet(char *pdata, int len); void buttonEnable(bool flag); void uiDevInfoRefresh(); void uiDevConfigRefresh(); diff --git a/build-CableTool-Desktop_Qt_5_11_3_MinGW_32bit-Debug/debug/moc_widget.o b/build-CableTool-Desktop_Qt_5_11_3_MinGW_32bit-Debug/debug/moc_widget.o deleted file mode 100644 index e113a4f..0000000 Binary files a/build-CableTool-Desktop_Qt_5_11_3_MinGW_32bit-Debug/debug/moc_widget.o and /dev/null differ