|
|
|
@ -590,6 +590,21 @@ void Widget::uiDevStateRefresh()
|
|
|
|
|
ui->stateDownTimeLabel->setText(QString::number(clientDevState.scDownTime));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Widget::uiPowerFrequencyRefresh()
|
|
|
|
|
{
|
|
|
|
|
int row = ui->frequencyTable->rowCount();
|
|
|
|
|
int column = ui->frequencyTable->columnCount();
|
|
|
|
|
|
|
|
|
|
for(int32_t i = 0; i < row; i++)
|
|
|
|
|
{
|
|
|
|
|
for(int32_t j = 0; j < column; j++)
|
|
|
|
|
{
|
|
|
|
|
QString temp;
|
|
|
|
|
temp.sprintf("%d", powerFre[ui->freChBox->currentText().toInt() - 1][column * i + j]);
|
|
|
|
|
ui->frequencyTable->item(i, j)->setText(temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Widget::protoContact(char *data)
|
|
|
|
|
{
|
|
|
|
@ -707,6 +722,44 @@ int Widget::protoWaveDataUploadReply(char *data)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 工频录波文件请求处理. */
|
|
|
|
|
int Widget::protoPowerFrequency(char *data)
|
|
|
|
|
{
|
|
|
|
|
mul_head_t *header = reinterpret_cast<mul_head_t*>(data + sizeof(proto_head_t));
|
|
|
|
|
|
|
|
|
|
/* 数据头校验. */
|
|
|
|
|
qDebug() << "recv:index:" << header->index << "freIndex:" << freIndex << "len:" << header->len << endl;
|
|
|
|
|
if (header->index != freIndex
|
|
|
|
|
|| header->len > UPDATE_DATA_SIZE)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 获取文件. */
|
|
|
|
|
memcpy(reinterpret_cast<char*>(powerFre) + header->index * UPDATE_DATA_SIZE, data + sizeof(proto_head_t) + sizeof(mul_head_t), header->len);
|
|
|
|
|
|
|
|
|
|
/* 通知发包线程进入下个状态. */
|
|
|
|
|
if (header->len < UPDATE_DATA_SIZE)
|
|
|
|
|
{
|
|
|
|
|
freIndex = 0;
|
|
|
|
|
ui->upFreIndexLabel->setText("下载完成");
|
|
|
|
|
QMessageBox::information(this, "SUCCEED", "工频录波文件下载完成.", QMessageBox::Ok);
|
|
|
|
|
buttonEnable(true);
|
|
|
|
|
uiPowerFrequencyRefresh();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
freIndex = header->index + 1;
|
|
|
|
|
sendMsgDevicePowerFrequencyGet();
|
|
|
|
|
QString temp;
|
|
|
|
|
temp.sprintf("%d / 10", freIndex + 1);
|
|
|
|
|
ui->upFreIndexLabel->setText(temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::protoState(char *data)
|
|
|
|
|
{
|
|
|
|
|
char *pbody = data + sizeof(proto_head_t);
|
|
|
|
@ -1060,6 +1113,32 @@ int Widget::sendMsgDeviceStateGet()
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Widget::sendMsgDevicePowerFrequencyGet()
|
|
|
|
|
{
|
|
|
|
|
char buf[2048] = {0};
|
|
|
|
|
uint32_t *crc = nullptr;
|
|
|
|
|
|
|
|
|
|
proto_head_t *header = reinterpret_cast<proto_head_t*>(buf);
|
|
|
|
|
mul_head_t *m_head = (mul_head_t*)(buf + sizeof(proto_head_t));
|
|
|
|
|
|
|
|
|
|
/* 初始化报文头. */
|
|
|
|
|
protoHeaderInit(header, sizeof(proto_head_t) + sizeof(mul_head_t), clientDevInfo.id, DEBUG_CT_PRV_REQUEST, DEBUG_PRV_POWER);
|
|
|
|
|
|
|
|
|
|
m_head->index = freIndex;
|
|
|
|
|
m_head->len = 0;
|
|
|
|
|
|
|
|
|
|
/* 计算校验位. */
|
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
|
*crc = crc32(buf, header->len);
|
|
|
|
|
|
|
|
|
|
/* 计算校验位. */
|
|
|
|
|
HexPrint(__FUNCTION__, buf, header->len + 4);
|
|
|
|
|
writeData(buf, header->len + 4);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::sendMsgWaveCol()
|
|
|
|
|
{
|
|
|
|
@ -1408,6 +1487,13 @@ void Widget::on_stateRefreshButton_clicked()
|
|
|
|
|
sendMsgDeviceStateGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Widget::on_freChBox_currentIndexChanged(int index)
|
|
|
|
|
{
|
|
|
|
|
/* 工频数据通道选择按钮. */
|
|
|
|
|
Q_UNUSED(index);
|
|
|
|
|
uiPowerFrequencyRefresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Widget::on_freRefreshButton_clicked()
|
|
|
|
|
{
|
|
|
|
|
/* 刷新工频数据. */
|
|
|
|
@ -1415,8 +1501,7 @@ void Widget::on_freRefreshButton_clicked()
|
|
|
|
|
QString temp;
|
|
|
|
|
temp.sprintf("%d / 10", freIndex);
|
|
|
|
|
ui->upFreIndexLabel->setText(temp);
|
|
|
|
|
//work->multipleIndexSet(freInde);
|
|
|
|
|
//work->stateSet(CM_usart::WS_POWER_FRE_GET);
|
|
|
|
|
sendMsgDevicePowerFrequencyGet();
|
|
|
|
|
|
|
|
|
|
/* 关闭按钮. */
|
|
|
|
|
buttonEnable(false);
|
|
|
|
|