106 lines
2.6 KiB
C
Raw Normal View History

2026-06-26 17:55:15 +08:00
#ifndef IVR_DRONESCREWCTRL_CONFIG_H
#define IVR_DRONESCREWCTRL_CONFIG_H
#include <string>
#include <vector>
/**
* @brief Server IP + ZMQ + RTSP
*/
struct DroneScrewServerInfo
{
std::string serverIp{"192.168.1.10"}; // 板一 IP
int zmqControlPort{5555}; // REQ-REP 控制
int zmqResultPort{5556}; // PUB-SUB 检测结果
int zmqRawImagePort{5557}; // PUB-SUB 原始图像0=不订阅
int rtspPort{8554}; // RTSP
std::string rtspPath{"/live/dronescrew"};
std::string rtspUser;
std::string rtspPass;
bool rtspUseTcp{true};
};
/**
* @brief ZMQ
*/
struct DroneScrewAlgoUiParams
{
float scoreThreshold{0.5f};
float nmsThreshold{0.45f};
int inputWidth{640};
int inputHeight{640};
int modelType{0};
2026-07-03 14:19:06 +08:00
int expectedBoltCount{8};
2026-06-26 17:55:15 +08:00
};
/**
* @brief ZMQ
*
* config.xml (μs)
*/
struct DroneScrewCameraParams
{
double exposure{10000.0}; // 曝光时间(μs),默认 10000
double gain{1.0}; // 增益,默认 1.0
};
/**
* @brief
*/
struct DroneScrewDisplayOption
{
bool drawBoxes{true};
bool drawScores{true};
bool drawClassId{true};
int boxThickness{2};
int maxResultListItems{200};
};
/**
* @brief
*/
struct DroneScrewCtrlConfigResult
{
DroneScrewServerInfo server;
DroneScrewAlgoUiParams algo;
DroneScrewCameraParams camera;
DroneScrewDisplayOption display;
};
enum DroneScrewCtrlLoadCode
{
DRONE_CFG_OK = 0,
DRONE_CFG_FILE_NOT_FOUND = -1,
DRONE_CFG_PARSE_ERR = -2,
DRONE_CFG_INVALID_FMT = -3,
DRONE_CFG_UNKNOWN_ERR = -99,
};
/**
* @brief
*/
class IDroneScrewCtrlConfigNotify
{
public:
virtual ~IDroneScrewCtrlConfigNotify() = default;
virtual void OnConfigChanged(const DroneScrewCtrlConfigResult& cfg) = 0;
};
/**
* @brief
*/
class IDroneScrewCtrlConfig
{
public:
virtual ~IDroneScrewCtrlConfig() = default;
static bool CreateInstance(IDroneScrewCtrlConfig** pp);
virtual int LoadConfig(const std::string& filePath, DroneScrewCtrlConfigResult& result) = 0;
virtual bool SaveConfig(const std::string& filePath, const DroneScrewCtrlConfigResult& result) = 0;
virtual void SetConfigChangeNotify(IDroneScrewCtrlConfigNotify* notify) = 0;
};
#endif // IVR_DRONESCREWCTRL_CONFIG_H