diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FreqSwitcher.cpp b/DevStatusAcq/device/FreqSwitcher.cpp
index 23311ee..57b440d 100644
--- a/DevStatusAcq/device/FreqSwitcher.cpp
+++ b/DevStatusAcq/device/FreqSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,8 +72,8 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FreqSwitcher.cpp b/DevStatusAcq/device/FreqSwitcher.cpp
index 23311ee..57b440d 100644
--- a/DevStatusAcq/device/FreqSwitcher.cpp
+++ b/DevStatusAcq/device/FreqSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,8 +72,8 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FrequencyTuning.cpp b/DevStatusAcq/device/FrequencyTuning.cpp
index 3812fd8..8e36d3a 100644
--- a/DevStatusAcq/device/FrequencyTuning.cpp
+++ b/DevStatusAcq/device/FrequencyTuning.cpp
@@ -7,9 +7,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FrequencyTuning::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -89,7 +89,7 @@
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
jsonObj.insert("deviceId", deviceId);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
// 4. 在界面上简单显示相差数据结果
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FreqSwitcher.cpp b/DevStatusAcq/device/FreqSwitcher.cpp
index 23311ee..57b440d 100644
--- a/DevStatusAcq/device/FreqSwitcher.cpp
+++ b/DevStatusAcq/device/FreqSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,8 +72,8 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FrequencyTuning.cpp b/DevStatusAcq/device/FrequencyTuning.cpp
index 3812fd8..8e36d3a 100644
--- a/DevStatusAcq/device/FrequencyTuning.cpp
+++ b/DevStatusAcq/device/FrequencyTuning.cpp
@@ -7,9 +7,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FrequencyTuning::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -89,7 +89,7 @@
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
jsonObj.insert("deviceId", deviceId);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
// 4. 在界面上简单显示相差数据结果
diff --git a/DevStatusAcq/device/SignalGenerator.cpp b/DevStatusAcq/device/SignalGenerator.cpp
index aa76efb..577db52 100644
--- a/DevStatusAcq/device/SignalGenerator.cpp
+++ b/DevStatusAcq/device/SignalGenerator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &SignalGenerator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -73,7 +73,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FreqSwitcher.cpp b/DevStatusAcq/device/FreqSwitcher.cpp
index 23311ee..57b440d 100644
--- a/DevStatusAcq/device/FreqSwitcher.cpp
+++ b/DevStatusAcq/device/FreqSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,8 +72,8 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FrequencyTuning.cpp b/DevStatusAcq/device/FrequencyTuning.cpp
index 3812fd8..8e36d3a 100644
--- a/DevStatusAcq/device/FrequencyTuning.cpp
+++ b/DevStatusAcq/device/FrequencyTuning.cpp
@@ -7,9 +7,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FrequencyTuning::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -89,7 +89,7 @@
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
jsonObj.insert("deviceId", deviceId);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
// 4. 在界面上简单显示相差数据结果
diff --git a/DevStatusAcq/device/SignalGenerator.cpp b/DevStatusAcq/device/SignalGenerator.cpp
index aa76efb..577db52 100644
--- a/DevStatusAcq/device/SignalGenerator.cpp
+++ b/DevStatusAcq/device/SignalGenerator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &SignalGenerator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -73,7 +73,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/TimeReplicator.cpp b/DevStatusAcq/device/TimeReplicator.cpp
index b15e2b7..1ba0db4 100644
--- a/DevStatusAcq/device/TimeReplicator.cpp
+++ b/DevStatusAcq/device/TimeReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &TimeReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+
690
@@ -2189,7 +2189,7 @@
时间显示
-
+
690
diff --git a/DevStatusAcq/common/common.pri b/DevStatusAcq/common/common.pri
index 84f57ae..6280f64 100644
--- a/DevStatusAcq/common/common.pri
+++ b/DevStatusAcq/common/common.pri
@@ -3,7 +3,7 @@
SOURCES += $$PWD/utils/QByteUtil.cpp
SOURCES += $$PWD/utils/QSerialPortUtil.cpp
SOURCES += $$PWD/utils/QLogUtil.cpp
-#SOURCES += $$PWD/utils/QKafkaUtil.cpp
+SOURCES += $$PWD/utils/QKafkaUtil.cpp
SOURCES += $$PWD/utils/HttpRequestUtil.cpp
SOURCES += $$PWD/utils/MD5.cpp
SOURCES += $$PWD/HttpRequestController.cpp
@@ -12,7 +12,7 @@
HEADERS += $$PWD/utils/QByteUtil.h
HEADERS += $$PWD/utils/QSerialPortUtil.h
HEADERS += $$PWD/utils/QLogUtil.h
-#HEADERS += $$PWD/utils/QKafkaUtil.h
+HEADERS += $$PWD/utils/QKafkaUtil.h
HEADERS += $$PWD/utils/HttpRequestUtil.h
HEADERS += $$PWD/utils/DefHead.h
HEADERS += $$PWD/utils/MD5.h
diff --git a/DevStatusAcq/conf/config.ini b/DevStatusAcq/conf/config.ini
index 0b568d6..c37ba1c 100644
--- a/DevStatusAcq/conf/config.ini
+++ b/DevStatusAcq/conf/config.ini
@@ -2,16 +2,16 @@
baudRate=115200
[kafka]
-needKafka=0
+needKafka=1
brokers="111.198.10.15:12502"
dataTopic="cppTest"
[client]
-clientId="phase"
+clientId="dev-status"
appKey="bd593bdd20943d2db8af217c3712a460"
[http]
baseUrl="http://111.198.10.15:11410"
[log]
-basePath="D:/Workspace Qt/ZXSSCJ-Release/DevStatus/logs/"
+basePath="/home/admin/Qt/ZXSSCJ-Release/DevStatus/logs/"
diff --git a/DevStatusAcq/device/BCodeTerminal.cpp b/DevStatusAcq/device/BCodeTerminal.cpp
index a299297..19d33fd 100644
--- a/DevStatusAcq/device/BCodeTerminal.cpp
+++ b/DevStatusAcq/device/BCodeTerminal.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &BCodeTerminal::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/DeviceBase.h b/DevStatusAcq/device/DeviceBase.h
index cba1ace..8cd10d6 100644
--- a/DevStatusAcq/device/DeviceBase.h
+++ b/DevStatusAcq/device/DeviceBase.h
@@ -3,7 +3,7 @@
#include
#include "common/utils/QSerialPortUtil.h"
-//#include "common/utils/QKafkaUtil.h"
+#include "common/utils/QKafkaUtil.h"
#include "common/utils/QByteUtil.h"
#include "common/utils/QLogUtil.h"
#include "common/utils/SettingConfig.h"
@@ -37,7 +37,7 @@
int baudRate;
QSerialPortUtil serialUtil;
-// QKafkaUtil kafkaUtil;
+ QKafkaUtil kafkaUtil;
QByteArray dataBuff;
};
diff --git a/DevStatusAcq/device/FreqReplicator.cpp b/DevStatusAcq/device/FreqReplicator.cpp
index 6acfbb8..b4046fe 100644
--- a/DevStatusAcq/device/FreqReplicator.cpp
+++ b/DevStatusAcq/device/FreqReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FreqSwitcher.cpp b/DevStatusAcq/device/FreqSwitcher.cpp
index 23311ee..57b440d 100644
--- a/DevStatusAcq/device/FreqSwitcher.cpp
+++ b/DevStatusAcq/device/FreqSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FreqSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,8 +72,8 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/FrequencyTuning.cpp b/DevStatusAcq/device/FrequencyTuning.cpp
index 3812fd8..8e36d3a 100644
--- a/DevStatusAcq/device/FrequencyTuning.cpp
+++ b/DevStatusAcq/device/FrequencyTuning.cpp
@@ -7,9 +7,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &FrequencyTuning::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -89,7 +89,7 @@
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
jsonObj.insert("deviceId", deviceId);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
// 4. 在界面上简单显示相差数据结果
diff --git a/DevStatusAcq/device/SignalGenerator.cpp b/DevStatusAcq/device/SignalGenerator.cpp
index aa76efb..577db52 100644
--- a/DevStatusAcq/device/SignalGenerator.cpp
+++ b/DevStatusAcq/device/SignalGenerator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &SignalGenerator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -73,7 +73,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/TimeReplicator.cpp b/DevStatusAcq/device/TimeReplicator.cpp
index b15e2b7..1ba0db4 100644
--- a/DevStatusAcq/device/TimeReplicator.cpp
+++ b/DevStatusAcq/device/TimeReplicator.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &TimeReplicator::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/device/TimeSwitcher.cpp b/DevStatusAcq/device/TimeSwitcher.cpp
index 0cf4bc7..ecf4d5a 100644
--- a/DevStatusAcq/device/TimeSwitcher.cpp
+++ b/DevStatusAcq/device/TimeSwitcher.cpp
@@ -8,9 +8,9 @@
connect(&this->serialUtil, &QSerialPortUtil::dataRecieved,
this, &TimeSwitcher::dataReceivedHandler);
-// kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
-// kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
-// kafkaUtil.createProducer();
+ kafkaUtil.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS);
+ kafkaUtil.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC);
+ kafkaUtil.createProducer();
this->protocol = DeviceStatusProtocolBase::deviceStatusProtocolFactory(typeid (this).name());
}
@@ -72,7 +72,7 @@
{
QJsonObject jsonObj = frameDto->toJSON();
jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID);
- jsonObj.insert("deviceId", devCode);
-// kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
+ jsonObj.insert("deviceId", deviceId);
+ kafkaUtil.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)));
}
}
diff --git a/DevStatusAcq/DevStatusAcq.pro b/DevStatusAcq/DevStatusAcq.pro
index ee80867..f74d7b0 100644
--- a/DevStatusAcq/DevStatusAcq.pro
+++ b/DevStatusAcq/DevStatusAcq.pro
@@ -34,9 +34,9 @@
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-#INCLUDEPATH += $$PWD/include/librdkafka
-#DEPENDPATH += $$PWD/include/librdkafka
+INCLUDEPATH += $$PWD/include/librdkafka
+DEPENDPATH += $$PWD/include/librdkafka
-#unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
+unix:!macx: LIBS += -L$$PWD/lib/librdkafka/ -lrdkafka -lrdkafka++
DISTFILES += conf/config.ini
diff --git a/DevStatusAcq/DevStatusWindow.cpp b/DevStatusAcq/DevStatusWindow.cpp
index 43b1c8b..5e11c14 100644
--- a/DevStatusAcq/DevStatusWindow.cpp
+++ b/DevStatusAcq/DevStatusWindow.cpp
@@ -135,8 +135,13 @@
void DevStatusWindow::on_sigGenButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
sigGenDevice->setComName("SignalGenerator");
- sigGenDevice->setDevCode("300001");
+ sigGenDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ sigGenDevice->setDevCode(devItem.find("deviceNo")->toString());
+ sigGenDevice->setDeviceId(devItem.find("deviceId")->toString());
sigGenDevice->initSerialPort();
}
@@ -147,49 +152,74 @@
QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
freqTunDevice->setComName("FrequencyTuning");
- freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqTunDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
freqTunDevice->setDevCode(devItem.find("deviceNo")->toString());
- freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
+ freqTunDevice->setDeviceId(devItem.find("deviceId")->toString());
freqTunDevice->initSerialPort();
}
void DevStatusWindow::on_tmSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeSwitDevice->setComName("TimeSwitcher");
- timeSwitDevice->setDevCode("500001");
+ timeSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
timeSwitDevice->initSerialPort();
}
void DevStatusWindow::on_freqSwiButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqSwitDevice->setComName("FreqSwitcher");
- freqSwitDevice->setDevCode("600001");
+ freqSwitDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqSwitDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqSwitDevice->setDeviceId(devItem.find("deviceId")->toString());
freqSwitDevice->initSerialPort();
}
void DevStatusWindow::on_tmRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
timeRepDevice->setComName("TimeReplicator");
- timeRepDevice->setDevCode("090001");
+ timeRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ timeRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ timeRepDevice->setDeviceId(devItem.find("deviceId")->toString());
timeRepDevice->initSerialPort();
}
void DevStatusWindow::on_freqRepButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
freqRepDevice->setComName("FreqReplicator");
- freqRepDevice->setDevCode("100001");
+ freqRepDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ freqRepDevice->setDevCode(devItem.find("deviceNo")->toString());
+ freqRepDevice->setDeviceId(devItem.find("deviceId")->toString());
freqRepDevice->initSerialPort();
}
void DevStatusWindow::on_bctButt_clicked()
{
+ // 获取设备对象
+ QJsonObject devItem = ui->devSelect->currentData().toJsonObject();
+
bCodeTermDevice->setComName("BCodeTerminal");
- bCodeTermDevice->setDevCode("07001");
+ bCodeTermDevice->setBaudRate(devItem.find("baudRate")->toString().toInt());
+ bCodeTermDevice->setDevCode(devItem.find("deviceNo")->toString());
+ bCodeTermDevice->setDeviceId(devItem.find("deviceId")->toString());
bCodeTermDevice->initSerialPort();
}
@@ -220,7 +250,7 @@
QMessageBox::information(this, "数据错误", "调整范围-2E-7 ~ 2E-7,(单位:1E-19)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateFreqTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,20", ui->ftSetFreqTurn->text());
ui->ftSetFreqTurnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -235,7 +265,7 @@
QMessageBox::information(this, "数据错误", "调整范围-1us~+1us,(单位:0.1fs)");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseTunSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLF,21", ui->ftSetPhaseTunn->text());
ui->ftSetPhaseTunnRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -250,7 +280,7 @@
QMessageBox::information(this, "数据错误", "取值范围-500ms - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generatePhaseShiftSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,01", ui->ftSetPhaseShift->text());
ui->ftSetPhaseShiftRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -265,7 +295,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,02", ui->ftSetSynch->text());
ui->ftSetSynchRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -280,7 +310,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((FrequencyTuningProtocolBM) freqTunDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = freqTunDevice->protocol->generateSettingCommand("GLP,03", ui->ftSetPulseWidth->text());
ui->ftSetPulseWidthRaw->setText(setBytes);
freqTunDevice->sendDataToSerial(setBytes);
}
@@ -290,12 +320,12 @@
{
sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
qint8 value = ui->sgLeapSecondSet->text().toInt();
- if (value != 1 || value != 2 || value != 3)
+ if (value != 1 && value != 2 && value != 3)
{
QMessageBox::information(this, "数据错误", "取值范围0 / 1 / 2");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateLeapSecondSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,01", ui->sgLeapSecondSet->text());
ui->sgLeapSecondSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -310,7 +340,7 @@
QMessageBox::information(this, "数据错误", "1:有效;其他无效");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSingleSynchSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,02", ui->sgSingleSynchSet->text());
ui->sgSingleSynchSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -325,7 +355,7 @@
QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateDateSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,03", ui->sgDateSet->text());
ui->sgDateSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -340,7 +370,7 @@
QMessageBox::information(this, "数据错误", "取值范围10us - 500ms");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,04", ui->sgSecondWidthSet->text());
ui->sgSecondWidthSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
@@ -355,8 +385,113 @@
QMessageBox::information(this, "数据错误", "取值范围2 - 6");
} else
{
- QByteArray setBytes = ((SignalGeneratorProtocolBM) sigGenDevice->protocol).generateSecondWidthSetCommand(value);
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,05", ui->sgBacRatioSet->text());
ui->sgBacRatioSetRaw->setText(setBytes);
sigGenDevice->sendDataToSerial(setBytes);
}
}
+
+void DevStatusWindow::on_sgBacRangeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ float value = ui->sgBacRangeSet->text().toFloat();
+ if (value < 5 || value > 100)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围5 - 100");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,06", ui->sgBacRangeSet->text());
+ ui->sgBacRangeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgOppsPhaseShiftSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ qlonglong value = ui->sgOppsPhaseShiftSet->text().toLongLong();
+ if (value < -1E12 || value > 1E12)
+ {
+ QMessageBox::information(this, "数据错误", "取值范围-1s - 1s");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,07", ui->sgOppsPhaseShiftSet->text());
+ ui->sgOppsPhaseShiftSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgLeapTimestampSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgLeapTimestampSet->text();
+ if (value.length() != 8)
+ {
+ QMessageBox::information(this, "数据错误", "年月日格式:YYYYMMDD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,08", ui->sgLeapTimestampSet->text());
+ ui->sgLeapTimestampSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgMJDDateSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgMJDDateSet->text();
+ if (value.length() != 5)
+ {
+ QMessageBox::information(this, "数据错误", "MJD");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,09", ui->sgMJDDateSet->text());
+ ui->sgMJDDateSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeSet->text();
+ if (value.length() != 6)
+ {
+ QMessageBox::information(this, "数据错误", "hhmmss");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLF,10", ui->sgTimeSet->text());
+ ui->sgTimeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgKeyControlSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgKeyControlSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,01", ui->sgKeyControlSet->text());
+ ui->sgKeyControlSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
+
+void DevStatusWindow::on_sgTimeTypeSetButt_clicked()
+{
+ sigGenDevice->setDevCode(ui->devSelect->currentData().toJsonObject().find("deviceNo")->toString());
+ QString value = ui->sgTimeTypeSet->text();
+ if (value != "0" && value != "1")
+ {
+ QMessageBox::information(this, "数据错误", "0 / 1");
+ } else
+ {
+ QByteArray setBytes = sigGenDevice->protocol->generateSettingCommand("GLC,02", ui->sgTimeTypeSet->text());
+ ui->sgTimeTypeSetRaw->setText(setBytes);
+ sigGenDevice->sendDataToSerial(setBytes);
+ }
+}
diff --git a/DevStatusAcq/DevStatusWindow.h b/DevStatusAcq/DevStatusWindow.h
index f3e7068..d27b5c6 100644
--- a/DevStatusAcq/DevStatusWindow.h
+++ b/DevStatusAcq/DevStatusWindow.h
@@ -64,6 +64,20 @@
void on_sgBacRatioSetButt_clicked();
+ void on_sgBacRangeSetButt_clicked();
+
+ void on_sgOppsPhaseShiftSetButt_clicked();
+
+ void on_sgLeapTimestampSetButt_clicked();
+
+ void on_sgMJDDateSetButt_clicked();
+
+ void on_sgTimeSetButt_clicked();
+
+ void on_sgKeyControlSetButt_clicked();
+
+ void on_sgTimeTypeSetButt_clicked();
+
private:
int initHttpToken();
int initDictDeviceTypes();
diff --git a/DevStatusAcq/DevStatusWindow.ui b/DevStatusAcq/DevStatusWindow.ui
index 07a560c..e40b997 100644
--- a/DevStatusAcq/DevStatusWindow.ui
+++ b/DevStatusAcq/DevStatusWindow.ui
@@ -1791,7 +1791,7 @@
控制状态
-
+
100
@@ -1801,7 +1801,7 @@
-
+
230
@@ -1814,7 +1814,7 @@
true
-
+
460
@@ -1871,7 +1871,7 @@
1PPS移相
-
+
1050
@@ -1890,7 +1890,7 @@
send
-
+
690
@@ -1900,7 +1900,7 @@
-
+
820
@@ -1913,7 +1913,7 @@
true
-
+
690
@@ -1923,7 +1923,7 @@
-
+
1050
@@ -1942,7 +1942,7 @@
send
-
+
1050
@@ -1961,7 +1961,7 @@
send
-
+
690
@@ -1971,7 +1971,7 @@
-
+
820
@@ -1984,7 +1984,7 @@
true
-
+
690
@@ -1994,7 +1994,7 @@
-
+
820
@@ -2007,7 +2007,7 @@
true
-
+
820
@@ -2020,7 +2020,7 @@
true
-
+
1050
@@ -2039,7 +2039,7 @@
send
-
+
820
@@ -2071,7 +2071,7 @@
儒略日设置
-
+
1050
@@ -2090,7 +2090,7 @@
send
-
+
820
@@ -2103,7 +2103,7 @@
true
-
+
1050
@@ -2141,7 +2141,7 @@
AC码幅度
-
+