54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
#ifndef PROTOCOLCOMMON_H
|
||
#define PROTOCOLCOMMON_H
|
||
|
||
#include <functional>
|
||
#include <vector>
|
||
#include <cstdint>
|
||
|
||
/**
|
||
* @brief 单个目标位置数据(简化版,只包含必要的x,y,z,rz)
|
||
*/
|
||
struct TargetResult {
|
||
uint32_t id; // 目标ID(从1开始编号)
|
||
uint16_t status;
|
||
float width;
|
||
float depth;
|
||
};
|
||
|
||
/**
|
||
* @brief 多目标检测结果数据结构
|
||
*/
|
||
struct MultiTargetData {
|
||
std::vector<TargetResult> targets; // 目标位置列表
|
||
};
|
||
|
||
/**
|
||
* @brief 通用连接状态枚举
|
||
*/
|
||
enum ConnectionStatus {
|
||
STATUS_DISCONNECTED = 0, // 断开连接
|
||
STATUS_CONNECTED = 1, // 已连接
|
||
STATUS_IDLE = 2, // 空闲状态
|
||
STATUS_WORKING = 3, // 工作中
|
||
STATUS_ERROR = 4 // 错误状态
|
||
};
|
||
|
||
/**
|
||
* @brief 连接状态回调函数类型
|
||
* @param connected true-连接,false-断开
|
||
*/
|
||
using ConnectionCallback = std::function<void(bool connected)>;
|
||
|
||
/**
|
||
* @brief 开始工作信号回调函数类型
|
||
* @param startWork true-开始工作,false-停止工作
|
||
* @param cameraId 相机ID,从1开始编号(1,2,...)
|
||
*/
|
||
using WorkSignalCallback = std::function<bool(bool startWork, int cameraId)>;
|
||
|
||
// 工作状态定义(公共常量)
|
||
static const uint16_t WORK_STATUS_IDLE = 0; // 空闲
|
||
static const uint16_t WORK_STATUS_WORKING = 1; // 工作中
|
||
static const uint16_t WORK_STATUS_BUSY = 3; // 忙碌
|
||
|
||
#endif // PROTOCOLCOMMON_H
|