68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
//
|
||
// 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;
|
||
// 是否有磁钢
|
||
bool havaMagnetSteel;
|
||
// 磁钢顺序
|
||
QString magnetSteelOrder;
|
||
// 上传识别结果标志
|
||
bool upResult;
|
||
// 使用socket来车通讯
|
||
bool useSocketServer;
|
||
};
|
||
|
||
struct InterfaceConfig {
|
||
|
||
// 接口服务器IP
|
||
QString httpIp;
|
||
// 接口服务器端口
|
||
int httpPort;
|
||
// 获取token的方法
|
||
QString tokenPath;
|
||
// 上传识别结果的方法
|
||
QString upResultPath;
|
||
// 用户名
|
||
QString username;
|
||
// 密码
|
||
QString password;
|
||
};
|
||
|
||
struct SServerConfig {
|
||
// socket server IP
|
||
QString server_ip;
|
||
// server_port
|
||
int server_port;
|
||
// 识别结果延后X节上传,以等待Socket反馈火车运行方向
|
||
int delayed_upload;
|
||
};
|
||
};
|
||
|
||
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);
|
||
static bool readSocketServerConfig(const QString& configFile, QString &errorMessage, ai_matrix::SServerConfig &config);
|
||
|
||
|
||
};
|
||
|
||
|
||
#endif //TRAIN_RFID_CONFIGUTIL_H
|