添加继电器设置
This commit is contained in:
parent
964affc137
commit
26d44b1edf
@ -16,6 +16,7 @@ SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
radial_vibration.cpp \
|
||||
relaysetting.cpp \
|
||||
seismic_monitor.cpp \
|
||||
setpoint.cpp \
|
||||
singlerelay.cpp \
|
||||
@ -30,6 +31,7 @@ HEADERS += \
|
||||
keyphase.h \
|
||||
mainwindow.h \
|
||||
radial_vibration.h \
|
||||
relaysetting.h \
|
||||
seismic_monitor.h \
|
||||
setpoint.h \
|
||||
singlerelay.h \
|
||||
@ -41,6 +43,7 @@ FORMS += \
|
||||
keyphase.ui \
|
||||
mainwindow.ui \
|
||||
radial_vibration.ui \
|
||||
relaysetting.ui \
|
||||
seismic_monitor.ui \
|
||||
setpoint.ui \
|
||||
singlerelay.ui \
|
||||
|
@ -7,6 +7,8 @@
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
extern QString g_strServerIp; // 服务端IP
|
||||
|
||||
#define CHANNLE_COUNT 4
|
||||
typedef struct {
|
||||
int slot;
|
||||
@ -20,7 +22,8 @@ enum CMTCommand {
|
||||
kEigenvalueCmd = 1,
|
||||
kExceptionInfo = 2,
|
||||
kUpgradeCard = 3,
|
||||
kGetVersionInfo = 4
|
||||
kGetVersionInfo = 4,
|
||||
kRelaySetting = 5
|
||||
};
|
||||
enum SlotType{
|
||||
POWER = 10,
|
||||
@ -107,6 +110,17 @@ typedef struct {
|
||||
uint8_t sw; // 软件版本号
|
||||
char fpga_data[9]; // fpga版本日期
|
||||
} VersionRsp;
|
||||
|
||||
typedef struct {
|
||||
uint8_t card_id; // 0xff是本机,其它子卡是1~15
|
||||
uint8_t led_id; // ok 灯 0xff,rx/tx 灯 0xf1,其他 1 ~ 16
|
||||
uint8_t led_operate; // 0 OFF,1 ON,2 红色,3 绿色,4 红色1Hz闪烁,5 红色2Hz闪烁,6 绿色闪烁
|
||||
} RelaySettingReq;
|
||||
|
||||
typedef struct {
|
||||
uint8_t code;
|
||||
} RelaySettingRsp;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif // DATA_CONFIG_H
|
||||
|
@ -16,12 +16,20 @@
|
||||
#include <stdio.h>
|
||||
#include <QSysInfo>
|
||||
#include <qsettings.h>
|
||||
#include "relaysetting.h"
|
||||
|
||||
QString g_strServerIp;
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QMenuBar* menuBar = this->menuBar();
|
||||
this->setMenuBar(menuBar); //添加到对象树
|
||||
menuBar->addMenu(ui->menu_tool);
|
||||
//添加信号槽
|
||||
QObject::connect(ui->action_realy, &QAction::triggered, this, &MainWindow::onMenuAction_relay);
|
||||
slot = -1;
|
||||
btnGroup_slot = new QButtonGroup(this);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot3);
|
||||
@ -48,7 +56,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(btnGroup_slot, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(OnButtonGroup(QAbstractButton *)));
|
||||
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
|
||||
|
||||
m_strServerIp = settingsread.value("Server/IP").toString();
|
||||
g_strServerIp = settingsread.value("Server/IP").toString();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -418,6 +426,13 @@ void MainWindow::on_pushButton_point_name_clicked()
|
||||
ui->pushButton_alarm->setChecked(false);
|
||||
}
|
||||
|
||||
void MainWindow::onMenuAction_relay()
|
||||
{
|
||||
qDebug() << " onMenuAction_relay " << endl;
|
||||
RelaySetting *relay_setting = new RelaySetting();
|
||||
relay_setting->setWindowModality(Qt::ApplicationModal);
|
||||
relay_setting->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_save_clicked()
|
||||
{
|
||||
@ -475,7 +490,7 @@ void MainWindow::sendUpgradePackage(int slot)
|
||||
QTcpSocket socket;
|
||||
|
||||
// 连接到服务器
|
||||
socket.connectToHost(m_strServerIp, 10000);
|
||||
socket.connectToHost(g_strServerIp, 10000);
|
||||
if (!socket.waitForConnected()) {
|
||||
qDebug() << "Connection failed!";
|
||||
return;
|
||||
@ -567,7 +582,7 @@ void MainWindow::getVersion(int slot)
|
||||
// 连接到服务器
|
||||
QTcpSocket socket;
|
||||
// 连接到服务器
|
||||
socket.connectToHost(m_strServerIp, 10000);
|
||||
socket.connectToHost(g_strServerIp, 10000);
|
||||
if (!socket.waitForConnected()) {
|
||||
qDebug() << "Connection failed!";
|
||||
return;
|
||||
|
@ -11,6 +11,8 @@ QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -33,7 +35,7 @@ private:
|
||||
QMap<int,SlotConfig> map_slot_config;
|
||||
|
||||
QButtonGroup * btnGroup_slot = nullptr;
|
||||
QString m_strServerIp; // 服务端IP
|
||||
|
||||
int slot;
|
||||
|
||||
void createMenu();
|
||||
@ -46,7 +48,7 @@ private:
|
||||
void getVersion(int slot);
|
||||
|
||||
private slots:
|
||||
|
||||
void onMenuAction_relay();
|
||||
void OnButtonGroup(QAbstractButton *);
|
||||
|
||||
void onMenuActionTriggered();
|
||||
|
@ -1121,8 +1121,16 @@
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_tool">
|
||||
<property name="title">
|
||||
<string>工具</string>
|
||||
</property>
|
||||
<addaction name="action_realy"/>
|
||||
<addaction name="action_time"/>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_tool"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionNEW">
|
||||
@ -1135,6 +1143,16 @@
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_realy">
|
||||
<property name="text">
|
||||
<string>继电器配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_time">
|
||||
<property name="text">
|
||||
<string>校时功能</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user