add copy channel
This commit is contained in:
parent
95156105a3
commit
226f3acc24
@ -17,6 +17,7 @@ SOURCES += \
|
||||
common.cpp \
|
||||
config_mgr.cpp \
|
||||
connect.cpp \
|
||||
copy_channel.cpp \
|
||||
dc_output_channel.cpp \
|
||||
dc_outputs.cpp \
|
||||
ethconfig.cpp \
|
||||
@ -53,6 +54,7 @@ HEADERS += \
|
||||
common.h \
|
||||
config_mgr.h \
|
||||
connect.h \
|
||||
copy_channel.h \
|
||||
data_config.h \
|
||||
dc_output_channel.h \
|
||||
dc_outputs.h \
|
||||
@ -87,6 +89,7 @@ FORMS += \
|
||||
channel_1_2.ui \
|
||||
channel_3_4.ui \
|
||||
connect.ui \
|
||||
copy_channel.ui \
|
||||
dc_output_channel.ui \
|
||||
dc_outputs.ui \
|
||||
ethconfig.ui \
|
||||
|
||||
63
copy_channel.cpp
Normal file
63
copy_channel.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include "copy_channel.h"
|
||||
#include "ui_copy_channel.h"
|
||||
|
||||
CopyChannel::CopyChannel(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CopyChannel)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CopyChannel::~CopyChannel()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CopyChannel::on_radioButton_ch1_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch1->setChecked(false);
|
||||
ui->checkBox_ch1->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch3->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch2_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch2->setChecked(false);
|
||||
ui->checkBox_ch2->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch1->setEnabled(true);
|
||||
ui->checkBox_ch3->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch3_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch3->setChecked(false);
|
||||
ui->checkBox_ch3->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch1->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch4_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch4->setChecked(false);
|
||||
ui->checkBox_ch4->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch3->setEnabled(true);
|
||||
ui->checkBox_ch1->setEnabled(true);
|
||||
}
|
||||
|
||||
31
copy_channel.h
Normal file
31
copy_channel.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef COPY_CHANNEL_H
|
||||
#define COPY_CHANNEL_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class CopyChannel;
|
||||
}
|
||||
|
||||
class CopyChannel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CopyChannel(QWidget *parent = nullptr);
|
||||
~CopyChannel();
|
||||
|
||||
private slots:
|
||||
void on_radioButton_ch1_clicked(bool checked);
|
||||
|
||||
void on_radioButton_ch2_clicked(bool checked);
|
||||
|
||||
void on_radioButton_ch3_clicked(bool checked);
|
||||
|
||||
void on_radioButton_ch4_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::CopyChannel *ui;
|
||||
};
|
||||
|
||||
#endif // COPY_CHANNEL_H
|
||||
244
copy_channel.ui
Normal file
244
copy_channel.ui
Normal file
@ -0,0 +1,244 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CopyChannel</class>
|
||||
<widget class="QWidget" name="CopyChannel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>673</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>复制通道</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>复制通道配置</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>选择被复制的通道</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="radioButton_ch1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>选择需要复制的通道</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="checkBox_ch1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
@ -220,6 +220,7 @@ enum CMTCommand {
|
||||
kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态
|
||||
kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息
|
||||
kConfigDeviceID = 32, // 配置设备编号,编号范围为1~99
|
||||
kGetVoltageRangeValue = 33 // 获取子板动态电压范围
|
||||
};
|
||||
enum RS485Baudrate {
|
||||
kBaudrate2400 = 0,
|
||||
@ -739,6 +740,20 @@ typedef struct {
|
||||
char data[0]; // 请保存为.tar.gz文件
|
||||
} GetSubCardLogRsp;
|
||||
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
uint8_t cmd;
|
||||
uint8_t version; // 版本号,默认为1
|
||||
uint8_t card_id;
|
||||
} GetSubCardVoltageRangeReq;
|
||||
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
uint8_t cmd;
|
||||
uint8_t version; // 版本号,默认为1
|
||||
uint8_t voltage; // 单位为v
|
||||
} GetSubCardVoltageRangeRsp;
|
||||
|
||||
// cmd: kTimingCmd = 26
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
|
||||
@ -209,6 +209,8 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
|
||||
QAction *version = mainMenu->addAction("查看版本");
|
||||
QAction *config_sub_card = mainMenu->addAction("更新配置");
|
||||
QAction *get_sub_log = mainMenu->addAction("获取日志");
|
||||
QAction *get_sub_card_voltage = mainMenu->addAction("获取电压范围");
|
||||
|
||||
// 绑定 **鼠标事件过滤器**,确保只响应右键
|
||||
// 设置右键菜单策略
|
||||
parent->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
@ -233,6 +235,8 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
|
||||
QObject::connect(version, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
QObject::connect(config_sub_card, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
QObject::connect(get_sub_log, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
QObject::connect(get_sub_card_voltage, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::createMenuSet(const QString &rootTitle, QPushButton *parent) {
|
||||
@ -395,6 +399,8 @@ void MainWindow::onMenuActionTriggered() {
|
||||
ConfigSubCard(button_id);
|
||||
}else if (action->text() == "获取日志") {
|
||||
GetSubLog(button_id);
|
||||
}else if (action->text() == "获取电压范围") {
|
||||
GetVoltageRangeValue(button_id);
|
||||
}
|
||||
break; // 找到按钮后,跳出循环
|
||||
}
|
||||
@ -787,6 +793,24 @@ void MainWindow::GetSubLog(int slot){
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
}
|
||||
void MainWindow::GetVoltageRangeValue(int slot){
|
||||
slot_no = slot;
|
||||
qDebug() << "slot" << slot ;
|
||||
GetSubCardVoltageRangeReq get_sub_card_log_req = { {0xAA, 0x55, 0xAA}, kGetVoltageRangeValue, 1, 0 };
|
||||
SlotConfig slot_config = map_slot_config[slot];
|
||||
if (slot == 0 || slot_config.slot_type == "DOM810") {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("请选择正确的板卡!"));
|
||||
return;
|
||||
}
|
||||
get_sub_card_log_req.card_id = slot & 0xFF;
|
||||
|
||||
char send_buf[20] = {0};
|
||||
memcpy(send_buf, (char *)&get_sub_card_log_req, sizeof(GetSubCardVoltageRangeReq));
|
||||
int length = sizeof(GetSubCardVoltageRangeReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData(send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
}
|
||||
void MainWindow::readData(const QByteArray &data) {
|
||||
qDebug() << "Received from server:" << data;
|
||||
|
||||
|
||||
@ -62,6 +62,8 @@ private:
|
||||
void initStyle();
|
||||
void connectServer();
|
||||
void UploadConfigFile(uint8_t sub_cmd);
|
||||
void GetVoltageRangeValue(int slot);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@ -394,7 +394,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
@ -369,7 +369,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_4">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
@ -1156,7 +1156,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_3">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_10">
|
||||
<attribute name="title">
|
||||
@ -1181,12 +1181,12 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>是</string>
|
||||
<string>否</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>否</string>
|
||||
<string>是</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "pressure_pulsation.h"
|
||||
#include "channel_1_2.h"
|
||||
#include "channel_3_4.h"
|
||||
#include "copy_channel.h"
|
||||
|
||||
Seismic_monitor::Seismic_monitor(int slot,int cardtype, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -520,3 +521,11 @@ void Seismic_monitor::on_pushButton_config_3_4_clicked()
|
||||
ch3_4->show();
|
||||
}
|
||||
|
||||
|
||||
void Seismic_monitor::on_pushButton_copy_channel_clicked()
|
||||
{
|
||||
CopyChannel *copy_channel = new CopyChannel();
|
||||
copy_channel->setWindowModality(Qt::ApplicationModal);
|
||||
copy_channel->show();
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@ class Seismic_monitor : public QWidget {
|
||||
|
||||
void on_pushButton_config_3_4_clicked();
|
||||
|
||||
void on_pushButton_copy_channel_clicked();
|
||||
|
||||
private:
|
||||
Ui::Seismic_monitor *ui;
|
||||
void UpdateData(std::shared_ptr<VibrationData> vib_data);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>928</width>
|
||||
<height>610</height>
|
||||
<height>623</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -1057,7 +1057,7 @@
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>232</width>
|
||||
<width>238</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2257,7 +2257,7 @@
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>232</width>
|
||||
<width>238</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2547,6 +2547,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_copy_channel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>复制通道</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
|
||||
2
trust.ui
2
trust.ui
@ -369,7 +369,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_3">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
|
||||
@ -375,7 +375,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_3">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user