2024-02-29 06:20:06 +00:00
|
|
|
|
//
|
|
|
|
|
|
// Created by Mr.V on 2024/1/26.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TRAIN_RFID_CONFIGUTIL_H
|
|
|
|
|
|
#define TRAIN_RFID_CONFIGUTIL_H
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
#include <QTextCodec>
|
|
|
|
|
|
namespace ai_matrix {
|
|
|
|
|
|
struct BaseConfig {
|
|
|
|
|
|
// com口名称
|
|
|
|
|
|
QString comName;
|
|
|
|
|
|
// 波特率
|
|
|
|
|
|
int baud;
|
|
|
|
|
|
// 股道编号
|
|
|
|
|
|
int trackName;
|
2024-03-06 06:13:50 +00:00
|
|
|
|
// 是否有磁钢
|
|
|
|
|
|
bool havaMagnetSteel;
|
2024-02-29 06:20:06 +00:00
|
|
|
|
// 磁钢顺序
|
|
|
|
|
|
QString magnetSteelOrder;
|
|
|
|
|
|
// 上传识别结果标志
|
|
|
|
|
|
bool upResult;
|
2024-03-14 13:14:36 +00:00
|
|
|
|
// 使用socket来车通讯
|
|
|
|
|
|
bool useSocketServer;
|
2024-02-29 06:20:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct InterfaceConfig {
|
|
|
|
|
|
|
|
|
|
|
|
// 接口服务器IP
|
|
|
|
|
|
QString httpIp;
|
|
|
|
|
|
// 接口服务器端口
|
|
|
|
|
|
int httpPort;
|
|
|
|
|
|
// 获取token的方法
|
|
|
|
|
|
QString tokenPath;
|
|
|
|
|
|
// 上传识别结果的方法
|
|
|
|
|
|
QString upResultPath;
|
|
|
|
|
|
// 用户名
|
|
|
|
|
|
QString username;
|
|
|
|
|
|
// 密码
|
|
|
|
|
|
QString password;
|
|
|
|
|
|
};
|
2024-03-14 13:14:36 +00:00
|
|
|
|
|
|
|
|
|
|
struct SServerConfig {
|
|
|
|
|
|
// socket server IP
|
|
|
|
|
|
QString server_ip;
|
|
|
|
|
|
// server_port
|
|
|
|
|
|
int server_port;
|
2024-04-15 08:28:56 +00:00
|
|
|
|
// 识别结果延后X节上传,以等待Socket反馈火车运行方向
|
|
|
|
|
|
int delayed_upload;
|
2024-03-14 13:14:36 +00:00
|
|
|
|
};
|
2024-02-29 06:20:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigUtil {
|
|
|
|
|
|
public:
|
|
|
|
|
|
ConfigUtil();
|
|
|
|
|
|
~ConfigUtil();
|
|
|
|
|
|
|
|
|
|
|
|
static bool readBaseConfig(const QString& configFile, QString &errorMessage, ai_matrix::BaseConfig &config);
|
|
|
|
|
|
static bool readInterfaceConfig(const QString& configFile, QString &errorMessage, ai_matrix::InterfaceConfig &config);
|
2024-03-14 13:14:36 +00:00
|
|
|
|
static bool readSocketServerConfig(const QString& configFile, QString &errorMessage, ai_matrix::SServerConfig &config);
|
2024-02-29 06:20:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //TRAIN_RFID_CONFIGUTIL_H
|