From 03f392ae3f3e00344a4bcc16dceefc4827e174c4 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 26 Mar 2024 15:57:15 +0800 Subject: [PATCH] update --- libxsync | 2 +- mainwindow.cpp | 54 +++++++--- mainwindow.h | 15 ++- mainwindow.ui | 324 +++++++++++++++++++++++++++++++++++++++------------------ 4 files changed, 271 insertions(+), 124 deletions(-) diff --git a/libxsync b/libxsync index 8d56630..3eeca6b 160000 --- a/libxsync +++ b/libxsync @@ -1 +1 @@ -Subproject commit 8d566302ea775dfe97f7f86b136cfbbe2888041f +Subproject commit 3eeca6b41c8b0c85f4bdf1c682037a50f4ae6d3a diff --git a/mainwindow.cpp b/mainwindow.cpp index b5d4b36..efa2f27 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -475,10 +475,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi XsyncInit(XSyncUdpFactoryImpl::Ins()); xsync_config_t config = {0}; XsyncIns()->initialize(&config); - XsyncIns()->registerOnConnectStateChangeCallback([this](string targetIp, bool state) { + XsyncIns()->registerOnConnectStateChangeCallback([this](bool state, string targetIp) { ZLOGI(TAG, "targetIp:%s,state:%d", targetIp.c_str(), state); if (state) { - emit doinui_signal(QFunction([this, targetIp]() { ui->IpInput->setText(QString::fromStdString(targetIp)); })); + string sn; + XsyncIns()->readSn(sn); + emit doinui_signal(QFunction([this, targetIp, sn]() { + ui->IpInput->setText(QString::fromStdString(targetIp)); + ui->snDisplay->setText(QString::fromStdString(sn)); + })); } else { emit doinui_signal(QFunction([this, targetIp]() { ui->IpInput->setText(QString::fromStdString("disconnect")); })); } @@ -559,13 +564,6 @@ void MainWindow::mainWindowsRun() { // } \ } -void MainWindow::on_GenNewMac_clicked() { DO_XSYNC_FUNC(XsyncIns()->generatorNewMac()); } -void MainWindow::on_FactoryReset_clicked() { DO_XSYNC_FUNC(XsyncIns()->factoryReset()); } -void MainWindow::on_Reboot_clicked() { DO_XSYNC_FUNC(XsyncIns()->reboot()); } -void MainWindow::on_ChangeNetCfg_clicked() { // - // DO_XSYNC_FUNC(XsyncIns()->changeNetworkConfig(ui->ChangeNetCfg_ip->text().toStdString(), ui->ChangeNetCfg_mask->text().toStdString(), ui->ChangeNetCfg_gateway->text().toStdString())); -} - void MainWindow::on_TimecodePage_Read_clicked() { TimecodeFormat_t InternalTimecode_Format; XsyncTimecode_t InternalTimecode_Code; @@ -622,9 +620,6 @@ void MainWindow::on_tabWidget_currentChanged(int index) { on_RecordSigGen_Read_clicked(); } -void MainWindow::on_TTLInputModule_Index_currentIndexChanged(int index) {} -void MainWindow::on_TTLOutputMoudle_ID_currentIndexChanged(int index) {} - void MainWindow::on_TTLPage_Read_clicked() { { float freq1 = 0; @@ -904,3 +899,38 @@ void MainWindow::on_RecordSigGen_Write_clicked() { } void MainWindow::on_RecordSigGenerator_manualStart_clicked() { DO_XSYNC_FUNC(XsyncIns()->RecordSigGenerator_manualStart()); } void MainWindow::on_RecordSigGenerator_manualStop_clicked() { DO_XSYNC_FUNC(XsyncIns()->RecordSigGenerator_manualStop()); } + +void MainWindow::on_NetworkConfig_read_clicked() { + // DO_XSYNC_FUNC(XsyncIns()->changeNetworkConfig(ui->ChangeNetCfg_ip->text().toStdString(), ui->ChangeNetCfg_mask->text().toStdString(), ui->ChangeNetCfg_gateway->text().toStdString())); + + string ip; + string mask; + string gateway; + NetworkMode_t mode; + + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getIp(ip)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getMask(mask)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getGateway(gateway)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfig_getMode(mode)); + + ui->NetworkConfigStaticIpMode_Ip->setText(QString::fromStdString(ip)); + ui->NetworkConfigStaticIpMode_Mask->setText(QString::fromStdString(mask)); + ui->NetworkConfigStaticIpMode_Gateway->setText(QString::fromStdString(gateway)); + ui->NetworkConfig_Mode->setText(QString::fromStdString(QString::number(mode).toStdString())); +} +void MainWindow::on_NetworkConfig_storage_clicked() { + string ip = ui->NetworkConfigStaticIpMode_Ip->text().toStdString(); + string mask = ui->NetworkConfigStaticIpMode_Mask->text().toStdString(); + string gateway = ui->NetworkConfigStaticIpMode_Gateway->text().toStdString(); + NetworkMode_t mode = (NetworkMode_t)ui->NetworkConfig_Mode->text().toUInt(); + + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setIp(ip)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setMask(mask)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setGateway(gateway)); + DO_XSYNC_FUNC(XsyncIns()->NetworkConfig_setMode(mode)); + + DO_XSYNC_FUNC(XsyncIns()->storageConfig()); +} +void MainWindow::on_GenNewMac_clicked() { DO_XSYNC_FUNC(XsyncIns()->generatorNewMac()); } +void MainWindow::on_FactoryReset_clicked() { DO_XSYNC_FUNC(XsyncIns()->factoryReset()); } +void MainWindow::on_Reboot_clicked() { DO_XSYNC_FUNC(XsyncIns()->reboot()); } diff --git a/mainwindow.h b/mainwindow.h index 5e8b424..1662f26 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -88,11 +88,6 @@ class MainWindow : public QMainWindow { void on_ClearLogButton_clicked(); void on_Connect2XsyncButton_clicked(); - void on_GenNewMac_clicked(); - void on_FactoryReset_clicked(); - void on_Reboot_clicked(); - void on_ChangeNetCfg_clicked(); - void updateUI_timeCodeInfo_slot(QString); void updateUI_cameraSyncInfo_slot(QString); void updateUI_reg_slot(int32_t regadd, uint32_t regval); @@ -107,9 +102,6 @@ class MainWindow : public QMainWindow { void on_tabWidget_currentChanged(int index); - void on_TTLInputModule_Index_currentIndexChanged(int index); - - void on_TTLOutputMoudle_ID_currentIndexChanged(int index); void on_TTLPage_Read_clicked(); void on_TTLPage_Write_clicked(); @@ -120,12 +112,17 @@ class MainWindow : public QMainWindow { void on_SysClockPage_Read_clicked(); void on_SysClockPage_Wirte_clicked(); - void on_RecordSigGen_Read_clicked(); void on_RecordSigGen_Write_clicked(); void on_RecordSigGenerator_manualStart_clicked(); void on_RecordSigGenerator_manualStop_clicked(); + void on_NetworkConfig_read_clicked(); + void on_NetworkConfig_storage_clicked(); + void on_GenNewMac_clicked(); + void on_FactoryReset_clicked(); + void on_Reboot_clicked(); + signals: void append_log_signal(QString str); void updateUI_timeCodeInfo_signal(QString); diff --git a/mainwindow.ui b/mainwindow.ui index 43439b0..a683d34 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -72,6 +72,35 @@ + + + SN + + + + + + + + 150 + 16777215 + + + + + 75 + true + + + + + + + false + + + + Qt::Horizontal @@ -175,7 +204,7 @@ - 4 + 6 @@ -2480,13 +2509,13 @@ - IP配置 + 设备基础操作 - 20 - 20 + 600 + 30 101 31 @@ -2495,110 +2524,201 @@ GenNewMac - + 20 - 60 - 101 - 31 - - - - FactoryReset - - - - - - 20 - 100 - 101 - 31 - - - - Reboot - - - - - - 20 - 140 - 101 - 31 - - - - ChangeNetCfg - - - - - - 130 - 140 - 111 - 31 - - - - - 75 - true - - - - 192.168.8.10 - - - false - - - - - - 250 - 140 - 111 - 31 - - - - - 75 - true - - - - 255.255.255.0 - - - false - - - - - - 370 - 140 - 111 - 31 + 20 + 441 + 311 - - - 75 - true - - - - 192.168.8.1 - - - false + + 配置 + + + + + + 0 + 25 + + + + 保存配置 + + + + + + + + 0 + 25 + + + + + 75 + true + + + + + + + false + + + + + + + + 0 + 25 + + + + 恢复出厂设置 + + + + + + + 静态IP-网关 + + + + + + + + 0 + 25 + + + + 读取配置 + + + + + + + + 0 + 25 + + + + + 75 + true + + + + + + + false + + + + + + + + 0 + 25 + + + + 重启设备 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 静态IP-子网掩码 + + + + + + + 静态IP-IP + + + + + + + + 0 + 25 + + + + + 75 + true + + + + + + + false + + + + + + + 网络配置模式(0:static,1:dhcp) + + + + + + + + 0 + 25 + + + + + 75 + true + + + + + + + false + + + +