更新配置界面

remotes/origin/main
“wangbo” 8 months ago
parent b18dfbda2b
commit d03c21761e

@ -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<devConfig*>(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<uint32_t*>(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<uint32_t*>(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<uint32_t*>(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<uint32_t*>(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<uint32_t*>(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<mul_head_t*>(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);

@ -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();

Loading…
Cancel
Save