diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index e988bcf..4714891 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -1,4 +1,4 @@ -#include "FreqSwitcherForm.h" +#include "FreqSwitcherForm.h" #include "ui_FreqSwitcherForm.h" #include "DeviceHubWindow.h" @@ -28,11 +28,46 @@ if (frameData->frameType == "0601") { FreqSwitcherStatusDto * statusFrameDto = (FreqSwitcherStatusDto *) frameData; + ui->fsDevStatus->setText(statusFrameDto->devStatus == "1" ? "正常" : "异常"); + ui->fsLockPhaseType->setText(statusFrameDto->lockPhaseType == "1" ? "自由运行" : "跟踪"); + QString lockPhaseStatusStr; + if (statusFrameDto->digitalLockPhaseStatus == "1") lockPhaseStatusStr = "驯服"; + else if (statusFrameDto->digitalLockPhaseStatus == "2") lockPhaseStatusStr = "保持"; + else if (statusFrameDto->digitalLockPhaseStatus == "3") lockPhaseStatusStr = "预热"; + else if (statusFrameDto->digitalLockPhaseStatus == "4") lockPhaseStatusStr = "锁定"; + ui->fsLockPhaseStatus->setText(lockPhaseStatusStr); + ui->fsRefSelectType->setText(statusFrameDto->refSelectType == "1" ? "手动" : "自动"); + ui->fsFreqAccOut->setText(QString("%1 pHz").arg(statusFrameDto->freqAdjustAcc)); + ui->fsOppsPhaseAcc->setText(QString("%1 fs").arg(statusFrameDto->phaseAdjustAcc * 10)); + ui->fsRefFreqSrc->setText(statusFrameDto->refFreqSrc.toInt() < 5 ? QString("参考%1").arg(statusFrameDto->refFreqSrc.toInt() + 1) : "融合"); + + qDebug() << statusFrameDto->toJSON(); + + QJsonObject dataObj = statusFrameDto->toJSON().find("data")->toObject(); + QJsonDocument doc; + + doc.setArray(dataObj.find("freqRefStatusArray")->toArray()); + ui->fsFreqRefStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("localFreqDiffArray")->toArray()); + ui->fsFreqDiff->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("freqRefWeightArray")->toArray()); + ui->fsFreqRefWeight->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("inputFreqTypeArray")->toArray()); + ui->fsInputFreqType->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("outTenStatusArray")->toArray()); + ui->fsOutTenStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("outFiveStatusArray")->toArray()); + ui->fsOutFiveStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); } else if (frameData->frameType == "0602") { FreqSwitcherInterfaceDto * interFrameDto = (FreqSwitcherInterfaceDto *) frameData; - + ui->fsCtrlStatus->setText(interFrameDto->ctrlStatus == "1" ? "程控" : "本控"); } } @@ -56,29 +91,33 @@ } QString commandType = command.value("command").toString(); - if (commandType == "GLF,01") + if (commandType == "GLF,05") { - - } else if (commandType == "GLF,05") - { - + ui->fsLockPhaseTypeSet->setText(command.value("params").toString()); + ui->fsLockPhaseTypeSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,09") { - + ui->fsRefSelectTypeSet->setText(command.value("params").toString()); + ui->fsRefSelectTypeSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,12") { - + ui->fsFreqSrcSet->setText(command.value("params").toString()); + ui->fsFreqSrcSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,17") { - + ui->fsFreqRefWeightSet->setText(command.value("params").toString()); + ui->fsFreqRefWeightSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,20") { - + ui->fsFreqTunSet->setText(command.value("params").toString()); + ui->fsFreqTunSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,21") { - + ui->fsPhaseTunSet->setText(command.value("params").toString()); + ui->fsPhaseTunSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLC,01") { - + ui->fsControlSet->setText(command.value("params").toString()); + ui->fsControlSetRaw->setText(command.value("rawCommand").toString()); } } diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index e988bcf..4714891 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -1,4 +1,4 @@ -#include "FreqSwitcherForm.h" +#include "FreqSwitcherForm.h" #include "ui_FreqSwitcherForm.h" #include "DeviceHubWindow.h" @@ -28,11 +28,46 @@ if (frameData->frameType == "0601") { FreqSwitcherStatusDto * statusFrameDto = (FreqSwitcherStatusDto *) frameData; + ui->fsDevStatus->setText(statusFrameDto->devStatus == "1" ? "正常" : "异常"); + ui->fsLockPhaseType->setText(statusFrameDto->lockPhaseType == "1" ? "自由运行" : "跟踪"); + QString lockPhaseStatusStr; + if (statusFrameDto->digitalLockPhaseStatus == "1") lockPhaseStatusStr = "驯服"; + else if (statusFrameDto->digitalLockPhaseStatus == "2") lockPhaseStatusStr = "保持"; + else if (statusFrameDto->digitalLockPhaseStatus == "3") lockPhaseStatusStr = "预热"; + else if (statusFrameDto->digitalLockPhaseStatus == "4") lockPhaseStatusStr = "锁定"; + ui->fsLockPhaseStatus->setText(lockPhaseStatusStr); + ui->fsRefSelectType->setText(statusFrameDto->refSelectType == "1" ? "手动" : "自动"); + ui->fsFreqAccOut->setText(QString("%1 pHz").arg(statusFrameDto->freqAdjustAcc)); + ui->fsOppsPhaseAcc->setText(QString("%1 fs").arg(statusFrameDto->phaseAdjustAcc * 10)); + ui->fsRefFreqSrc->setText(statusFrameDto->refFreqSrc.toInt() < 5 ? QString("参考%1").arg(statusFrameDto->refFreqSrc.toInt() + 1) : "融合"); + + qDebug() << statusFrameDto->toJSON(); + + QJsonObject dataObj = statusFrameDto->toJSON().find("data")->toObject(); + QJsonDocument doc; + + doc.setArray(dataObj.find("freqRefStatusArray")->toArray()); + ui->fsFreqRefStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("localFreqDiffArray")->toArray()); + ui->fsFreqDiff->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("freqRefWeightArray")->toArray()); + ui->fsFreqRefWeight->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("inputFreqTypeArray")->toArray()); + ui->fsInputFreqType->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("outTenStatusArray")->toArray()); + ui->fsOutTenStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); + + doc.setArray(dataObj.find("outFiveStatusArray")->toArray()); + ui->fsOutFiveStatus->setText(QString::fromUtf8(doc.toJson(QJsonDocument::Compact).constData())); } else if (frameData->frameType == "0602") { FreqSwitcherInterfaceDto * interFrameDto = (FreqSwitcherInterfaceDto *) frameData; - + ui->fsCtrlStatus->setText(interFrameDto->ctrlStatus == "1" ? "程控" : "本控"); } } @@ -56,29 +91,33 @@ } QString commandType = command.value("command").toString(); - if (commandType == "GLF,01") + if (commandType == "GLF,05") { - - } else if (commandType == "GLF,05") - { - + ui->fsLockPhaseTypeSet->setText(command.value("params").toString()); + ui->fsLockPhaseTypeSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,09") { - + ui->fsRefSelectTypeSet->setText(command.value("params").toString()); + ui->fsRefSelectTypeSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,12") { - + ui->fsFreqSrcSet->setText(command.value("params").toString()); + ui->fsFreqSrcSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,17") { - + ui->fsFreqRefWeightSet->setText(command.value("params").toString()); + ui->fsFreqRefWeightSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,20") { - + ui->fsFreqTunSet->setText(command.value("params").toString()); + ui->fsFreqTunSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLF,21") { - + ui->fsPhaseTunSet->setText(command.value("params").toString()); + ui->fsPhaseTunSetRaw->setText(command.value("rawCommand").toString()); } else if (commandType == "GLC,01") { - + ui->fsControlSet->setText(command.value("params").toString()); + ui->fsControlSetRaw->setText(command.value("rawCommand").toString()); } } diff --git a/DeviceHub/FreqSwitcherForm.ui b/DeviceHub/FreqSwitcherForm.ui index e6e98a7..9395f2a 100644 --- a/DeviceHub/FreqSwitcherForm.ui +++ b/DeviceHub/FreqSwitcherForm.ui @@ -6,7 +6,7 @@ 0 0 - 1200 + 1300 600 @@ -26,7 +26,7 @@ Mock FreqSwitcher - + 100 @@ -78,7 +78,7 @@ 20 - 230 + 270 100 30 @@ -93,6 +93,813 @@ 参数设置 + + + + 230 + 120 + 50 + 30 + + + + + + + 170 + 120 + 60 + 30 + + + + + 微软雅黑 + 10 + + + + 控制状态 + + + + + + 300 + 120 + 60 + 30 + + + + + 微软雅黑 + 10 + + + + 锁相模式 + + + + + + 360 + 120 + 50 + 30 + + + + + + + 430 + 120 + 100 + 30 + + + + + 微软雅黑 + 10 + + + + 数字锁相环状态 + + + + + + 530 + 120 + 50 + 30 + + + + + + + 700 + 120 + 50 + 30 + + + + + + + 600 + 120 + 100 + 30 + + + + + 微软雅黑 + 10 + + + + 选择参考源模式 + + + + + + 840 + 120 + 50 + 30 + + + + + + + 770 + 120 + 70 + 30 + + + + + 微软雅黑 + 10 + + + + 当前频率源 + + + + + + 910 + 120 + 100 + 30 + + + + + 微软雅黑 + 10 + + + + 相位调整累计值 + + + + + + 1010 + 120 + 50 + 30 + + + + + + + 1180 + 120 + 50 + 30 + + + + + + + + + + 1080 + 120 + 100 + 30 + + + + + 微软雅黑 + 10 + + + + 频率调整累计值 + + + + + + 20 + 170 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 频率参考状态 + + + + + + 100 + 170 + 300 + 30 + + + + + + + 420 + 170 + 70 + 30 + + + + + 微软雅黑 + 10 + + + + 参考源频差 + + + + + + 490 + 170 + 300 + 30 + + + + + + + 810 + 170 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 频率参考权值 + + + + + + 890 + 170 + 300 + 30 + + + + + + + 20 + 220 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 输入频率值 + + + + + + 100 + 220 + 300 + 30 + + + + + + + 510 + 220 + 300 + 30 + + + + + + + 420 + 220 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 10M输出状态 + + + + + + 910 + 220 + 300 + 30 + + + + + + + 830 + 220 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 5M输出状态 + + + + + + 690 + 310 + 100 + 30 + + + + + + + 690 + 360 + 100 + 30 + + + + + + + 610 + 360 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 相位微调 + + + + + + 1050 + 410 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 230 + 360 + 200 + 30 + + + + true + + + + + + 820 + 310 + 200 + 30 + + + + true + + + + + + 20 + 360 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 锁相模式设置 + + + + + + 820 + 360 + 200 + 30 + + + + true + + + + + + 610 + 410 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 频率微调 + + + + + + 460 + 310 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 820 + 410 + 200 + 30 + + + + true + + + + + + 230 + 310 + 200 + 30 + + + + true + + + + + + 1050 + 310 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 100 + 480 + 100 + 30 + + + + + + + 230 + 410 + 200 + 30 + + + + true + + + + + + 20 + 480 + 60 + 30 + + + + + 微软雅黑 + 10 + + + + 控制状态 + + + + + + 460 + 410 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 460 + 480 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 100 + 310 + 100 + 30 + + + + + + + 1050 + 360 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 20 + 410 + 60 + 30 + + + + + 微软雅黑 + 10 + + + + 参考权值 + + + + + + 690 + 410 + 100 + 30 + + + + + + + 460 + 360 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + send + + + + + + 100 + 410 + 100 + 30 + + + + + + + 610 + 310 + 60 + 30 + + + + + 微软雅黑 + 10 + + + + 频率源 + + + + + + 20 + 310 + 80 + 30 + + + + + 微软雅黑 + 10 + + + + 参考源选择 + + + + + + 230 + 480 + 200 + 30 + + + + true + + + + + + 100 + 360 + 100 + 30 + + +