|
|
@ -20,6 +20,8 @@ Widget::Widget(QWidget *parent)
|
|
|
|
|
|
|
|
|
|
|
|
memset(&csgConfig, 0, sizeof(csgConfig_t));
|
|
|
|
memset(&csgConfig, 0, sizeof(csgConfig_t));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&clientRealData, 0, sizeof(realData_t));
|
|
|
|
|
|
|
|
|
|
|
|
memset(powerFre, 0, sizeof(powerFre));
|
|
|
|
memset(powerFre, 0, sizeof(powerFre));
|
|
|
|
|
|
|
|
|
|
|
|
isConnected = 0;
|
|
|
|
isConnected = 0;
|
|
|
@ -214,16 +216,6 @@ int Widget::writeData(char *buf, int len)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::protocol()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::procHandle()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::protoHeaderInit(proto_head_t * header, uint16_t len, uint32_t id, uint8_t cmd_type, uint8_t cmd)
|
|
|
|
int Widget::protoHeaderInit(proto_head_t * header, uint16_t len, uint32_t id, uint8_t cmd_type, uint8_t cmd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
header->len = len;
|
|
|
|
header->len = len;
|
|
|
@ -240,22 +232,6 @@ int Widget::protoHeaderInit(proto_head_t * header, uint16_t len, uint32_t id, ui
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::protoDevInfoGet(char *pdata, int len)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
memcpy(&clientDevInfo, pdata, 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)
|
|
|
|
void Widget::buttonEnable(bool flag)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -401,17 +377,140 @@ void Widget::uiDevConfigRefresh()
|
|
|
|
ui->sensor7IdEdit->setText(QString::number(clientDevConfig.sensor_id[6]));
|
|
|
|
ui->sensor7IdEdit->setText(QString::number(clientDevConfig.sensor_id[6]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::guiDevCsgConfigRefresh()
|
|
|
|
void Widget::uiDevCsgConfigRefresh()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ui->passwdEdit->setText(QString(reinterpret_cast<char*>(csgConfig.passwd)));
|
|
|
|
ui->passwdEdit->setText(QString(reinterpret_cast<char*>(csgConfig.passwd)));
|
|
|
|
ui->beatIntervalEdit->setText(QString::number(csgConfig.beatInterval));
|
|
|
|
ui->beatIntervalEdit->setText(QString::number(csgConfig.beatInterval));
|
|
|
|
ui->csgColIntervalEdit->setText(QString::number(csgConfig.collectInterval));
|
|
|
|
ui->csgColIntervalEdit->setText(QString::number(csgConfig.collectInterval));
|
|
|
|
ui->sleepTimeEdit->setText(QString::number(csgConfig.sleepTime));
|
|
|
|
ui->sleepTimeEdit->setText(QString::number(csgConfig.sleepTime));
|
|
|
|
ui->onlineTimeEdit->setText(QString::number(csgConfig.onlineTime));
|
|
|
|
ui->onlineTimeEdit->setText(QString::number(csgConfig.onlineTime));
|
|
|
|
ui->resetTimeEdit->setText(QString(reinterpret_cast<char *>(csgConfig.resetTime)));
|
|
|
|
ui->resetTimeEdit->setText(QString().sprintf("%d:%d:%d", csgConfig.resetTime[0], csgConfig.resetTime[1], csgConfig.resetTime[2]));
|
|
|
|
ui->ciphertextEdit->setText(QString(reinterpret_cast<char*>(csgConfig.ciphertext)));
|
|
|
|
ui->ciphertextEdit->setText(QString(reinterpret_cast<char*>(csgConfig.ciphertext)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::uiDevRealDataRefresh()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QString temp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.temperature / 10.0);
|
|
|
|
|
|
|
|
ui->tempLabel->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.vin / 1000.0);
|
|
|
|
|
|
|
|
ui->vinLabel->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.vsc / 1000.0);
|
|
|
|
|
|
|
|
ui->vscLabel->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.vbat / 1000.0);
|
|
|
|
|
|
|
|
ui->vbatLabel->setText(temp);
|
|
|
|
|
|
|
|
ui->signalLabel->setText(QString::number(clientRealData.CSQ));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[0] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp1Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[1] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp2Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[2] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp3Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[3] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp4Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[4] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp5Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[5] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp6Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.sen_temp[6] / 10.0);
|
|
|
|
|
|
|
|
ui->senTemp7Label->setText(temp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->senShortLabel->setText(clientRealData.senShort ? "是" : "否");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->senX1Label->setText(QString::number(clientRealData.senX[0] - 16000));
|
|
|
|
|
|
|
|
ui->senX3Label->setText(QString::number(clientRealData.senX[2] - 16000));
|
|
|
|
|
|
|
|
ui->senX5Label->setText(QString::number(clientRealData.senX[4] - 16000));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->senY1Label->setText(QString::number(clientRealData.senY[0] - 16000));
|
|
|
|
|
|
|
|
ui->senY3Label->setText(QString::number(clientRealData.senY[2] - 16000));
|
|
|
|
|
|
|
|
ui->senY5Label->setText(QString::number(clientRealData.senY[4] - 16000));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->senZ1Label->setText(QString::number(clientRealData.senZ[0] - 16000));
|
|
|
|
|
|
|
|
ui->senZ3Label->setText(QString::number(clientRealData.senZ[2] - 16000));
|
|
|
|
|
|
|
|
ui->senZ5Label->setText(QString::number(clientRealData.senZ[4] - 16000));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[0] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec1Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[1] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec2Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[2] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec3Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[3] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec4Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[4] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec5Label->setText(temp);
|
|
|
|
|
|
|
|
temp.sprintf("%.2f", clientRealData.elec[5] / 1000.0);
|
|
|
|
|
|
|
|
ui->elec6Label->setText(temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::protoContact(char *data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
|
|
|
|
memcpy(&clientDevInfo, pbody, sizeof(devInfo));
|
|
|
|
|
|
|
|
uiDevInfoRefresh();
|
|
|
|
|
|
|
|
buttonEnable(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::protoConfig(char *data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
|
|
|
|
memcpy(&clientDevConfig, pbody, sizeof(devConfig));
|
|
|
|
|
|
|
|
uiDevConfigRefresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::protoCsgConfig(char *data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
|
|
|
|
memcpy(&csgConfig, pbody, sizeof(csgConfig_t));
|
|
|
|
|
|
|
|
uiDevCsgConfigRefresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::protoRealdata(char *data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
|
|
|
|
memcpy(&clientRealData, pbody, sizeof(realData_t));
|
|
|
|
|
|
|
|
uiDevRealDataRefresh();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isDataRefresh)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sendMsgDeviceRealDataGet();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::protoUpdateReply(char *data, int fileType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mul_head_t *header = reinterpret_cast<mul_head_t*>(data + sizeof(proto_head_t));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 数据头验证. */
|
|
|
|
|
|
|
|
qDebug() << "recv:index:" << header->index << "upPackIndex:" << upPackIndex << "len:" << header->len << endl;
|
|
|
|
|
|
|
|
if (header->index != upPackIndex
|
|
|
|
|
|
|
|
|| header->len > UPDATE_DATA_SIZE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 发送报文. */
|
|
|
|
|
|
|
|
/* 小于 CM_U_RX_M_PKT_MAX, 表示发送完成进入下个状态, 否则继续发送. */
|
|
|
|
|
|
|
|
if (header->len < UPDATE_DATA_SIZE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
upPackIndex = 0;
|
|
|
|
|
|
|
|
ui->upFileSizeLabel->setText("升级完成");
|
|
|
|
|
|
|
|
QMessageBox::information(this, "SUCCEED", "文件" + filePath + "升级完成.", QMessageBox::Ok);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
upPackIndex++;
|
|
|
|
|
|
|
|
sendMsgDeviceUpdate(fileType);
|
|
|
|
|
|
|
|
QString temp;
|
|
|
|
|
|
|
|
upFileRecvSize += header->len;
|
|
|
|
|
|
|
|
temp.sprintf("%d / %lld", upFileRecvSize, upFileSize);
|
|
|
|
|
|
|
|
ui->upFileSizeLabel->setText(temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::paraseProtocols(char *data)
|
|
|
|
int Widget::paraseProtocols(char *data)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -425,13 +524,9 @@ int Widget::paraseProtocols(char *data)
|
|
|
|
switch (header->cmd)
|
|
|
|
switch (header->cmd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case DEBUG_C_CONTACT: // 获取配置成功后更新页面
|
|
|
|
case DEBUG_C_CONTACT: // 获取配置成功后更新页面
|
|
|
|
{
|
|
|
|
protoContact(data);
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
break;
|
|
|
|
protoDevInfoGet(pbody, sizeof(devInfo));
|
|
|
|
|
|
|
|
uiDevInfoRefresh();
|
|
|
|
|
|
|
|
buttonEnable(true);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case DEBUG_C_DEV_INFO_SET:
|
|
|
|
case DEBUG_C_DEV_INFO_SET:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DEBUG_C_RESET:
|
|
|
|
case DEBUG_C_RESET:
|
|
|
@ -441,22 +536,12 @@ int Widget::paraseProtocols(char *data)
|
|
|
|
//_debug_pkt_default();
|
|
|
|
//_debug_pkt_default();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DEBUG_C_UPDATE_APP:
|
|
|
|
case DEBUG_C_UPDATE_APP:
|
|
|
|
{
|
|
|
|
|
|
|
|
replyUpdate(data, header->cmd);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case DEBUG_C_UPDATE_IAP:
|
|
|
|
case DEBUG_C_UPDATE_IAP:
|
|
|
|
{
|
|
|
|
protoUpdateReply(data, header->cmd);
|
|
|
|
replyUpdate(data, header->cmd);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case DEBUG_C_DEV_CONFIG: // 获取配置成功后更新页面
|
|
|
|
case DEBUG_C_DEV_CONFIG: // 获取配置成功后更新页面
|
|
|
|
{
|
|
|
|
protoConfig(data);
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
break;
|
|
|
|
protoDevConfigGet(pbody, sizeof(devConfig));
|
|
|
|
|
|
|
|
uiDevConfigRefresh();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case DEBUG_C_DEV_CONFIG_SET:
|
|
|
|
case DEBUG_C_DEV_CONFIG_SET:
|
|
|
|
//buttonEnable(false);
|
|
|
|
//buttonEnable(false);
|
|
|
|
//snedMsgDeviceInfoGet();
|
|
|
|
//snedMsgDeviceInfoGet();
|
|
|
@ -471,8 +556,8 @@ int Widget::paraseProtocols(char *data)
|
|
|
|
switch (header->cmd)
|
|
|
|
switch (header->cmd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case DEBUG_PRV_REALDATA:
|
|
|
|
case DEBUG_PRV_REALDATA:
|
|
|
|
//_debug_pkt_data_get();
|
|
|
|
protoRealdata(data);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DEBUG_PRV_POWER:
|
|
|
|
case DEBUG_PRV_POWER:
|
|
|
|
//_debug_pkt_power_fre_get();
|
|
|
|
//_debug_pkt_power_fre_get();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -507,12 +592,8 @@ int Widget::paraseProtocols(char *data)
|
|
|
|
//_debug_pkt_adj_manual();
|
|
|
|
//_debug_pkt_adj_manual();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DEBUG_PRV_CSG_CONFIG: // 获取配置成功后更新页面
|
|
|
|
case DEBUG_PRV_CSG_CONFIG: // 获取配置成功后更新页面
|
|
|
|
{
|
|
|
|
protoCsgConfig(data);
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
break;
|
|
|
|
protoDevCsgConfigGet(pbody, sizeof(csgConfig));
|
|
|
|
|
|
|
|
uiDevConfigRefresh();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case DEBUG_PRV_CSG_CONFIG_SET:
|
|
|
|
case DEBUG_PRV_CSG_CONFIG_SET:
|
|
|
|
//_debug_pkt_csg_config_set();
|
|
|
|
//_debug_pkt_csg_config_set();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -694,7 +775,7 @@ int Widget::sendMsgDeviceCsgConfigGet()
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
*crc = crc32(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);
|
|
|
|
writeData(buf, header->len + 4);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -714,7 +795,7 @@ int Widget::sendMsgDeviceCsgConfigSet()
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
*crc = crc32(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);
|
|
|
|
writeData(buf, header->len + 4);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -732,7 +813,7 @@ int Widget::sendMsgDeviceRealDataGet()
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
*crc = crc32(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);
|
|
|
|
writeData(buf, header->len + 4);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -776,37 +857,7 @@ int Widget::senMsgWaveCal()
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::replyUpdate(char *data, int fileType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mul_head_t *header = reinterpret_cast<mul_head_t*>(data + sizeof(proto_head_t));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 数据头验证. */
|
|
|
|
|
|
|
|
qDebug() << "recv:index:" << header->index << "upPackIndex:" << upPackIndex << "len:" << header->len << endl;
|
|
|
|
|
|
|
|
if (header->index != upPackIndex
|
|
|
|
|
|
|
|
|| header->len > UPDATE_DATA_SIZE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 发送报文. */
|
|
|
|
|
|
|
|
/* 小于 CM_U_RX_M_PKT_MAX, 表示发送完成进入下个状态, 否则继续发送. */
|
|
|
|
|
|
|
|
if (header->len < UPDATE_DATA_SIZE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
upPackIndex = 0;
|
|
|
|
|
|
|
|
ui->upFileSizeLabel->setText("升级完成");
|
|
|
|
|
|
|
|
QMessageBox::information(this, "SUCCEED", "文件" + filePath + "升级完成.", QMessageBox::Ok);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
upPackIndex++;
|
|
|
|
|
|
|
|
sendMsgDeviceUpdate(fileType);
|
|
|
|
|
|
|
|
QString temp;
|
|
|
|
|
|
|
|
upFileRecvSize += header->len;
|
|
|
|
|
|
|
|
temp.sprintf("%d / %lld", upFileRecvSize, upFileSize);
|
|
|
|
|
|
|
|
ui->upFileSizeLabel->setText(temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1072,6 +1123,13 @@ void Widget::on_csgConfigSetButton_clicked()
|
|
|
|
csgConfig.resetTime[i] = static_cast<uint8_t>(list[i].toUInt());
|
|
|
|
csgConfig.resetTime[i] = static_cast<uint8_t>(list[i].toUInt());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stringToChar(ui->ciphertextEdit->text(), reinterpret_cast<char*>(csgConfig.ciphertext), CSG_CIPHERTEXT_LEN);
|
|
|
|
stringToChar(ui->ciphertextEdit->text(), reinterpret_cast<char*>(csgConfig.ciphertext), CSG_CIPHERTEXT_LEN);
|
|
|
|
|
|
|
|
qDebug() << "passwd:" << csgConfig.passwd << endl;
|
|
|
|
|
|
|
|
qDebug() << "beatInterval:" << csgConfig.beatInterval << endl;
|
|
|
|
|
|
|
|
qDebug() << "collectInterval:" << csgConfig.collectInterval << endl;
|
|
|
|
|
|
|
|
qDebug() << "sleepTime:" << csgConfig.sleepTime << endl;
|
|
|
|
|
|
|
|
qDebug() << "onlineTime:" << csgConfig.onlineTime << endl;
|
|
|
|
|
|
|
|
qDebug() << "resetTime:" << csgConfig.resetTime << endl;
|
|
|
|
|
|
|
|
qDebug() << "ciphertext:" << csgConfig.ciphertext << endl;
|
|
|
|
|
|
|
|
|
|
|
|
/* 下发配置. */
|
|
|
|
/* 下发配置. */
|
|
|
|
sendMsgDeviceCsgConfigSet();
|
|
|
|
sendMsgDeviceCsgConfigSet();
|
|
|
@ -1098,6 +1156,7 @@ void Widget::on_dataRefreshAutoButton_clicked()
|
|
|
|
ui->dataRefreshAutoButton->setEnabled(true);
|
|
|
|
ui->dataRefreshAutoButton->setEnabled(true);
|
|
|
|
ui->dataRefreshAutoButton->setText("停止刷新");
|
|
|
|
ui->dataRefreshAutoButton->setText("停止刷新");
|
|
|
|
isDataRefresh = true;
|
|
|
|
isDataRefresh = true;
|
|
|
|
|
|
|
|
sendMsgDeviceRealDataGet();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|