54 lines
1.5 KiB
C
Raw Normal View History

2025-09-29 00:56:53 +08:00
#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 ID112...
*/
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