parent
c3cd21f50a
commit
7080483fb8
|
|
@ -1,12 +1,14 @@
|
||||||
[base]
|
[base]
|
||||||
|
track_name=2
|
||||||
|
up_result=true
|
||||||
|
use_socket_server=false
|
||||||
|
run_model=0
|
||||||
|
|
||||||
|
[serial]
|
||||||
com_name=COM2
|
com_name=COM2
|
||||||
baud=19200
|
baud=19200
|
||||||
track_name=2
|
|
||||||
have_magnet_steel=true
|
have_magnet_steel=true
|
||||||
magnet_steel_order=8421
|
magnet_steel_order=8421
|
||||||
up_result=true
|
|
||||||
use_socket_server=true
|
|
||||||
use_device_warn=true
|
|
||||||
|
|
||||||
[interface]
|
[interface]
|
||||||
http_ip=192.168.2.212
|
http_ip=192.168.2.212
|
||||||
|
|
@ -24,3 +26,6 @@ delayed_upload=4
|
||||||
|
|
||||||
[device_warn]
|
[device_warn]
|
||||||
min_train_size=10
|
min_train_size=10
|
||||||
|
|
||||||
|
[relay]
|
||||||
|
listener_port=7070
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.26)
|
||||||
set(PROJECT_NAME Train_RFID)
|
set(PROJECT_NAME Train_RFID)
|
||||||
project(${PROJECT_NAME} VERSION 1.0 DESCRIPTION "火车车号识别 RFID版")
|
project(${PROJECT_NAME} VERSION 1.0 DESCRIPTION "RFID火车车号识别 Win版")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
@ -18,7 +18,6 @@ link_directories(../lib)
|
||||||
|
|
||||||
link_libraries(ws2_32 wsock32)
|
link_libraries(ws2_32 wsock32)
|
||||||
|
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS
|
find_package(Qt5 COMPONENTS
|
||||||
Core
|
Core
|
||||||
Gui
|
Gui
|
||||||
|
|
@ -28,18 +27,14 @@ find_package(Qt5 COMPONENTS
|
||||||
Concurrent
|
Concurrent
|
||||||
REQUIRED)
|
REQUIRED)
|
||||||
|
|
||||||
#导入Qt的Network配置和在pro文件里面添加QT+=network是一样的
|
|
||||||
#find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core Network SerialPort )
|
|
||||||
#find_package(Qt${QT_VERSION_MAJOR} REQUIRED Network COMPONENTS Core)
|
|
||||||
#find_package(Qt5Core COMPONENTS Qt5SerialPort REQUIRED)
|
|
||||||
|
|
||||||
#moc编译在这里进行,请把含有Q_OBJECT宏定义的头文件放到这里来
|
#moc编译在这里进行,请把含有Q_OBJECT宏定义的头文件放到这里来
|
||||||
QT5_WRAP_CPP(MOC_Files
|
QT5_WRAP_CPP(MOC_Files
|
||||||
qt_source/mainwindow.h
|
qt_source/MainWindow.h
|
||||||
interface/TcpClient.h
|
interface/TcpClient.h
|
||||||
threads/UpResultThread.h
|
threads/UpResultThread.h
|
||||||
threads/UpWarnThread.h
|
threads/UpWarnThread.h
|
||||||
threads/ReadComThread.h
|
threads/ReadComThread.h
|
||||||
|
threads/RelayRfidThread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
@ -74,17 +69,15 @@ include_directories(
|
||||||
serial
|
serial
|
||||||
# 线程逻辑
|
# 线程逻辑
|
||||||
threads
|
threads
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB_RECURSE COMMON_SRCS_LISTS
|
file(GLOB_RECURSE COMMON_SRCS_LISTS
|
||||||
# UI
|
# UI
|
||||||
qt_source/mainwindow.ui
|
qt_source/MainWindow.ui
|
||||||
|
# qt_source qt_source
|
||||||
|
qt_source/MainWindow.cpp
|
||||||
# 公共数据
|
# 公共数据
|
||||||
common/common.cpp
|
common/common.cpp
|
||||||
# qt_source qt_source
|
|
||||||
qt_source/mainwindow.cpp
|
|
||||||
# JSON库
|
# JSON库
|
||||||
util/json/jsoncpp.cpp
|
util/json/jsoncpp.cpp
|
||||||
# http库
|
# http库
|
||||||
|
|
@ -120,10 +113,8 @@ add_executable(Train_RFID
|
||||||
${MOC_Files}
|
${MOC_Files}
|
||||||
ico.rc
|
ico.rc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(Train_RFID
|
target_link_libraries(Train_RFID
|
||||||
-pthread
|
-pthread
|
||||||
|
|
||||||
-lyaml-cpp
|
-lyaml-cpp
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
|
|
@ -154,7 +145,7 @@ if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
|
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
|
||||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
|
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
|
||||||
endif ()
|
endif ()
|
||||||
foreach (QT_LIB Core Gui Widgets Network SerialPort)
|
foreach (QT_LIB Core Gui Widgets)
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
|
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,34 @@ ConfigUtil::ConfigUtil() = default;
|
||||||
ConfigUtil::~ConfigUtil() = default;
|
ConfigUtil::~ConfigUtil() = default;
|
||||||
|
|
||||||
bool ConfigUtil::readBaseConfig(const QString &configFile, QString &errorMessage, ai_matrix::BaseConfig &config) {
|
bool ConfigUtil::readBaseConfig(const QString &configFile, QString &errorMessage, ai_matrix::BaseConfig &config) {
|
||||||
|
try {
|
||||||
|
if (configFile.isEmpty() || configFile.isNull())
|
||||||
|
{
|
||||||
|
errorMessage = "配置文件地址为空,读取配置文件失败!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSettings* mset = new QSettings(configFile, QSettings::IniFormat);
|
||||||
|
mset->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
|
mset->beginGroup("base");
|
||||||
|
config.trackName = mset->value("track_name", 1).toInt();
|
||||||
|
config.upResult = mset->value("up_result", false).toBool();
|
||||||
|
config.useSocketServer = mset->value("use_socket_server", false).toBool();
|
||||||
|
config.runModel = mset->value("run_model", 1).toInt();
|
||||||
|
// TODO: 此节点下的参数内容弃用,转移到[serial]下
|
||||||
|
// config.comName = mset->value("com_name", "").toString();
|
||||||
|
// config.baud = mset->value("baud", 19200).toInt();
|
||||||
|
// config.havaMagnetSteel = mset->value("have_magnet_steel", false).toBool();
|
||||||
|
// config.magnetSteelOrder = mset->value("magnet_steel_order", "").toString();
|
||||||
|
|
||||||
|
mset->endGroup();
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
errorMessage = e.what();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigUtil::writeBaseConfig(const QString &configFile, QString &errorMessage, ai_matrix::BaseConfig &config) {
|
||||||
try {
|
try {
|
||||||
if (configFile.isEmpty() || configFile.isNull()) {
|
if (configFile.isEmpty() || configFile.isNull()) {
|
||||||
errorMessage = "配置文件地址为空,读取配置文件失败!";
|
errorMessage = "配置文件地址为空,读取配置文件失败!";
|
||||||
|
|
@ -18,16 +46,34 @@ bool ConfigUtil::readBaseConfig(const QString &configFile, QString &errorMessage
|
||||||
}
|
}
|
||||||
QSettings* mset = new QSettings(configFile, QSettings::IniFormat);
|
QSettings* mset = new QSettings(configFile, QSettings::IniFormat);
|
||||||
mset->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
mset->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
QString mdir = "";
|
|
||||||
mset->beginGroup("base");
|
mset->beginGroup("base");
|
||||||
|
|
||||||
|
mset->setValue("track_name", config.trackName);
|
||||||
|
mset->setValue("up_result", config.upResult);
|
||||||
|
mset->setValue("use_socket_server", config.useSocketServer);
|
||||||
|
mset->setValue("run_model", config.runModel);
|
||||||
|
|
||||||
|
mset->endGroup();
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
errorMessage = e.what();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigUtil::readSerialConfig(const QString &configFile, QString &errorMessage, ai_matrix::SerialConfig &config) {
|
||||||
|
try {
|
||||||
|
if (configFile.isEmpty() || configFile.isNull()) {
|
||||||
|
errorMessage = "配置文件地址为空,读取配置文件失败!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSettings* mset = new QSettings(configFile, QSettings::IniFormat);
|
||||||
|
mset->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
|
mset->beginGroup("serial");
|
||||||
config.comName = mset->value("com_name", "").toString();
|
config.comName = mset->value("com_name", "").toString();
|
||||||
config.baud = mset->value("baud", 19200).toInt();
|
config.baud = mset->value("baud", 19200).toInt();
|
||||||
config.trackName = mset->value("track_name", 1).toInt();
|
|
||||||
config.havaMagnetSteel = mset->value("have_magnet_steel", false).toBool();
|
config.havaMagnetSteel = mset->value("have_magnet_steel", false).toBool();
|
||||||
config.magnetSteelOrder = mset->value("magnet_steel_order", "").toString();
|
config.magnetSteelOrder = mset->value("magnet_steel_order", "").toString();
|
||||||
config.upResult = mset->value("up_result", false).toBool();
|
|
||||||
config.useSocketServer = mset->value("use_socket_server", false).toBool();
|
|
||||||
config.useDeviceWarn = mset->value("use_device_warn", false).toBool();
|
|
||||||
|
|
||||||
mset->endGroup();
|
mset->endGroup();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
|
@ -50,8 +96,7 @@ bool ConfigUtil::readInterfaceConfig(const QString &configFile, QString &errorMe
|
||||||
config.httpIp = mset->value("http_ip", "").toString();
|
config.httpIp = mset->value("http_ip", "").toString();
|
||||||
config.httpPort = mset->value("http_port", "").toInt();
|
config.httpPort = mset->value("http_port", "").toInt();
|
||||||
config.tokenPath = mset->value("token_path", 19200).toString();
|
config.tokenPath = mset->value("token_path", 19200).toString();
|
||||||
config.upResultPath = mset->value("up_result_path", "").toString();
|
config.upResultPath = mset->value("up_result_path", 1).toString();
|
||||||
config.upWarningPath = mset->value("up_warning_path", "").toString();
|
|
||||||
config.username = mset->value("username", "").toString();
|
config.username = mset->value("username", "").toString();
|
||||||
config.password = mset->value("password", false).toString();
|
config.password = mset->value("password", false).toString();
|
||||||
|
|
||||||
|
|
@ -75,6 +120,7 @@ bool ConfigUtil::readSocketServerConfig(const QString &configFile, QString &erro
|
||||||
mset->beginGroup("socket_server");
|
mset->beginGroup("socket_server");
|
||||||
config.server_ip = mset->value("server_ip", "").toString();
|
config.server_ip = mset->value("server_ip", "").toString();
|
||||||
config.server_port = mset->value("server_port", "").toInt();
|
config.server_port = mset->value("server_port", "").toInt();
|
||||||
|
config.delayed_upload = mset->value("delayed_upload", "3").toInt();
|
||||||
|
|
||||||
mset->endGroup();
|
mset->endGroup();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
|
@ -103,3 +149,25 @@ bool ConfigUtil::readDeviceWarnConfig(const QString &configFile, QString &errorM
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConfigUtil::readRelayConfig(const QString &configFile, QString &errorMessage,
|
||||||
|
ai_matrix::RelayConfig &config) {
|
||||||
|
try {
|
||||||
|
if (configFile.isEmpty() || configFile.isNull()) {
|
||||||
|
errorMessage = "配置文件地址为空,读取配置文件失败!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSettings* mset = new QSettings(configFile, QSettings::IniFormat);
|
||||||
|
mset->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
|
mset->beginGroup("relay");
|
||||||
|
config.listener_port = mset->value("listener_port", 7010).toInt();
|
||||||
|
// config.max_connection = mset->value("max_connection", 3).toInt();
|
||||||
|
|
||||||
|
mset->endGroup();
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
errorMessage = e.what();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@ public:
|
||||||
~ConfigUtil();
|
~ConfigUtil();
|
||||||
|
|
||||||
static bool readBaseConfig(const QString& configFile, QString &errorMessage, ai_matrix::BaseConfig &config);
|
static bool readBaseConfig(const QString& configFile, QString &errorMessage, ai_matrix::BaseConfig &config);
|
||||||
|
static bool readSerialConfig(const QString& configFile, QString &errorMessage, ai_matrix::SerialConfig &config);
|
||||||
static bool readInterfaceConfig(const QString& configFile, QString &errorMessage, ai_matrix::InterfaceConfig &config);
|
static bool readInterfaceConfig(const QString& configFile, QString &errorMessage, ai_matrix::InterfaceConfig &config);
|
||||||
static bool readSocketServerConfig(const QString& configFile, QString &errorMessage, ai_matrix::SServerConfig &config);
|
static bool readSocketServerConfig(const QString& configFile, QString &errorMessage, ai_matrix::SServerConfig &config);
|
||||||
|
static bool readRelayConfig(const QString& configFile, QString &errorMessage, ai_matrix::RelayConfig &config);
|
||||||
static bool readDeviceWarnConfig(const QString& configFile, QString &errorMessage, ai_matrix::DeviceWarnConfig &config);
|
static bool readDeviceWarnConfig(const QString& configFile, QString &errorMessage, ai_matrix::DeviceWarnConfig &config);
|
||||||
|
static bool writeBaseConfig(const QString& configFile, QString &errorMessage, ai_matrix::BaseConfig &config);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,33 +12,60 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QtSerialPort/QSerialPortInfo>
|
||||||
|
#include <QtSerialPort/QSerialPort>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTcpsocket>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QListView>
|
||||||
|
#include <QMenuBar>
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
#include <QTcpServer>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ai_matrix {
|
namespace ai_matrix {
|
||||||
const QString g_config_path = "./config/config.ini";
|
const QString g_config_path = "./config/config.ini";
|
||||||
|
|
||||||
|
const int RELAY_MODEL = 0;
|
||||||
|
const int IDENTIFY_MODEL = 1;
|
||||||
|
|
||||||
// --- 配置文件 ---
|
// --- 配置文件 ---
|
||||||
|
|
||||||
struct BaseConfig {
|
struct BaseConfig {
|
||||||
// com口名称
|
|
||||||
QString comName;
|
|
||||||
// 波特率
|
|
||||||
int baud;
|
|
||||||
// 股道编号
|
// 股道编号
|
||||||
int trackName;
|
int trackName;
|
||||||
// 是否有磁钢
|
|
||||||
bool havaMagnetSteel;
|
|
||||||
// 磁钢顺序
|
|
||||||
QString magnetSteelOrder;
|
|
||||||
// 上传识别结果标志
|
// 上传识别结果标志
|
||||||
bool upResult;
|
bool upResult;
|
||||||
// 使用socket来车通讯
|
// 使用socket来车通讯
|
||||||
bool useSocketServer;
|
bool useSocketServer;
|
||||||
// 是否使用设备异常报警
|
// 运行模式 0: 转发模式 1: 识别模式
|
||||||
bool useDeviceWarn;
|
int runModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SerialConfig {
|
||||||
|
// com口名称
|
||||||
|
QString comName;
|
||||||
|
// 波特率
|
||||||
|
int baud;
|
||||||
|
// 是否有磁钢
|
||||||
|
bool havaMagnetSteel;
|
||||||
|
// 磁钢顺序
|
||||||
|
QString magnetSteelOrder;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InterfaceConfig {
|
struct InterfaceConfig {
|
||||||
|
|
@ -73,6 +100,11 @@ namespace ai_matrix {
|
||||||
int min_train_size;
|
int min_train_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RelayConfig {
|
||||||
|
// 监听端口
|
||||||
|
int listener_port;
|
||||||
|
};
|
||||||
|
|
||||||
// --- 配置文件 ---
|
// --- 配置文件 ---
|
||||||
|
|
||||||
struct TrainInfo {
|
struct TrainInfo {
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ void TcpClient::connectToServer(QString ip, int port) {
|
||||||
this->tcp_->connectToHost(ip, port); // Replace with actual server IP and port
|
this->tcp_->connectToHost(ip, port); // Replace with actual server IP and port
|
||||||
|
|
||||||
if(QAbstractSocket::ConnectingState == this->tcp_->state()) {
|
if(QAbstractSocket::ConnectingState == this->tcp_->state()) {
|
||||||
emit sendTcpInfoSignals("正在连接Socket服务器...");
|
emit sendTcpInfoSignals("正在连接辅助识别...");
|
||||||
}
|
}
|
||||||
if (!this->tcp_->waitForConnected(2000))
|
if (!this->tcp_->waitForConnected(2000))
|
||||||
{
|
{
|
||||||
emit sendTcpInfoSignals("链接服务端超时");
|
emit sendTcpInfoSignals("链接辅助识别服务超时");
|
||||||
// 5秒后尝试重新连接
|
// 5秒后尝试重新连接
|
||||||
QTimer::singleShot(5000, this, [=](){
|
QTimer::singleShot(5000, this, [=](){
|
||||||
// this->tcp_ = new QTcpSocket;
|
// this->tcp_ = new QTcpSocket;
|
||||||
emit sendTcpInfoSignals("重新连接Socket");
|
emit sendTcpInfoSignals("重新连接辅助识别");
|
||||||
emit restartSocket(this->ip_, this->port_);
|
emit restartSocket(this->ip_, this->port_);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -42,14 +42,14 @@ void TcpClient::connectToServer(QString ip, int port) {
|
||||||
// 心跳包定时器启动
|
// 心跳包定时器启动
|
||||||
this->heartbeatTimer_->start(3000);
|
this->heartbeatTimer_->start(3000);
|
||||||
}
|
}
|
||||||
emit sendTcpInfoSignals("链接服务端成功");
|
emit sendTcpInfoSignals("链接辅助识别服务成功");
|
||||||
// 连接失败
|
// 连接失败
|
||||||
connect(this->tcp_, &QTcpSocket::errorOccurred, this, [=](QAbstractSocket::SocketError err){
|
connect(this->tcp_, &QTcpSocket::errorOccurred, this, [=](QAbstractSocket::SocketError err){
|
||||||
emit sendTcpInfoSignals("链接服务端失败"); // 连接失败或其他错误,若服务器没有打开或连接失败,可以从这里会发出提示
|
emit sendTcpInfoSignals("链接辅助识别服务失败"); // 连接失败或其他错误,若服务器没有打开或连接失败,可以从这里会发出提示
|
||||||
});
|
});
|
||||||
// 断开连接
|
// 断开连接
|
||||||
connect(this->tcp_, &QTcpSocket::disconnected, this, [=](){
|
connect(this->tcp_, &QTcpSocket::disconnected, this, [=](){
|
||||||
emit sendTcpInfoSignals("服务端断开连接");
|
emit sendTcpInfoSignals("辅助识别服务断开连接");
|
||||||
this->tcp_->close();
|
this->tcp_->close();
|
||||||
this->tcp_->deleteLater();
|
this->tcp_->deleteLater();
|
||||||
this->tcp_ = nullptr;
|
this->tcp_ = nullptr;
|
||||||
|
|
@ -61,7 +61,7 @@ void TcpClient::connectToServer(QString ip, int port) {
|
||||||
|
|
||||||
// 5秒后尝试重新连接
|
// 5秒后尝试重新连接
|
||||||
QTimer::singleShot(5000, this, [=](){
|
QTimer::singleShot(5000, this, [=](){
|
||||||
emit sendTcpInfoSignals("重新连接Socket");
|
emit sendTcpInfoSignals("重新连接辅助识别");
|
||||||
emit restartSocket(this->ip_, this->port_);
|
emit restartSocket(this->ip_, this->port_);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
26
src/main.cpp
26
src/main.cpp
|
|
@ -1,29 +1,8 @@
|
||||||
|
#include <QApplication>
|
||||||
#include "mainwindow.h"
|
#include <MainWindow.h>
|
||||||
#include "TcpClient.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
void myMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg) {
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
// 处理debug信息
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
// 处理警告信息
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
// 处理严重错误信息
|
|
||||||
LogError<<"严重异常";
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
// 处理致命错误信息
|
|
||||||
LogError<<"致命异常";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
QDir dir("shared_key.txt");
|
QDir dir("shared_key.txt");
|
||||||
|
|
@ -59,7 +38,6 @@ int main(int argc, char *argv[]) {
|
||||||
{
|
{
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
QApplication::setWindowIcon(QIcon("./logo.ico"));
|
QApplication::setWindowIcon(QIcon("./logo.ico"));
|
||||||
qInstallMessageHandler(myMessageOutput);
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,23 @@
|
||||||
|
//
|
||||||
|
// Created by Mr.V on 2024/5/6.
|
||||||
|
//
|
||||||
|
|
||||||
|
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include "TcpClient.h"
|
|
||||||
|
|
||||||
#define DEBUG_HTTP 1
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, ui(new Ui::MainWindow)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
|
QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->statusBar = new QStatusBar();
|
// this->statusBar = new QStatusBar();
|
||||||
this->statusInfo = new QLabel("初始化完成",this);
|
this->statusInfo = new QLabel("初始化完成",this);
|
||||||
this->statusBar->addPermanentWidget(this->statusInfo);//显示正常信息
|
this->ui->statusbar->addPermanentWidget(this->statusInfo);//显示正常信息
|
||||||
QLabel* statusVersion = new QLabel("开启时间:" + QDateTime::currentDateTime().toString("yy-MM-dd hh:mm"),this);
|
QLabel* statusVersion = new QLabel(" 开启时间:" + QDateTime::currentDateTime().toString("yy.MM.dd.hh.mm"),this);
|
||||||
this->statusBar->addWidget(statusVersion);
|
this->ui->statusbar->addWidget(statusVersion);
|
||||||
|
|
||||||
layout()->addWidget(this->statusBar);
|
// layout()->addWidget(this->statusBar);
|
||||||
|
|
||||||
this->setWindowTitle("Matrix_RFID 车号识别程序(勿关!!)");
|
this->setWindowTitle("Matrix_RFID 车号识别程序(勿关!!)");
|
||||||
|
|
||||||
|
|
@ -33,6 +32,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
{
|
{
|
||||||
this->logError(errorMessage);
|
this->logError(errorMessage);
|
||||||
}
|
}
|
||||||
|
if (!ConfigUtil::readSerialConfig(g_config_path, errorMessage, this->serialConfig_))
|
||||||
|
{
|
||||||
|
this->logError(errorMessage);
|
||||||
|
}
|
||||||
|
// this->ui->stackedWidget->currentChanged();
|
||||||
|
this->ui->stackedWidget->setCurrentIndex(this->baseConfig_.runModel);
|
||||||
|
|
||||||
// 获取本机串口列表
|
// 获取本机串口列表
|
||||||
this->getComList();
|
this->getComList();
|
||||||
|
|
@ -50,7 +55,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
//初始最小化
|
//初始最小化
|
||||||
//this->showMinimized();//最小化
|
//this->showMinimized();//最小化
|
||||||
// 设置最大展示数据行数
|
// 设置最大展示数据行数
|
||||||
this->ui->textBrowser->document()->setMaximumBlockCount(1000);
|
this->ui->Log_TextBrowser->document()->setMaximumBlockCount(1000);
|
||||||
|
this->ui->SocketLog_TextBrowser->document()->setMaximumBlockCount(1000);
|
||||||
|
this->ui->Rfid_textBrowser->document()->setMaximumBlockCount(1000);
|
||||||
|
|
||||||
getStandardItemModel();
|
getStandardItemModel();
|
||||||
this->ui->resultTable->setModel(this->resultTableModel_);
|
this->ui->resultTable->setModel(this->resultTableModel_);
|
||||||
|
|
@ -71,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
// 初始化LED指示灯
|
// 初始化LED指示灯
|
||||||
this->upResultType(this->baseConfig_.upResult);
|
this->upResultType(this->baseConfig_.upResult);
|
||||||
|
|
||||||
this->readComThread = new ReadComThread(&this->queueTrainInfo_, &this->queueWarn_, this);
|
this->readComThread = new ReadComThread(&this->queueTrainInfo_, &this->queueWarn_, &this->queueRFID_, this);
|
||||||
this->readComThread->start();
|
this->readComThread->start();
|
||||||
|
|
||||||
this->upResultThread = new UpResultThread(&this->queueTrainInfo_, this);
|
this->upResultThread = new UpResultThread(&this->queueTrainInfo_, this);
|
||||||
|
|
@ -80,8 +87,18 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
this->upWarnThread = new UpWarnThread(&this->queueWarn_, this);
|
this->upWarnThread = new UpWarnThread(&this->queueWarn_, this);
|
||||||
this->upWarnThread->start();
|
this->upWarnThread->start();
|
||||||
|
|
||||||
|
this->relayRfidThread = new RelayRfidThread(&this->queueRFID_, this);
|
||||||
|
this->relayRfidThread->start();
|
||||||
|
|
||||||
|
|
||||||
|
connect(this->ui->identify, &QAction::triggered, this, &MainWindow::identifyModelClicked);
|
||||||
|
connect(this->ui->relay, &QAction::triggered, this, &MainWindow::relayModelClicked);
|
||||||
connect(this, &MainWindow::openCom_signals, this->readComThread, &ReadComThread::openCom);
|
connect(this, &MainWindow::openCom_signals, this->readComThread, &ReadComThread::openCom);
|
||||||
connect(this, &MainWindow::readTestRfid_signals, this->readComThread, &ReadComThread::readTestInfo);
|
connect(this, &MainWindow::readTestRfid_signals, this->readComThread, &ReadComThread::readTestInfo);
|
||||||
|
connect(this, &MainWindow::updateRunModel_ReadCom_signals, this->readComThread, &ReadComThread::updateRunModel);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::update_client_num, this, &MainWindow::update_client_num);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::ConnectInfoSignals, this, &MainWindow::ConnectInfoSignals);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::RfidInfoSignals, this, &MainWindow::RfidInfoSignals);
|
||||||
|
|
||||||
connect(this->readComThread, &ReadComThread::openComSuccess, this, &MainWindow::openComResult);
|
connect(this->readComThread, &ReadComThread::openComSuccess, this, &MainWindow::openComResult);
|
||||||
connect(this->readComThread, &ReadComThread::closeComSuccess, this, &MainWindow::closeComResult);
|
connect(this->readComThread, &ReadComThread::closeComSuccess, this, &MainWindow::closeComResult);
|
||||||
|
|
@ -105,34 +122,62 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(this->upWarnThread, &UpWarnThread::WarnSignals, this, &MainWindow::WarnSlots);
|
connect(this->upWarnThread, &UpWarnThread::WarnSignals, this, &MainWindow::WarnSlots);
|
||||||
connect(this->upWarnThread, &UpWarnThread::ErrorSignals, this, &MainWindow::ErrorSlots);
|
connect(this->upWarnThread, &UpWarnThread::ErrorSignals, this, &MainWindow::ErrorSlots);
|
||||||
|
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::DebugSignals, this, &MainWindow::DebugSlots);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::InfoSignals, this, &MainWindow::InfoSlots);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::WarnSignals, this, &MainWindow::WarnSlots);
|
||||||
|
connect(this->relayRfidThread, &RelayRfidThread::ErrorSignals, this, &MainWindow::ErrorSlots);
|
||||||
|
|
||||||
ui->openComButton->click();
|
ui->openComButton->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow() {
|
||||||
{
|
|
||||||
this->logInfo("-- 程序退出 --");
|
this->logInfo("-- 程序退出 --");
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::logDebug(const QString& message) {
|
void MainWindow::logDebug(const QString& message) {
|
||||||
LogDebug << message.toStdString();
|
LogDebug << message.toStdString();
|
||||||
ui->textBrowser->append(QString("[Debug] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
ui->Log_TextBrowser->append(QString("[Debug] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
||||||
}
|
}
|
||||||
void MainWindow::logInfo(const QString& message) {
|
void MainWindow::logInfo(const QString& message) {
|
||||||
LogInfo << message.toStdString();
|
LogInfo << message.toStdString();
|
||||||
ui->textBrowser->append(QString("[Info] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
ui->Log_TextBrowser->append(QString("[Info] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
||||||
}
|
}
|
||||||
void MainWindow::logWarn(const QString& message) {
|
void MainWindow::logWarn(const QString& message) {
|
||||||
LogWarn << message.toStdString();
|
LogWarn << message.toStdString();
|
||||||
ui->textBrowser->append(QString("[Warn] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
ui->Log_TextBrowser->append(QString("[Warn] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
||||||
}
|
}
|
||||||
void MainWindow::logError(const QString& message) {
|
void MainWindow::logError(const QString& message) {
|
||||||
LogError << message.toStdString();
|
LogError << message.toStdString();
|
||||||
ui->textBrowser->append(QString("[Error] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
ui->Log_TextBrowser->append(QString("[Error] [") + this->getSystemTime() + QString::fromStdString("] ") + message);
|
||||||
}
|
}
|
||||||
void MainWindow::statusInfoUpdate(const QString &info) {
|
void MainWindow::statusInfoUpdate(const QString &info) {
|
||||||
this->statusInfo->setText(info);
|
this->statusInfo->setText(info);
|
||||||
}
|
}
|
||||||
|
void MainWindow::RfidInfoSignals(const QString &info) {
|
||||||
|
this->ui->Rfid_textBrowser->append(info);
|
||||||
|
}
|
||||||
|
void MainWindow::ConnectInfoSignals(const QString &info) {
|
||||||
|
this->ui->SocketLog_TextBrowser->append("- " + this->getSystemTime() + " - \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::relayModelClicked() {
|
||||||
|
this->updateRunModel(0);
|
||||||
|
}
|
||||||
|
void MainWindow::identifyModelClicked() {
|
||||||
|
this->updateRunModel(1);
|
||||||
|
}
|
||||||
|
void MainWindow::updateRunModel(int page) {
|
||||||
|
this->ui->stackedWidget->setCurrentIndex(page);
|
||||||
|
this->baseConfig_.runModel = page;
|
||||||
|
QString errorMessage = "";
|
||||||
|
if (!ConfigUtil::writeBaseConfig(g_config_path, errorMessage, this->baseConfig_))
|
||||||
|
{
|
||||||
|
this->logError(errorMessage);
|
||||||
|
}
|
||||||
|
emit this->updateRunModel_ReadCom_signals(page);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建日志目录
|
* 创建日志目录
|
||||||
|
|
@ -169,27 +214,27 @@ QList<QString> MainWindow::getComList() {
|
||||||
void MainWindow::initComboBox()
|
void MainWindow::initComboBox()
|
||||||
{
|
{
|
||||||
// ui->BTBox->setEditable(true);
|
// ui->BTBox->setEditable(true);
|
||||||
ui->BTBox->setStyleSheet("QComboBox {background-color: rgb(255, 255, 255);} QComboBox QAbstractItemView::item {min-height: 30px; background-color: rgb(255, 255, 255); color: rgb(225, 225, 225);}");
|
ui->BTBox->setStyleSheet("QComboBox {background-color: rgb(255, 255, 255);} QComboBox QAbstractItemView::item {min-height: 20px; background-color: rgb(225, 255, 255); color: rgb(0, 0, 0);}");
|
||||||
ui->BTBox->setView(new QListView());
|
ui->BTBox->setView(new QListView());
|
||||||
ui->comBox->setEditable(true);
|
ui->comBox->setEditable(true);
|
||||||
ui->comBox->setStyleSheet("QComboBox {background-color: rgb(255, 255, 255);} QComboBox QAbstractItemView::item {min-height: 30px; background-color: rgb(255, 255, 255); color: rgb(225, 225, 225);}");
|
ui->comBox->setStyleSheet("QComboBox {background-color: rgb(255, 255, 255);} QComboBox QAbstractItemView::item {min-height: 20px; background-color: rgb(225, 255, 255); color: rgb(0, 0, 0);}");
|
||||||
ui->comBox->setMaxVisibleItems(5);
|
ui->comBox->setMaxVisibleItems(5);
|
||||||
ui->comBox->setView(new QListView());
|
ui->comBox->setView(new QListView());
|
||||||
ui->comBox->addItems(this->comList);
|
ui->comBox->addItems(this->comList);
|
||||||
if (this->baseConfig_.comName != "") {
|
if (this->serialConfig_.comName != "") {
|
||||||
if (ui->comBox->findText(this->baseConfig_.comName) == -1)
|
if (ui->comBox->findText(this->serialConfig_.comName) == -1)
|
||||||
{
|
{
|
||||||
ui->comBox->addItem(this->baseConfig_.comName);
|
ui->comBox->addItem(this->serialConfig_.comName);
|
||||||
}
|
}
|
||||||
ui->comBox->setCurrentText(this->baseConfig_.comName);
|
ui->comBox->setCurrentText(this->serialConfig_.comName);
|
||||||
}
|
}
|
||||||
if (ui->BTBox->findText(QString::number(this->baseConfig_.baud)) == -1)
|
if (ui->BTBox->findText(QString::number(this->serialConfig_.baud)) == -1)
|
||||||
{
|
{
|
||||||
ui->BTBox->addItem(QString::number(this->baseConfig_.baud));
|
ui->BTBox->addItem(QString::number(this->serialConfig_.baud));
|
||||||
}
|
}
|
||||||
ui->BTBox->setCurrentText(QString::number(this->baseConfig_.baud));
|
ui->BTBox->setCurrentText(QString::number(this->serialConfig_.baud));
|
||||||
|
|
||||||
ui->truckEdit->setText(QString::number(this->baseConfig_.trackName));
|
// ui->truckEdit->setText(QString::number(this->baseConfig_.trackName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -407,6 +452,13 @@ void MainWindow::ErrorSlots(const QString &info) {
|
||||||
this->logError(info);
|
this->logError(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================= 转发 ====================================
|
||||||
|
|
||||||
|
void MainWindow::update_client_num(int num)
|
||||||
|
{
|
||||||
|
this->ui->SocketClientNum_Label->setText(QString::number(this->ui->SocketClientNum_Label->text().toInt() + num));
|
||||||
|
}
|
||||||
|
|
||||||
// ============================= 测试 ====================================
|
// ============================= 测试 ====================================
|
||||||
|
|
||||||
void MainWindow::readTestInfo()
|
void MainWindow::readTestInfo()
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,63 @@
|
||||||
#ifndef MainWindow_H
|
//
|
||||||
#define MainWindow_H
|
// Created by Mr.V on 2024/5/6.
|
||||||
|
//
|
||||||
|
|
||||||
#include <QWidget>
|
#ifndef TRAIN_RFID_RELAY_MainWindow_H
|
||||||
#include <QtSerialPort/QSerialPortInfo>
|
#define TRAIN_RFID_RELAY_MainWindow_H
|
||||||
#include <QtSerialPort/QSerialPort>
|
|
||||||
#include <QDebug>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
#include <cstdio>
|
||||||
#include <stdio.h>
|
#include <cstring>
|
||||||
#include <string.h>
|
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <QWaitCondition>
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <Iphlpapi.h>
|
#include <Iphlpapi.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <QObject>
|
|
||||||
#include <QTcpsocket>
|
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <QDateTime>
|
|
||||||
#include "httplib.h"
|
#include "httplib.h"
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QSystemTrayIcon>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QAction>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <qmenu.h>
|
#include <qmenu.h>
|
||||||
#include <QFile>
|
|
||||||
#include <QDir>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QListView>
|
|
||||||
#include <QMenuBar>
|
|
||||||
#include <QStatusBar>
|
|
||||||
#include <QtConcurrent>
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
//#include "ComDetect.h"
|
|
||||||
|
|
||||||
#include "UpResultThread.h"
|
#include "UpResultThread.h"
|
||||||
#include "ReadComThread.h"
|
#include "ReadComThread.h"
|
||||||
|
#include "RelayRfidThread.h"
|
||||||
|
#include "TcpClient.h"
|
||||||
#include "UpWarnThread.h"
|
#include "UpWarnThread.h"
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
using namespace ai_matrix;
|
|
||||||
|
|
||||||
class MainWindow : public QWidget
|
class MainWindow : public QMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
|
||||||
|
~MainWindow() override;
|
||||||
|
|
||||||
void logDebug(const QString& message);
|
void logDebug(const QString& message);
|
||||||
void logInfo(const QString& message);
|
void logInfo(const QString& message);
|
||||||
void logWarn(const QString& message);
|
void logWarn(const QString& message);
|
||||||
void logError(const QString& message);
|
void logError(const QString& message);
|
||||||
// 创建日志目录
|
// 创建日志目录
|
||||||
bool mkLogDir();
|
static bool mkLogDir();
|
||||||
|
|
||||||
void initParam();
|
static QString getSystemTime();
|
||||||
|
|
||||||
QString getSystemTime();
|
|
||||||
|
|
||||||
// 获const 取串口列表&
|
// 获const 取串口列表&
|
||||||
QList<QString> getComList();
|
QList<QString> getComList();
|
||||||
|
|
@ -91,16 +69,19 @@ public:
|
||||||
QStandardItem* getStandardItem(const QString &value);
|
QStandardItem* getStandardItem(const QString &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
UpResultThread *upResultThread;
|
UpResultThread *upResultThread;
|
||||||
UpWarnThread *upWarnThread;
|
UpWarnThread *upWarnThread;
|
||||||
ReadComThread *readComThread;
|
ReadComThread *readComThread;
|
||||||
|
RelayRfidThread *relayRfidThread;
|
||||||
|
|
||||||
QString logRfidRecvName;
|
QString logRfidRecvName;
|
||||||
QFile recvLog;
|
QFile recvLog;
|
||||||
|
|
||||||
QString configPath_; //
|
QString configPath_; //
|
||||||
ai_matrix::BaseConfig baseConfig_;
|
ai_matrix::BaseConfig baseConfig_;
|
||||||
|
ai_matrix::SerialConfig serialConfig_;
|
||||||
ai_matrix::InterfaceConfig interfaceConfig_;
|
ai_matrix::InterfaceConfig interfaceConfig_;
|
||||||
|
|
||||||
std::string webToken; //授权信息
|
std::string webToken; //授权信息
|
||||||
|
|
@ -116,7 +97,7 @@ private:
|
||||||
QList<QString> comList;
|
QList<QString> comList;
|
||||||
// 整列车识别结果存储
|
// 整列车识别结果存储
|
||||||
QStringList vecTrain;
|
QStringList vecTrain;
|
||||||
MQueue<QString> queue_{}; // RFID读取的数据队列
|
MQueue<QString> queueRFID_{}; // RFID读取的数据队列
|
||||||
MQueue<TrainInfo> queueTrainInfo_{}; // RFID读取的磁钢信息队列
|
MQueue<TrainInfo> queueTrainInfo_{}; // RFID读取的磁钢信息队列
|
||||||
MQueue<QString> queueWarn_{}; // 报警信息队列
|
MQueue<QString> queueWarn_{}; // 报警信息队列
|
||||||
|
|
||||||
|
|
@ -128,17 +109,17 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QStatusBar* statusBar;
|
QStatusBar* statusBar{};
|
||||||
QLabel *statusInfo;
|
QLabel *statusInfo;
|
||||||
|
|
||||||
QMenu* m_pTrayMennu; //系统托盘右键菜单项
|
QMenu* m_pTrayMennu{}; //系统托盘右键菜单项
|
||||||
QSystemTrayIcon* m_pSystemTray; //系统托盘图标
|
QSystemTrayIcon* m_pSystemTray; //系统托盘图标
|
||||||
|
|
||||||
//右键菜单栏选项
|
//右键菜单栏选项
|
||||||
QAction* m_pActionShow;
|
QAction* m_pActionShow{};
|
||||||
QAction* m_pActionQuit;
|
QAction* m_pActionQuit{};
|
||||||
void creat_action();
|
void creat_action();
|
||||||
void changeEvent(QEvent *event);
|
void changeEvent(QEvent *event) override;
|
||||||
void on_ShowMainAction();
|
void on_ShowMainAction();
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void creat_menu();
|
void creat_menu();
|
||||||
|
|
@ -146,8 +127,12 @@ private:
|
||||||
signals:
|
signals:
|
||||||
void openCom_signals(const bool &type, const int &msec = 0);
|
void openCom_signals(const bool &type, const int &msec = 0);
|
||||||
void readTestRfid_signals(const QString &filePath);
|
void readTestRfid_signals(const QString &filePath);
|
||||||
|
void updateRunModel_ReadCom_signals(int model);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void relayModelClicked();
|
||||||
|
void identifyModelClicked();
|
||||||
|
void updateRunModel(int page);
|
||||||
void openComClicked();
|
void openComClicked();
|
||||||
void openComResult(const bool &success);
|
void openComResult(const bool &success);
|
||||||
void closeComResult(const bool &success);
|
void closeComResult(const bool &success);
|
||||||
|
|
@ -157,15 +142,15 @@ private slots:
|
||||||
void readTestInfo();
|
void readTestInfo();
|
||||||
|
|
||||||
void statusInfoUpdate(const QString &info);
|
void statusInfoUpdate(const QString &info);
|
||||||
|
void update_client_num(int num);
|
||||||
|
void RfidInfoSignals(const QString &info);
|
||||||
|
void ConnectInfoSignals(const QString &info);
|
||||||
|
|
||||||
void DebugSlots(const QString &info);
|
void DebugSlots(const QString &info);
|
||||||
void InfoSlots(const QString &info);
|
void InfoSlots(const QString &info);
|
||||||
void WarnSlots(const QString &info);
|
void WarnSlots(const QString &info);
|
||||||
void ErrorSlots(const QString &info);
|
void ErrorSlots(const QString &info);
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::MainWindow *ui;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // MainWindow_H
|
#endif //TRAIN_RFID_RELAY_MainWindow_H
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MainWindow</class>
|
<class>MainWindow</class>
|
||||||
<widget class="QWidget" name="MainWindow">
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
|
@ -10,32 +10,24 @@
|
||||||
<height>815</height>
|
<height>815</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>815</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>815</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>mainwindow</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(217, 235, 255);</string>
|
<string notr="true">background-color: rgb(217, 235, 255);</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>70</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -66,11 +58,27 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>70</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -116,72 +124,22 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>80</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>股道名:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="truckEdit">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>120</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Maximum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>80</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="LEDlabel">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border-radius: 16px;
|
|
||||||
background-color: red;
|
|
||||||
border:1px solid rgba(168, 168, 168, 105);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="openComButton">
|
<widget class="QPushButton" name="openComButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
|
@ -205,17 +163,41 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="LEDlabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">border-radius: 16px;
|
||||||
|
background-color: red;
|
||||||
|
border:1px solid rgba(168, 168, 168, 105);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_5">
|
<spacer name="horizontalSpacer_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Maximum</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>50</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -250,7 +232,7 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
|
|
@ -265,7 +247,123 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(217, 235, 255);</string>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::NoContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>客户端链接数:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="SocketClientNum_Label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial Black</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="SocketLog_TextBrowser">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(232, 232, 232, 100);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|
@ -273,6 +371,83 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>转发信息:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="Rfid_textBrowser">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(232, 232, 232, 100);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
|
|
@ -294,29 +469,32 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
<widget class="QLabel" name="upflagLabel">
|
<widget class="QLabel" name="upflagLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>70</width>
|
<width>50</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>50</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>不上传</string>
|
<string>不传</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_7">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>180</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -334,7 +512,7 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>220</width>
|
<width>400</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -345,8 +523,17 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -387,21 +574,13 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextBrowser" name="textBrowser">
|
<widget class="QTextBrowser" name="Log_TextBrowser">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>700</width>
|
<width>650</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Arial</family>
|
|
||||||
<pointsize>9</pointsize>
|
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgba(232, 232, 232, 100);</string>
|
<string notr="true">background-color: rgba(232, 232, 232, 100);</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -413,6 +592,76 @@ border: 2px solid rgb(134, 134, 134);</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1000</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(155, 208, 255);</string>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>设置</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="run_model">
|
||||||
|
<property name="title">
|
||||||
|
<string>识别模式</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="relay"/>
|
||||||
|
<addaction name="identify"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="run_model"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionset"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionshibiefuzhu"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionchuankou"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusbar">
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="statusTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<action name="actionset">
|
||||||
|
<property name="text">
|
||||||
|
<string>接口设置</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionshibiefuzhu">
|
||||||
|
<property name="text">
|
||||||
|
<string>串口设置</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionchuankou">
|
||||||
|
<property name="text">
|
||||||
|
<string>识别辅助</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="identify">
|
||||||
|
<property name="text">
|
||||||
|
<string>识别模式</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="relay">
|
||||||
|
<property name="text">
|
||||||
|
<string>转发模式</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
** Form generated from reading UI file 'mainwindow.ui'
|
** Form generated from reading UI file 'MainWindow.ui'
|
||||||
**
|
**
|
||||||
** Created by: Qt User Interface Compiler version 5.15.2
|
** Created by: Qt User Interface Compiler version 5.15.2
|
||||||
**
|
**
|
||||||
|
|
@ -10,14 +10,19 @@
|
||||||
#define UI_MAINWINDOW_H
|
#define UI_MAINWINDOW_H
|
||||||
|
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QAction>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtWidgets/QComboBox>
|
#include <QtWidgets/QComboBox>
|
||||||
#include <QtWidgets/QHBoxLayout>
|
#include <QtWidgets/QHBoxLayout>
|
||||||
#include <QtWidgets/QHeaderView>
|
#include <QtWidgets/QHeaderView>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QMainWindow>
|
||||||
|
#include <QtWidgets/QMenu>
|
||||||
|
#include <QtWidgets/QMenuBar>
|
||||||
#include <QtWidgets/QPushButton>
|
#include <QtWidgets/QPushButton>
|
||||||
#include <QtWidgets/QSpacerItem>
|
#include <QtWidgets/QSpacerItem>
|
||||||
|
#include <QtWidgets/QStackedWidget>
|
||||||
|
#include <QtWidgets/QStatusBar>
|
||||||
#include <QtWidgets/QTableView>
|
#include <QtWidgets/QTableView>
|
||||||
#include <QtWidgets/QTextBrowser>
|
#include <QtWidgets/QTextBrowser>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
|
|
@ -28,53 +33,89 @@ QT_BEGIN_NAMESPACE
|
||||||
class Ui_MainWindow
|
class Ui_MainWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QVBoxLayout *verticalLayout_3;
|
QAction *actionset;
|
||||||
|
QAction *actionshibiefuzhu;
|
||||||
|
QAction *actionchuankou;
|
||||||
|
QAction *identify;
|
||||||
|
QAction *relay;
|
||||||
|
QWidget *centralwidget;
|
||||||
|
QVBoxLayout *verticalLayout;
|
||||||
QHBoxLayout *horizontalLayout;
|
QHBoxLayout *horizontalLayout;
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
QComboBox *comBox;
|
QComboBox *comBox;
|
||||||
|
QSpacerItem *horizontalSpacer_9;
|
||||||
QLabel *label_2;
|
QLabel *label_2;
|
||||||
QComboBox *BTBox;
|
QComboBox *BTBox;
|
||||||
QLabel *label_3;
|
|
||||||
QLineEdit *truckEdit;
|
|
||||||
QSpacerItem *horizontalSpacer;
|
QSpacerItem *horizontalSpacer;
|
||||||
QLabel *LEDlabel;
|
|
||||||
QPushButton *openComButton;
|
QPushButton *openComButton;
|
||||||
|
QLabel *LEDlabel;
|
||||||
QSpacerItem *horizontalSpacer_5;
|
QSpacerItem *horizontalSpacer_5;
|
||||||
QPushButton *testButton;
|
QPushButton *testButton;
|
||||||
QSpacerItem *horizontalSpacer_2;
|
QSpacerItem *horizontalSpacer_2;
|
||||||
QHBoxLayout *horizontalLayout_2;
|
QHBoxLayout *horizontalLayout_2;
|
||||||
QVBoxLayout *verticalLayout;
|
QStackedWidget *stackedWidget;
|
||||||
|
QWidget *page;
|
||||||
|
QVBoxLayout *verticalLayout_7;
|
||||||
|
QVBoxLayout *verticalLayout_3;
|
||||||
|
QHBoxLayout *horizontalLayout_5;
|
||||||
|
QLabel *label_8;
|
||||||
|
QLabel *SocketClientNum_Label;
|
||||||
|
QSpacerItem *horizontalSpacer_6;
|
||||||
|
QTextBrowser *SocketLog_TextBrowser;
|
||||||
QHBoxLayout *horizontalLayout_3;
|
QHBoxLayout *horizontalLayout_3;
|
||||||
QLabel *label_4;
|
QLabel *label_4;
|
||||||
QLabel *upflagLabel;
|
|
||||||
QSpacerItem *horizontalSpacer_3;
|
QSpacerItem *horizontalSpacer_3;
|
||||||
|
QTextBrowser *Rfid_textBrowser;
|
||||||
|
QWidget *page_2;
|
||||||
|
QVBoxLayout *verticalLayout_6;
|
||||||
|
QHBoxLayout *horizontalLayout_6;
|
||||||
|
QVBoxLayout *verticalLayout_4;
|
||||||
|
QHBoxLayout *horizontalLayout_7;
|
||||||
|
QLabel *label_6;
|
||||||
|
QLabel *upflagLabel;
|
||||||
|
QSpacerItem *horizontalSpacer_7;
|
||||||
QTableView *resultTable;
|
QTableView *resultTable;
|
||||||
QVBoxLayout *verticalLayout_2;
|
QVBoxLayout *verticalLayout_2;
|
||||||
QHBoxLayout *horizontalLayout_4;
|
QHBoxLayout *horizontalLayout_4;
|
||||||
QLabel *label_5;
|
QLabel *label_5;
|
||||||
QSpacerItem *horizontalSpacer_4;
|
QSpacerItem *horizontalSpacer_4;
|
||||||
QTextBrowser *textBrowser;
|
QTextBrowser *Log_TextBrowser;
|
||||||
|
QMenuBar *menubar;
|
||||||
|
QMenu *menu;
|
||||||
|
QMenu *run_model;
|
||||||
|
QStatusBar *statusbar;
|
||||||
|
|
||||||
void setupUi(QWidget *MainWindow)
|
void setupUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
if (MainWindow->objectName().isEmpty())
|
if (MainWindow->objectName().isEmpty())
|
||||||
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
||||||
MainWindow->resize(1000, 815);
|
MainWindow->resize(1000, 815);
|
||||||
MainWindow->setMinimumSize(QSize(1000, 815));
|
|
||||||
MainWindow->setMaximumSize(QSize(1000, 815));
|
|
||||||
MainWindow->setStyleSheet(QString::fromUtf8("background-color: rgb(217, 235, 255);"));
|
MainWindow->setStyleSheet(QString::fromUtf8("background-color: rgb(217, 235, 255);"));
|
||||||
verticalLayout_3 = new QVBoxLayout(MainWindow);
|
actionset = new QAction(MainWindow);
|
||||||
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
|
actionset->setObjectName(QString::fromUtf8("actionset"));
|
||||||
|
actionshibiefuzhu = new QAction(MainWindow);
|
||||||
|
actionshibiefuzhu->setObjectName(QString::fromUtf8("actionshibiefuzhu"));
|
||||||
|
actionchuankou = new QAction(MainWindow);
|
||||||
|
actionchuankou->setObjectName(QString::fromUtf8("actionchuankou"));
|
||||||
|
identify = new QAction(MainWindow);
|
||||||
|
identify->setObjectName(QString::fromUtf8("identify"));
|
||||||
|
relay = new QAction(MainWindow);
|
||||||
|
relay->setObjectName(QString::fromUtf8("relay"));
|
||||||
|
centralwidget = new QWidget(MainWindow);
|
||||||
|
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
|
||||||
|
verticalLayout = new QVBoxLayout(centralwidget);
|
||||||
|
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||||
horizontalLayout = new QHBoxLayout();
|
horizontalLayout = new QHBoxLayout();
|
||||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||||
label = new QLabel(MainWindow);
|
horizontalLayout->setContentsMargins(-1, 6, -1, -1);
|
||||||
|
label = new QLabel(centralwidget);
|
||||||
label->setObjectName(QString::fromUtf8("label"));
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
label->setMaximumSize(QSize(80, 16777215));
|
label->setMaximumSize(QSize(70, 16777215));
|
||||||
label->setStyleSheet(QString::fromUtf8("font: 75 9pt \"Arial\";"));
|
label->setStyleSheet(QString::fromUtf8("font: 75 9pt \"Arial\";"));
|
||||||
|
|
||||||
horizontalLayout->addWidget(label);
|
horizontalLayout->addWidget(label);
|
||||||
|
|
||||||
comBox = new QComboBox(MainWindow);
|
comBox = new QComboBox(centralwidget);
|
||||||
comBox->setObjectName(QString::fromUtf8("comBox"));
|
comBox->setObjectName(QString::fromUtf8("comBox"));
|
||||||
comBox->setMinimumSize(QSize(120, 40));
|
comBox->setMinimumSize(QSize(120, 40));
|
||||||
comBox->setMaximumSize(QSize(100, 40));
|
comBox->setMaximumSize(QSize(100, 40));
|
||||||
|
|
@ -82,14 +123,18 @@ public:
|
||||||
|
|
||||||
horizontalLayout->addWidget(comBox);
|
horizontalLayout->addWidget(comBox);
|
||||||
|
|
||||||
label_2 = new QLabel(MainWindow);
|
horizontalSpacer_9 = new QSpacerItem(40, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
horizontalLayout->addItem(horizontalSpacer_9);
|
||||||
|
|
||||||
|
label_2 = new QLabel(centralwidget);
|
||||||
label_2->setObjectName(QString::fromUtf8("label_2"));
|
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||||
label_2->setMaximumSize(QSize(80, 16777215));
|
label_2->setMaximumSize(QSize(70, 16777215));
|
||||||
label_2->setStyleSheet(QString::fromUtf8("font: 75 9pt \"Arial\";"));
|
label_2->setStyleSheet(QString::fromUtf8("font: 75 9pt \"Arial\";"));
|
||||||
|
|
||||||
horizontalLayout->addWidget(label_2);
|
horizontalLayout->addWidget(label_2);
|
||||||
|
|
||||||
BTBox = new QComboBox(MainWindow);
|
BTBox = new QComboBox(centralwidget);
|
||||||
BTBox->addItem(QString());
|
BTBox->addItem(QString());
|
||||||
BTBox->addItem(QString());
|
BTBox->addItem(QString());
|
||||||
BTBox->addItem(QString());
|
BTBox->addItem(QString());
|
||||||
|
|
@ -100,34 +145,11 @@ public:
|
||||||
|
|
||||||
horizontalLayout->addWidget(BTBox);
|
horizontalLayout->addWidget(BTBox);
|
||||||
|
|
||||||
label_3 = new QLabel(MainWindow);
|
horizontalSpacer = new QSpacerItem(80, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
label_3->setObjectName(QString::fromUtf8("label_3"));
|
|
||||||
label_3->setMaximumSize(QSize(80, 16777215));
|
|
||||||
|
|
||||||
horizontalLayout->addWidget(label_3);
|
|
||||||
|
|
||||||
truckEdit = new QLineEdit(MainWindow);
|
|
||||||
truckEdit->setObjectName(QString::fromUtf8("truckEdit"));
|
|
||||||
truckEdit->setMinimumSize(QSize(120, 40));
|
|
||||||
truckEdit->setMaximumSize(QSize(100, 40));
|
|
||||||
truckEdit->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 255, 255);"));
|
|
||||||
|
|
||||||
horizontalLayout->addWidget(truckEdit);
|
|
||||||
|
|
||||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
|
||||||
|
|
||||||
horizontalLayout->addItem(horizontalSpacer);
|
horizontalLayout->addItem(horizontalSpacer);
|
||||||
|
|
||||||
LEDlabel = new QLabel(MainWindow);
|
openComButton = new QPushButton(centralwidget);
|
||||||
LEDlabel->setObjectName(QString::fromUtf8("LEDlabel"));
|
|
||||||
LEDlabel->setMaximumSize(QSize(32, 32));
|
|
||||||
LEDlabel->setStyleSheet(QString::fromUtf8("border-radius: 16px;\n"
|
|
||||||
"background-color: red;\n"
|
|
||||||
"border:1px solid rgba(168, 168, 168, 105);"));
|
|
||||||
|
|
||||||
horizontalLayout->addWidget(LEDlabel);
|
|
||||||
|
|
||||||
openComButton = new QPushButton(MainWindow);
|
|
||||||
openComButton->setObjectName(QString::fromUtf8("openComButton"));
|
openComButton->setObjectName(QString::fromUtf8("openComButton"));
|
||||||
openComButton->setMinimumSize(QSize(120, 50));
|
openComButton->setMinimumSize(QSize(120, 50));
|
||||||
openComButton->setMaximumSize(QSize(120, 50));
|
openComButton->setMaximumSize(QSize(120, 50));
|
||||||
|
|
@ -136,11 +158,21 @@ public:
|
||||||
|
|
||||||
horizontalLayout->addWidget(openComButton);
|
horizontalLayout->addWidget(openComButton);
|
||||||
|
|
||||||
horizontalSpacer_5 = new QSpacerItem(20, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
LEDlabel = new QLabel(centralwidget);
|
||||||
|
LEDlabel->setObjectName(QString::fromUtf8("LEDlabel"));
|
||||||
|
LEDlabel->setMinimumSize(QSize(32, 32));
|
||||||
|
LEDlabel->setMaximumSize(QSize(32, 32));
|
||||||
|
LEDlabel->setStyleSheet(QString::fromUtf8("border-radius: 16px;\n"
|
||||||
|
"background-color: red;\n"
|
||||||
|
"border:1px solid rgba(168, 168, 168, 105);"));
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(LEDlabel);
|
||||||
|
|
||||||
|
horizontalSpacer_5 = new QSpacerItem(50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
|
||||||
horizontalLayout->addItem(horizontalSpacer_5);
|
horizontalLayout->addItem(horizontalSpacer_5);
|
||||||
|
|
||||||
testButton = new QPushButton(MainWindow);
|
testButton = new QPushButton(centralwidget);
|
||||||
testButton->setObjectName(QString::fromUtf8("testButton"));
|
testButton->setObjectName(QString::fromUtf8("testButton"));
|
||||||
testButton->setMinimumSize(QSize(50, 50));
|
testButton->setMinimumSize(QSize(50, 50));
|
||||||
testButton->setMaximumSize(QSize(50, 50));
|
testButton->setMaximumSize(QSize(50, 50));
|
||||||
|
|
@ -149,57 +181,151 @@ public:
|
||||||
|
|
||||||
horizontalLayout->addWidget(testButton);
|
horizontalLayout->addWidget(testButton);
|
||||||
|
|
||||||
horizontalSpacer_2 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
horizontalSpacer_2 = new QSpacerItem(20, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
horizontalLayout->addItem(horizontalSpacer_2);
|
horizontalLayout->addItem(horizontalSpacer_2);
|
||||||
|
|
||||||
|
|
||||||
verticalLayout_3->addLayout(horizontalLayout);
|
verticalLayout->addLayout(horizontalLayout);
|
||||||
|
|
||||||
horizontalLayout_2 = new QHBoxLayout();
|
horizontalLayout_2 = new QHBoxLayout();
|
||||||
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
|
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
|
||||||
verticalLayout = new QVBoxLayout();
|
stackedWidget = new QStackedWidget(centralwidget);
|
||||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
|
||||||
|
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
sizePolicy.setHorizontalStretch(0);
|
||||||
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
sizePolicy.setHeightForWidth(stackedWidget->sizePolicy().hasHeightForWidth());
|
||||||
|
stackedWidget->setSizePolicy(sizePolicy);
|
||||||
|
stackedWidget->setMaximumSize(QSize(400, 16777215));
|
||||||
|
stackedWidget->setStyleSheet(QString::fromUtf8("background-color: rgb(217, 235, 255);"));
|
||||||
|
page = new QWidget();
|
||||||
|
page->setObjectName(QString::fromUtf8("page"));
|
||||||
|
verticalLayout_7 = new QVBoxLayout(page);
|
||||||
|
verticalLayout_7->setObjectName(QString::fromUtf8("verticalLayout_7"));
|
||||||
|
verticalLayout_7->setContentsMargins(0, 0, 0, 0);
|
||||||
|
verticalLayout_3 = new QVBoxLayout();
|
||||||
|
verticalLayout_3->setSpacing(9);
|
||||||
|
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
|
||||||
|
horizontalLayout_5 = new QHBoxLayout();
|
||||||
|
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
|
||||||
|
label_8 = new QLabel(page);
|
||||||
|
label_8->setObjectName(QString::fromUtf8("label_8"));
|
||||||
|
label_8->setMinimumSize(QSize(140, 20));
|
||||||
|
label_8->setMaximumSize(QSize(140, 20));
|
||||||
|
label_8->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
|
|
||||||
|
horizontalLayout_5->addWidget(label_8);
|
||||||
|
|
||||||
|
SocketClientNum_Label = new QLabel(page);
|
||||||
|
SocketClientNum_Label->setObjectName(QString::fromUtf8("SocketClientNum_Label"));
|
||||||
|
SocketClientNum_Label->setMinimumSize(QSize(50, 0));
|
||||||
|
SocketClientNum_Label->setMaximumSize(QSize(50, 20));
|
||||||
|
QFont font;
|
||||||
|
font.setFamily(QString::fromUtf8("Arial Black"));
|
||||||
|
SocketClientNum_Label->setFont(font);
|
||||||
|
|
||||||
|
horizontalLayout_5->addWidget(SocketClientNum_Label);
|
||||||
|
|
||||||
|
horizontalSpacer_6 = new QSpacerItem(140, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
horizontalLayout_5->addItem(horizontalSpacer_6);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_3->addLayout(horizontalLayout_5);
|
||||||
|
|
||||||
|
SocketLog_TextBrowser = new QTextBrowser(page);
|
||||||
|
SocketLog_TextBrowser->setObjectName(QString::fromUtf8("SocketLog_TextBrowser"));
|
||||||
|
SocketLog_TextBrowser->setMaximumSize(QSize(400, 200));
|
||||||
|
SocketLog_TextBrowser->setStyleSheet(QString::fromUtf8("background-color: rgba(232, 232, 232, 100);"));
|
||||||
|
|
||||||
|
verticalLayout_3->addWidget(SocketLog_TextBrowser);
|
||||||
|
|
||||||
horizontalLayout_3 = new QHBoxLayout();
|
horizontalLayout_3 = new QHBoxLayout();
|
||||||
horizontalLayout_3->setSpacing(6);
|
horizontalLayout_3->setSpacing(6);
|
||||||
horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
|
horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
|
||||||
label_4 = new QLabel(MainWindow);
|
label_4 = new QLabel(page);
|
||||||
label_4->setObjectName(QString::fromUtf8("label_4"));
|
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||||
label_4->setMinimumSize(QSize(0, 20));
|
label_4->setMinimumSize(QSize(150, 20));
|
||||||
label_4->setMaximumSize(QSize(100, 20));
|
label_4->setMaximumSize(QSize(150, 20));
|
||||||
|
|
||||||
horizontalLayout_3->addWidget(label_4);
|
horizontalLayout_3->addWidget(label_4);
|
||||||
|
|
||||||
upflagLabel = new QLabel(MainWindow);
|
horizontalSpacer_3 = new QSpacerItem(150, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
upflagLabel->setObjectName(QString::fromUtf8("upflagLabel"));
|
|
||||||
upflagLabel->setMinimumSize(QSize(70, 20));
|
|
||||||
upflagLabel->setMaximumSize(QSize(80, 20));
|
|
||||||
|
|
||||||
horizontalLayout_3->addWidget(upflagLabel);
|
|
||||||
|
|
||||||
horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
||||||
|
|
||||||
horizontalLayout_3->addItem(horizontalSpacer_3);
|
horizontalLayout_3->addItem(horizontalSpacer_3);
|
||||||
|
|
||||||
|
|
||||||
verticalLayout->addLayout(horizontalLayout_3);
|
verticalLayout_3->addLayout(horizontalLayout_3);
|
||||||
|
|
||||||
resultTable = new QTableView(MainWindow);
|
Rfid_textBrowser = new QTextBrowser(page);
|
||||||
|
Rfid_textBrowser->setObjectName(QString::fromUtf8("Rfid_textBrowser"));
|
||||||
|
Rfid_textBrowser->setMaximumSize(QSize(400, 16777215));
|
||||||
|
Rfid_textBrowser->setStyleSheet(QString::fromUtf8("background-color: rgba(232, 232, 232, 100);"));
|
||||||
|
|
||||||
|
verticalLayout_3->addWidget(Rfid_textBrowser);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_7->addLayout(verticalLayout_3);
|
||||||
|
|
||||||
|
stackedWidget->addWidget(page);
|
||||||
|
page_2 = new QWidget();
|
||||||
|
page_2->setObjectName(QString::fromUtf8("page_2"));
|
||||||
|
verticalLayout_6 = new QVBoxLayout(page_2);
|
||||||
|
verticalLayout_6->setObjectName(QString::fromUtf8("verticalLayout_6"));
|
||||||
|
verticalLayout_6->setContentsMargins(0, 0, 0, 0);
|
||||||
|
horizontalLayout_6 = new QHBoxLayout();
|
||||||
|
horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
|
||||||
|
verticalLayout_4 = new QVBoxLayout();
|
||||||
|
verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4"));
|
||||||
|
horizontalLayout_7 = new QHBoxLayout();
|
||||||
|
horizontalLayout_7->setSpacing(6);
|
||||||
|
horizontalLayout_7->setObjectName(QString::fromUtf8("horizontalLayout_7"));
|
||||||
|
label_6 = new QLabel(page_2);
|
||||||
|
label_6->setObjectName(QString::fromUtf8("label_6"));
|
||||||
|
label_6->setMinimumSize(QSize(0, 20));
|
||||||
|
label_6->setMaximumSize(QSize(100, 20));
|
||||||
|
|
||||||
|
horizontalLayout_7->addWidget(label_6);
|
||||||
|
|
||||||
|
upflagLabel = new QLabel(page_2);
|
||||||
|
upflagLabel->setObjectName(QString::fromUtf8("upflagLabel"));
|
||||||
|
upflagLabel->setMinimumSize(QSize(50, 20));
|
||||||
|
upflagLabel->setMaximumSize(QSize(50, 20));
|
||||||
|
|
||||||
|
horizontalLayout_7->addWidget(upflagLabel);
|
||||||
|
|
||||||
|
horizontalSpacer_7 = new QSpacerItem(180, 20, QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
horizontalLayout_7->addItem(horizontalSpacer_7);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_4->addLayout(horizontalLayout_7);
|
||||||
|
|
||||||
|
resultTable = new QTableView(page_2);
|
||||||
resultTable->setObjectName(QString::fromUtf8("resultTable"));
|
resultTable->setObjectName(QString::fromUtf8("resultTable"));
|
||||||
resultTable->setMinimumSize(QSize(220, 0));
|
resultTable->setMinimumSize(QSize(220, 0));
|
||||||
resultTable->setMaximumSize(QSize(220, 16777215));
|
resultTable->setMaximumSize(QSize(400, 16777215));
|
||||||
resultTable->setStyleSheet(QString::fromUtf8(""));
|
resultTable->setStyleSheet(QString::fromUtf8(""));
|
||||||
|
|
||||||
verticalLayout->addWidget(resultTable);
|
verticalLayout_4->addWidget(resultTable);
|
||||||
|
|
||||||
|
|
||||||
horizontalLayout_2->addLayout(verticalLayout);
|
horizontalLayout_6->addLayout(verticalLayout_4);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_6->addLayout(horizontalLayout_6);
|
||||||
|
|
||||||
|
stackedWidget->addWidget(page_2);
|
||||||
|
|
||||||
|
horizontalLayout_2->addWidget(stackedWidget);
|
||||||
|
|
||||||
verticalLayout_2 = new QVBoxLayout();
|
verticalLayout_2 = new QVBoxLayout();
|
||||||
|
verticalLayout_2->setSpacing(9);
|
||||||
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
|
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
|
||||||
horizontalLayout_4 = new QHBoxLayout();
|
horizontalLayout_4 = new QHBoxLayout();
|
||||||
horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
|
horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
|
||||||
label_5 = new QLabel(MainWindow);
|
label_5 = new QLabel(centralwidget);
|
||||||
label_5->setObjectName(QString::fromUtf8("label_5"));
|
label_5->setObjectName(QString::fromUtf8("label_5"));
|
||||||
label_5->setMinimumSize(QSize(50, 20));
|
label_5->setMinimumSize(QSize(50, 20));
|
||||||
label_5->setMaximumSize(QSize(100, 20));
|
label_5->setMaximumSize(QSize(100, 20));
|
||||||
|
|
@ -214,47 +340,82 @@ public:
|
||||||
|
|
||||||
verticalLayout_2->addLayout(horizontalLayout_4);
|
verticalLayout_2->addLayout(horizontalLayout_4);
|
||||||
|
|
||||||
textBrowser = new QTextBrowser(MainWindow);
|
Log_TextBrowser = new QTextBrowser(centralwidget);
|
||||||
textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
|
Log_TextBrowser->setObjectName(QString::fromUtf8("Log_TextBrowser"));
|
||||||
textBrowser->setMinimumSize(QSize(700, 0));
|
Log_TextBrowser->setMinimumSize(QSize(650, 0));
|
||||||
QFont font;
|
Log_TextBrowser->setStyleSheet(QString::fromUtf8("background-color: rgba(232, 232, 232, 100);"));
|
||||||
font.setFamily(QString::fromUtf8("Arial"));
|
|
||||||
font.setPointSize(9);
|
|
||||||
font.setBold(false);
|
|
||||||
font.setWeight(50);
|
|
||||||
textBrowser->setFont(font);
|
|
||||||
textBrowser->setStyleSheet(QString::fromUtf8("background-color: rgba(232, 232, 232, 100);"));
|
|
||||||
|
|
||||||
verticalLayout_2->addWidget(textBrowser);
|
verticalLayout_2->addWidget(Log_TextBrowser);
|
||||||
|
|
||||||
|
|
||||||
horizontalLayout_2->addLayout(verticalLayout_2);
|
horizontalLayout_2->addLayout(verticalLayout_2);
|
||||||
|
|
||||||
|
|
||||||
verticalLayout_3->addLayout(horizontalLayout_2);
|
verticalLayout->addLayout(horizontalLayout_2);
|
||||||
|
|
||||||
|
MainWindow->setCentralWidget(centralwidget);
|
||||||
|
menubar = new QMenuBar(MainWindow);
|
||||||
|
menubar->setObjectName(QString::fromUtf8("menubar"));
|
||||||
|
menubar->setGeometry(QRect(0, 0, 1000, 22));
|
||||||
|
menubar->setStyleSheet(QString::fromUtf8(""));
|
||||||
|
menu = new QMenu(menubar);
|
||||||
|
menu->setObjectName(QString::fromUtf8("menu"));
|
||||||
|
menu->setStyleSheet(QString::fromUtf8("background-color: rgb(155, 208, 255);"));
|
||||||
|
run_model = new QMenu(menu);
|
||||||
|
run_model->setObjectName(QString::fromUtf8("run_model"));
|
||||||
|
MainWindow->setMenuBar(menubar);
|
||||||
|
statusbar = new QStatusBar(MainWindow);
|
||||||
|
statusbar->setObjectName(QString::fromUtf8("statusbar"));
|
||||||
|
statusbar->setMouseTracking(false);
|
||||||
|
MainWindow->setStatusBar(statusbar);
|
||||||
|
|
||||||
|
menubar->addAction(menu->menuAction());
|
||||||
|
menu->addAction(run_model->menuAction());
|
||||||
|
menu->addSeparator();
|
||||||
|
menu->addAction(actionset);
|
||||||
|
menu->addSeparator();
|
||||||
|
menu->addAction(actionshibiefuzhu);
|
||||||
|
menu->addSeparator();
|
||||||
|
menu->addAction(actionchuankou);
|
||||||
|
run_model->addAction(relay);
|
||||||
|
run_model->addAction(identify);
|
||||||
|
|
||||||
retranslateUi(MainWindow);
|
retranslateUi(MainWindow);
|
||||||
|
|
||||||
|
stackedWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(MainWindow);
|
QMetaObject::connectSlotsByName(MainWindow);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
void retranslateUi(QWidget *MainWindow)
|
void retranslateUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr));
|
MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "mainwindow", nullptr));
|
||||||
|
actionset->setText(QCoreApplication::translate("MainWindow", "\346\216\245\345\217\243\350\256\276\347\275\256", nullptr));
|
||||||
|
actionshibiefuzhu->setText(QCoreApplication::translate("MainWindow", "\344\270\262\345\217\243\350\256\276\347\275\256", nullptr));
|
||||||
|
actionchuankou->setText(QCoreApplication::translate("MainWindow", "\350\257\206\345\210\253\350\276\205\345\212\251", nullptr));
|
||||||
|
identify->setText(QCoreApplication::translate("MainWindow", "\350\257\206\345\210\253\346\250\241\345\274\217", nullptr));
|
||||||
|
relay->setText(QCoreApplication::translate("MainWindow", "\350\275\254\345\217\221\346\250\241\345\274\217", nullptr));
|
||||||
label->setText(QCoreApplication::translate("MainWindow", "\344\270\262\345\217\243\345\217\267:", nullptr));
|
label->setText(QCoreApplication::translate("MainWindow", "\344\270\262\345\217\243\345\217\267:", nullptr));
|
||||||
label_2->setText(QCoreApplication::translate("MainWindow", "\346\263\242\347\211\271\347\216\207:", nullptr));
|
label_2->setText(QCoreApplication::translate("MainWindow", "\346\263\242\347\211\271\347\216\207:", nullptr));
|
||||||
BTBox->setItemText(0, QCoreApplication::translate("MainWindow", "9600", nullptr));
|
BTBox->setItemText(0, QCoreApplication::translate("MainWindow", "9600", nullptr));
|
||||||
BTBox->setItemText(1, QCoreApplication::translate("MainWindow", "19200", nullptr));
|
BTBox->setItemText(1, QCoreApplication::translate("MainWindow", "19200", nullptr));
|
||||||
BTBox->setItemText(2, QCoreApplication::translate("MainWindow", "115200", nullptr));
|
BTBox->setItemText(2, QCoreApplication::translate("MainWindow", "115200", nullptr));
|
||||||
|
|
||||||
label_3->setText(QCoreApplication::translate("MainWindow", "\350\202\241\351\201\223\345\220\215:", nullptr));
|
|
||||||
LEDlabel->setText(QString());
|
|
||||||
openComButton->setText(QCoreApplication::translate("MainWindow", "\346\211\223\345\274\200\344\270\262\345\217\243", nullptr));
|
openComButton->setText(QCoreApplication::translate("MainWindow", "\346\211\223\345\274\200\344\270\262\345\217\243", nullptr));
|
||||||
|
LEDlabel->setText(QString());
|
||||||
testButton->setText(QCoreApplication::translate("MainWindow", "\346\265\213\350\257\225", nullptr));
|
testButton->setText(QCoreApplication::translate("MainWindow", "\346\265\213\350\257\225", nullptr));
|
||||||
label_4->setText(QCoreApplication::translate("MainWindow", "\350\257\206\345\210\253\347\273\223\346\236\234:", nullptr));
|
label_8->setText(QCoreApplication::translate("MainWindow", "\345\256\242\346\210\267\347\253\257\351\223\276\346\216\245\346\225\260:", nullptr));
|
||||||
upflagLabel->setText(QCoreApplication::translate("MainWindow", "\344\270\215\344\270\212\344\274\240", nullptr));
|
SocketClientNum_Label->setText(QCoreApplication::translate("MainWindow", "0", nullptr));
|
||||||
|
label_4->setText(QCoreApplication::translate("MainWindow", "\350\275\254\345\217\221\344\277\241\346\201\257:", nullptr));
|
||||||
|
label_6->setText(QCoreApplication::translate("MainWindow", "\350\257\206\345\210\253\347\273\223\346\236\234:", nullptr));
|
||||||
|
upflagLabel->setText(QCoreApplication::translate("MainWindow", "\344\270\215\344\274\240", nullptr));
|
||||||
label_5->setText(QCoreApplication::translate("MainWindow", "\346\227\245\345\277\227:", nullptr));
|
label_5->setText(QCoreApplication::translate("MainWindow", "\346\227\245\345\277\227:", nullptr));
|
||||||
|
menu->setTitle(QCoreApplication::translate("MainWindow", "\350\256\276\347\275\256", nullptr));
|
||||||
|
run_model->setTitle(QCoreApplication::translate("MainWindow", "\350\257\206\345\210\253\346\250\241\345\274\217", nullptr));
|
||||||
|
#if QT_CONFIG(statustip)
|
||||||
|
statusbar->setStatusTip(QString());
|
||||||
|
#endif // QT_CONFIG(statustip)
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
MQueue<QString> *queueWarnInfo,
|
MQueue<QString> *queueWarnInfo,
|
||||||
|
MQueue<QString> *queueRFID,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
QThread(parent)
|
QThread(parent)
|
||||||
{
|
{
|
||||||
|
|
@ -15,6 +16,10 @@ ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals(errorMessage);
|
emit this->ErrorSignals(errorMessage);
|
||||||
}
|
}
|
||||||
|
if (!ConfigUtil::readSerialConfig(g_config_path, errorMessage, this->serialConfig_))
|
||||||
|
{
|
||||||
|
emit this->ErrorSignals(errorMessage);
|
||||||
|
}
|
||||||
if (!ConfigUtil::readSocketServerConfig(g_config_path, errorMessage, this->socketServerConfig_))
|
if (!ConfigUtil::readSocketServerConfig(g_config_path, errorMessage, this->socketServerConfig_))
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals(errorMessage);
|
emit this->ErrorSignals(errorMessage);
|
||||||
|
|
@ -26,6 +31,7 @@ ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
|
|
||||||
this->queueTrainInfo_ = queueTrainInfo;
|
this->queueTrainInfo_ = queueTrainInfo;
|
||||||
this->queueWarnInfo_ = queueWarnInfo;
|
this->queueWarnInfo_ = queueWarnInfo;
|
||||||
|
this->queueRFID_ = queueRFID;
|
||||||
|
|
||||||
this->logRfidRecvName = "./Logs/rfid_data.txt";
|
this->logRfidRecvName = "./Logs/rfid_data.txt";
|
||||||
this->recvLog.setFileName(logRfidRecvName);
|
this->recvLog.setFileName(logRfidRecvName);
|
||||||
|
|
@ -57,11 +63,11 @@ ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
connect(this->tcpClient, &TcpClient::sendTcpInfoSignals, this, [=](const QString& info){
|
connect(this->tcpClient, &TcpClient::sendTcpInfoSignals, this, [=](const QString& info){
|
||||||
emit this->InfoSignals(info);
|
emit this->InfoSignals(info);
|
||||||
emit this->statusInfoUpdate(info);
|
emit this->statusInfoUpdate(info);
|
||||||
if (info == "链接服务端超时"
|
if (info == "链接辅助识别服务超时"
|
||||||
|| info == "未连接Socket服务器"
|
|| info == "未连接辅助识别服务"
|
||||||
|| info == "链接服务端失败"
|
|| info == "链接辅助识别服务失败"
|
||||||
|| info == "服务端断开连接"
|
|| info == "辅助识别服务断开连接"
|
||||||
|| info == "链接服务端失败")
|
|| info == "链接辅助识别服务失败")
|
||||||
{
|
{
|
||||||
this->videoHasTrain = false;
|
this->videoHasTrain = false;
|
||||||
}
|
}
|
||||||
|
|
@ -78,14 +84,14 @@ ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
{
|
{
|
||||||
emit this->InfoSignals("视频车号识别-来车了");
|
emit this->InfoSignals("视频车号识别-来车了");
|
||||||
this->videoHasTrain = true;
|
this->videoHasTrain = true;
|
||||||
emit this->IdentifyType();
|
emit IdentifyType();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->InfoSignals("视频车号识别-火车离开了");
|
emit this->InfoSignals("视频车号识别-火车离开了");
|
||||||
this->videoHasTrain = false;
|
this->videoHasTrain = false;
|
||||||
if (this->needIdentify)
|
if (this->needIdentify)
|
||||||
emit this->IdentifyType();
|
emit IdentifyType();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(this->tcpClient, &TcpClient::getDirectionSignals, this, [=](int direction) {
|
connect(this->tcpClient, &TcpClient::getDirectionSignals, this, [=](int direction) {
|
||||||
|
|
@ -98,7 +104,7 @@ ReadComThread::ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadComThread::run()
|
[[noreturn]] void ReadComThread::run()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
@ -124,14 +130,14 @@ void ReadComThread::openCom(const bool &type, const int &msec)
|
||||||
{
|
{
|
||||||
this->auto_reconnect_serial_ = true;
|
this->auto_reconnect_serial_ = true;
|
||||||
this->serial_ = new QSerialPort(this);
|
this->serial_ = new QSerialPort(this);
|
||||||
if (this->comDetect_->openCom(this->serial_, this->baseConfig_.comName, this->baseConfig_.baud))
|
if (this->comDetect_->openCom(this->serial_, this->serialConfig_.comName, this->serialConfig_.baud))
|
||||||
{
|
{
|
||||||
QString logs;
|
QString logs;
|
||||||
logs.append("串口打开成功\n");
|
logs.append("串口打开成功\n");
|
||||||
logs.append("串口号:" + this->baseConfig_.comName + "\n");
|
logs.append("串口号:" + this->serialConfig_.comName + "\n");
|
||||||
logs.append("波特率:" + QString::number(this->baseConfig_.baud) + "\n");
|
logs.append("波特率:" + QString::number(this->serialConfig_.baud) + "\n");
|
||||||
if (this->baseConfig_.havaMagnetSteel)
|
if (this->serialConfig_.havaMagnetSteel)
|
||||||
logs.append("磁钢顺序:" + this->baseConfig_.magnetSteelOrder);
|
logs.append("磁钢顺序:" + this->serialConfig_.magnetSteelOrder);
|
||||||
this->isOpenCom = true;
|
this->isOpenCom = true;
|
||||||
emit this->InfoSignals(logs);
|
emit this->InfoSignals(logs);
|
||||||
|
|
||||||
|
|
@ -183,7 +189,7 @@ void ReadComThread::readCom()
|
||||||
if(!data.isEmpty())
|
if(!data.isEmpty())
|
||||||
{
|
{
|
||||||
this->queue_.push(QString(data));
|
this->queue_.push(QString(data));
|
||||||
emit this->getRfid_signals();
|
emit getRfid_signals();
|
||||||
}
|
}
|
||||||
data.clear();
|
data.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +215,7 @@ void ReadComThread::readTestInfo(const QString &filePath) {
|
||||||
while(!in.atEnd()) {
|
while(!in.atEnd()) {
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
this->queue_.push(line);
|
this->queue_.push(line);
|
||||||
emit this->getRfid_signals();
|
emit getRfid_signals();
|
||||||
}
|
}
|
||||||
// 关闭文件
|
// 关闭文件
|
||||||
file.close();
|
file.close();
|
||||||
|
|
@ -228,6 +234,32 @@ void ReadComThread::getQueueDataThread()
|
||||||
QString strRfidInfo = this->queue_.getTop();
|
QString strRfidInfo = this->queue_.getTop();
|
||||||
this->queue_.pop();
|
this->queue_.pop();
|
||||||
this->saveRfidLog(strRfidInfo);
|
this->saveRfidLog(strRfidInfo);
|
||||||
|
|
||||||
|
auto split_lambda = [=](const QString& strFirst, const QString& strOther){
|
||||||
|
if (strFirst == "0")
|
||||||
|
{
|
||||||
|
this->rfidHasTrain = false;
|
||||||
|
emit this->InfoSignals("RFID-火车离开了");
|
||||||
|
// 关功放信号
|
||||||
|
// 需要结合 “来车状态”广播消息,确认是否真的车离开了; TODO:没有真离开,则向串口发送 @on& 避免关功放
|
||||||
|
emit IdentifyType();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: 此处按照4个磁钢来配置,可能存在一定限制; 另外逻辑需要优化
|
||||||
|
if (strOther == "000000" // 第一次检测来车时(前提是上一次功放已关闭)
|
||||||
|
&& (strFirst == this->serialConfig_.magnetSteelOrder.left(1)
|
||||||
|
|| strFirst == this->serialConfig_.magnetSteelOrder.mid(1, 1)))
|
||||||
|
{
|
||||||
|
this->rfidHasTrain = true;
|
||||||
|
emit this->InfoSignals("RFID-来车了");
|
||||||
|
emit IdentifyType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this->baseConfig_.runModel == ai_matrix::IDENTIFY_MODEL)
|
||||||
|
{
|
||||||
this->tmpRfid.append(strRfidInfo);
|
this->tmpRfid.append(strRfidInfo);
|
||||||
if (this->tmpRfid.right(1) != "&")
|
if (this->tmpRfid.right(1) != "&")
|
||||||
{
|
{
|
||||||
|
|
@ -238,29 +270,6 @@ void ReadComThread::getQueueDataThread()
|
||||||
QStringList rfidSubList = this->tmpRfid.split("@");
|
QStringList rfidSubList = this->tmpRfid.split("@");
|
||||||
this->tmpRfid = "";
|
this->tmpRfid = "";
|
||||||
|
|
||||||
auto split_lambda = [=](QString strFirst, QString strOther){
|
|
||||||
if (strFirst == "0")
|
|
||||||
{
|
|
||||||
this->rfidHasTrain = false;
|
|
||||||
emit this->InfoSignals("RFID-火车离开了");
|
|
||||||
// 关功放信号
|
|
||||||
// 需要结合 “来车状态”广播消息,确认是否真的车离开了; TODO:没有真离开,则向串口发送 @on& 避免关功放
|
|
||||||
emit this->IdentifyType();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: 此处按照4个磁钢来配置,可能存在一定限制; 另外逻辑需要优化
|
|
||||||
if (strOther == "000000" // 第一次检测来车时(前提是上一次功放已关闭)
|
|
||||||
&& (strFirst == this->baseConfig_.magnetSteelOrder.left(1)
|
|
||||||
|| strFirst == this->baseConfig_.magnetSteelOrder.mid(1, 1)))
|
|
||||||
{
|
|
||||||
this->rfidHasTrain = true;
|
|
||||||
emit this->InfoSignals("RFID-来车了");
|
|
||||||
emit this->IdentifyType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const auto & i : rfidSubList)
|
for (const auto & i : rfidSubList)
|
||||||
{
|
{
|
||||||
if (i.size() == 26 || i.size() == 24)
|
if (i.size() == 26 || i.size() == 24)
|
||||||
|
|
@ -274,9 +283,9 @@ void ReadComThread::getQueueDataThread()
|
||||||
// 判断是否是车头 车头的第14位是 K或H (慎重)
|
// 判断是否是车头 车头的第14位是 K或H (慎重)
|
||||||
if (!i.mid(14, 1).contains(QRegExp("^[0-9]+$"))) continue;
|
if (!i.mid(14, 1).contains(QRegExp("^[0-9]+$"))) continue;
|
||||||
// 过滤掉车号中有非数字的
|
// 过滤掉车号中有非数字的
|
||||||
if (!strTrainInfo.right(7).contains(QRegExp("^[0-9]+$"))) continue;
|
// if (!strTrainInfo.right(7).contains(QRegExp("^[0-9]+$"))) continue;
|
||||||
// 因信号不稳定 增加一行过滤 出现读到的编号数据里 空格替代了实际字符的情况
|
// 因信号不稳定 增加一行过滤 出现读到的编号数据里 空格替代了实际字符的情况
|
||||||
if (strTrainInfo.right(7).simplified().size() < 7) continue;
|
// if (strTrainInfo.right(7).simplified().size() < 7) continue;
|
||||||
|
|
||||||
vecTrain.append(strTrainInfo);
|
vecTrain.append(strTrainInfo);
|
||||||
int train_order = vecTrain.size();
|
int train_order = vecTrain.size();
|
||||||
|
|
@ -287,13 +296,13 @@ void ReadComThread::getQueueDataThread()
|
||||||
this->rfidSourceInfo.append("@" + i);
|
this->rfidSourceInfo.append("@" + i);
|
||||||
QString rfidinfo = this->rfidSourceInfo;
|
QString rfidinfo = this->rfidSourceInfo;
|
||||||
this->rfidSourceInfo = "";
|
this->rfidSourceInfo = "";
|
||||||
emit this->upRfid_signals(rfidinfo);
|
emit upRfid_signals(rfidinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i.size() == 7)
|
else if (i.size() == 7)
|
||||||
{
|
{
|
||||||
// 不使用磁钢的情况下 过滤掉磁钢信号
|
// 不使用磁钢的情况下 过滤掉磁钢信号
|
||||||
if (!this->baseConfig_.havaMagnetSteel) continue;
|
if (!this->serialConfig_.havaMagnetSteel) continue;
|
||||||
// 磁钢信号
|
// 磁钢信号
|
||||||
QString strFirst = i.left(1);
|
QString strFirst = i.left(1);
|
||||||
QString strOther = i.mid(1, i.size() - 1);
|
QString strOther = i.mid(1, i.size() - 1);
|
||||||
|
|
@ -304,7 +313,7 @@ void ReadComThread::getQueueDataThread()
|
||||||
else if (i.size() == 14) // 特殊情况,来车信号少了&符
|
else if (i.size() == 14) // 特殊情况,来车信号少了&符
|
||||||
{
|
{
|
||||||
// 不使用磁钢的情况下 过滤掉磁钢信号
|
// 不使用磁钢的情况下 过滤掉磁钢信号
|
||||||
if (!this->baseConfig_.havaMagnetSteel) continue;
|
if (!this->serialConfig_.havaMagnetSteel) continue;
|
||||||
for (int j = 0; j < i.size(); j+=7) {
|
for (int j = 0; j < i.size(); j+=7) {
|
||||||
QString rfid_cg = i.mid(j, 7);
|
QString rfid_cg = i.mid(j, 7);
|
||||||
QString strFirst = rfid_cg.left(1);
|
QString strFirst = rfid_cg.left(1);
|
||||||
|
|
@ -316,6 +325,33 @@ void ReadComThread::getQueueDataThread()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (this->baseConfig_.runModel == ai_matrix::RELAY_MODEL)
|
||||||
|
{
|
||||||
|
this->queueRFID_->push(strRfidInfo);
|
||||||
|
|
||||||
|
this->tmpRfid.append(strRfidInfo);
|
||||||
|
if (this->tmpRfid.right(1) != "&")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->tmpRfid = this->tmpRfid.replace("&", "");
|
||||||
|
QStringList rfidSubList = this->tmpRfid.split("@");
|
||||||
|
this->tmpRfid = "";
|
||||||
|
for (const auto & i : rfidSubList)
|
||||||
|
{
|
||||||
|
if (i.size() == 7)
|
||||||
|
{
|
||||||
|
// 不使用磁钢的情况下 过滤掉磁钢信号
|
||||||
|
if (!this->serialConfig_.havaMagnetSteel) continue;
|
||||||
|
// 磁钢信号
|
||||||
|
QString strFirst = i.left(1);
|
||||||
|
QString strOther = i.mid(1, i.size() - 1);
|
||||||
|
split_lambda(strFirst, strOther);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ReadComThread::IdentifyTypeUpdate() {
|
void ReadComThread::IdentifyTypeUpdate() {
|
||||||
if (this->rfidHasTrain || this->videoHasTrain)
|
if (this->rfidHasTrain || this->videoHasTrain)
|
||||||
|
|
@ -328,13 +364,14 @@ void ReadComThread::IdentifyTypeUpdate() {
|
||||||
this->needIdentify = true;
|
this->needIdentify = true;
|
||||||
this->trainTime = this->getSystemTime();
|
this->trainTime = this->getSystemTime();
|
||||||
emit this->comeTrain(false);
|
emit this->comeTrain(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!this->rfidHasTrain && !this->videoHasTrain)
|
else if (!this->rfidHasTrain && !this->videoHasTrain)
|
||||||
{
|
{
|
||||||
if (this->vecTrain.size() < this->deviceWarnConfig_.min_train_size
|
if (this->vecTrain.size() < this->deviceWarnConfig_.min_train_size
|
||||||
&& this->iDirection > 0
|
&& this->iDirection > 0
|
||||||
&& (this->rfidSourceInfo.size() > 128 || this->vecTrain.size() > 1))
|
&& (this->rfidSourceInfo.size() > 192 || this->vecTrain.size() > 1))
|
||||||
this->queueWarnInfo_->push("火车驶过,疑似RFID设备故障,读取到的车厢号有丢失");
|
this->queueWarnInfo_->push("火车驶过,疑似RFID设备故障,读取到的车厢号有丢失");
|
||||||
this->initParam();
|
this->initParam();
|
||||||
emit this->InfoSignals("火车离开了");
|
emit this->InfoSignals("火车离开了");
|
||||||
|
|
@ -344,7 +381,7 @@ void ReadComThread::IdentifyTypeUpdate() {
|
||||||
void ReadComThread::upRfid(const QString &rfidInfo)
|
void ReadComThread::upRfid(const QString &rfidInfo)
|
||||||
{
|
{
|
||||||
if (!this->baseConfig_.upResult) return;
|
if (!this->baseConfig_.upResult) return;
|
||||||
if (!this->needIdentify && this->baseConfig_.havaMagnetSteel)
|
if (!this->needIdentify && this->serialConfig_.havaMagnetSteel)
|
||||||
{
|
{
|
||||||
emit upResultType(false);
|
emit upResultType(false);
|
||||||
return;
|
return;
|
||||||
|
|
@ -385,6 +422,11 @@ void ReadComThread::upRfid(const QString &rfidInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReadComThread::updateRunModel(int model)
|
||||||
|
{
|
||||||
|
this->baseConfig_.runModel = model;
|
||||||
|
}
|
||||||
|
|
||||||
bool ReadComThread::mkRfidLog()
|
bool ReadComThread::mkRfidLog()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,15 @@ class ReadComThread : public QThread{
|
||||||
public:
|
public:
|
||||||
ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
ReadComThread(MQueue<TrainInfo> *queueTrainInfo,
|
||||||
MQueue<QString> *queueWarnInfo,
|
MQueue<QString> *queueWarnInfo,
|
||||||
|
MQueue<QString> *queueRFID,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
~ReadComThread() {};
|
~ReadComThread() {};
|
||||||
void run() override;
|
|
||||||
|
[[noreturn]] void run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MQueue<TrainInfo> *queueTrainInfo_ = nullptr;
|
MQueue<TrainInfo> *queueTrainInfo_ = nullptr;
|
||||||
|
MQueue<QString> *queueRFID_ = nullptr;
|
||||||
MQueue<QString> *queueWarnInfo_ = nullptr;
|
MQueue<QString> *queueWarnInfo_ = nullptr;
|
||||||
MQueue<TrainInfo> queueTmpTrainInfo_{}; // RFID临时信息队列
|
MQueue<TrainInfo> queueTmpTrainInfo_{}; // RFID临时信息队列
|
||||||
QSerialPort *serial_; //串口
|
QSerialPort *serial_; //串口
|
||||||
|
|
@ -33,6 +36,7 @@ private:
|
||||||
QTimer timer_;
|
QTimer timer_;
|
||||||
|
|
||||||
ai_matrix::BaseConfig baseConfig_;
|
ai_matrix::BaseConfig baseConfig_;
|
||||||
|
ai_matrix::SerialConfig serialConfig_;
|
||||||
ai_matrix::SServerConfig socketServerConfig_;
|
ai_matrix::SServerConfig socketServerConfig_;
|
||||||
ai_matrix::DeviceWarnConfig deviceWarnConfig_;
|
ai_matrix::DeviceWarnConfig deviceWarnConfig_;
|
||||||
|
|
||||||
|
|
@ -44,9 +48,6 @@ private:
|
||||||
// 打开com口标志
|
// 打开com口标志
|
||||||
bool isOpenCom = false;
|
bool isOpenCom = false;
|
||||||
|
|
||||||
// RFID读取的数据队列
|
|
||||||
MQueue<QString> queue_{};
|
|
||||||
|
|
||||||
QString logRfidRecvName;
|
QString logRfidRecvName;
|
||||||
QFile recvLog;
|
QFile recvLog;
|
||||||
|
|
||||||
|
|
@ -58,6 +59,9 @@ private:
|
||||||
QString rfidSourceInfo;
|
QString rfidSourceInfo;
|
||||||
QString tmpRfid; //临时存储的RFID原始数据,用于防止接收的数据不完整
|
QString tmpRfid; //临时存储的RFID原始数据,用于防止接收的数据不完整
|
||||||
|
|
||||||
|
// RFID读取的数据队列
|
||||||
|
MQueue<QString> queue_ = {};
|
||||||
|
|
||||||
// 识别方向正确标志
|
// 识别方向正确标志
|
||||||
bool needIdentify = false;
|
bool needIdentify = false;
|
||||||
// RFID识别有火车标志
|
// RFID识别有火车标志
|
||||||
|
|
@ -104,8 +108,8 @@ public slots:
|
||||||
void getQueueDataThread();
|
void getQueueDataThread();
|
||||||
void IdentifyTypeUpdate();
|
void IdentifyTypeUpdate();
|
||||||
void upRfid(const QString &rfidInfo);
|
void upRfid(const QString &rfidInfo);
|
||||||
// void upWarn(const QString &warnInfo);
|
|
||||||
void tryToReconnect();
|
void tryToReconnect();
|
||||||
|
void updateRunModel(int model);
|
||||||
|
|
||||||
void readTestInfo(const QString &filePath);
|
void readTestInfo(const QString &filePath);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ UpResultThread::UpResultThread(MQueue<TrainInfo> *queueTrainInfo, QObject *paren
|
||||||
QString errorMessage = "";
|
QString errorMessage = "";
|
||||||
if (!ConfigUtil::readBaseConfig(g_config_path, errorMessage, this->baseConfig_))
|
if (!ConfigUtil::readBaseConfig(g_config_path, errorMessage, this->baseConfig_))
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals(errorMessage);
|
this->ErrorSignals(errorMessage);
|
||||||
}
|
}
|
||||||
if (!ConfigUtil::readInterfaceConfig(g_config_path, errorMessage, this->interfaceConfig_))
|
if (!ConfigUtil::readInterfaceConfig(g_config_path, errorMessage, this->interfaceConfig_))
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals(errorMessage);
|
this->ErrorSignals(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ bool UpResultThread::upWeb(TrainInfo &trainInfo)
|
||||||
Json::StreamWriterBuilder writer;
|
Json::StreamWriterBuilder writer;
|
||||||
std::string str = Json::writeString(writer, arrayObj);
|
std::string str = Json::writeString(writer, arrayObj);
|
||||||
|
|
||||||
emit this->InfoSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,发送web: " + QString::fromStdString(str));
|
this->InfoSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,发送web: " + QString::fromStdString(str));
|
||||||
httplib::Client cli(this->interfaceConfig_.httpIp.toStdString(), this->interfaceConfig_.httpPort);
|
httplib::Client cli(this->interfaceConfig_.httpIp.toStdString(), this->interfaceConfig_.httpPort);
|
||||||
|
|
||||||
cli.set_connection_timeout(3, 0);
|
cli.set_connection_timeout(3, 0);
|
||||||
|
|
@ -100,23 +100,23 @@ bool UpResultThread::upWeb(TrainInfo &trainInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (root["msg"].asString() == "请求未授权") {
|
if (root["msg"].asString() == "请求未授权") {
|
||||||
emit this->WarnSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,因请求未授权,而上传识别结果失败!重新请求token。");
|
this->WarnSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,因请求未授权,而上传识别结果失败!重新请求token。");
|
||||||
if (!this->getToken()) return false;
|
if (!this->getToken()) return false;
|
||||||
return this->upWeb(trainInfo);
|
return this->upWeb(trainInfo);
|
||||||
}
|
}
|
||||||
emit this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,原因:" + QString::fromStdString(root["msg"].asString()));
|
this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,原因:" + QString::fromStdString(root["msg"].asString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,返回数据解析异常,返回数据非json:" + QString::fromStdString(res->body));
|
this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,返回数据解析异常,返回数据非json:" + QString::fromStdString(res->body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,原因:" + QString::number(res->status) + " - " + QString::fromStdString(res->body));
|
this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,识别结果上传失败,原因:" + QString::number(res->status) + " - " + QString::fromStdString(res->body));
|
||||||
if (res->status == 401) {
|
if (res->status == 401) {
|
||||||
emit this->WarnSignals("因请求未授权,而上传识别结果失败!重新请求token。");
|
this->WarnSignals("因请求未授权,而上传识别结果失败!重新请求token。");
|
||||||
this->getToken();
|
this->getToken();
|
||||||
return this->upWeb(trainInfo);
|
return this->upWeb(trainInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -124,12 +124,12 @@ bool UpResultThread::upWeb(TrainInfo &trainInfo)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,上传数据失败,请检查网络,或者上传地址!");
|
this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,上传数据失败,请检查网络,或者上传地址!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,上传识别结果失败,原因:" + QString::fromStdString(e.what()));
|
this->ErrorSignals("第" + QString::fromStdString(trainInfo.strOrder) + "节,上传识别结果失败,原因:" + QString::fromStdString(e.what()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -173,17 +173,17 @@ bool UpResultThread::getToken()
|
||||||
this->webToken = root["token_type"].asString();
|
this->webToken = root["token_type"].asString();
|
||||||
this->webToken.append(" ");
|
this->webToken.append(" ");
|
||||||
this->webToken.append(root["access_token"].asString());
|
this->webToken.append(root["access_token"].asString());
|
||||||
emit this->InfoSignals("已获取到web token");
|
this->InfoSignals("已获取到web token");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("获取web token失败,原因:" + QString::fromStdString(res->body));
|
this->ErrorSignals("获取web token失败,原因:" + QString::fromStdString(res->body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("获取web token返回数据解析异常,返回数据非json。详细:" + QString::fromStdString(res->body));
|
this->ErrorSignals("获取web token返回数据解析异常,返回数据非json。详细:" + QString::fromStdString(res->body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,12 +193,12 @@ bool UpResultThread::getToken()
|
||||||
// if (err == httplib::Error::Connection) {
|
// if (err == httplib::Error::Connection) {
|
||||||
// std::cout << " (连接出错)" << std::endl;
|
// std::cout << " (连接出错)" << std::endl;
|
||||||
// }
|
// }
|
||||||
emit this->ErrorSignals("获取web token失败!请检查网络或请求地址。详细:" + QString::fromStdString(to_string(err)));
|
this->ErrorSignals("获取web token失败!请检查网络或请求地址。详细:" + QString::fromStdString(to_string(err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
emit this->ErrorSignals("获取授权失败,原因:" + QString::fromStdString(e.what()));
|
this->ErrorSignals("获取授权失败,原因:" + QString::fromStdString(e.what()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue