新通讯图像协议对接成功

This commit is contained in:
2026-01-15 11:04:38 +08:00
parent 81580a8f55
commit 8ef8139382
20 changed files with 237 additions and 593 deletions

View File

@@ -18,74 +18,68 @@ service GatewayProvider {
rpc OpenCommandChannel (CommandStreamRequest) returns (stream CommandPayloadProto);
}
// --- 通用指令推送通道 ---
message CommandPayloadProto {
string protocol = 1; // 协议类型,默认 "COMMAND"
string cmd_code = 2; // 指令代码,如 "Sync_Camera"
string target_id = 3; // 目标对象 ID
string json_params = 4; // 业务参数 JSON
string request_id = 5; // 请求追踪 ID
int64 timestamp_ticks = 6; // 发送时间戳 (Ticks)
bool require_ack = 7; // 是否需要回执
int32 retry_count = 8; // 重试计数
int64 expire_time = 9; // 过期时间戳
}
// --- 1. 注册相关 ---
message RegisterRequest {
// 进程 ID (用于区分同一台机器上的多个实例)
int32 process_id = 1;
// 调用进程句柄
int32 invoke_process_id = 2;
// 实例唯一标识符 (例如 "Stream_1")
string instance_id = 3;
// 软件版本号
string version = 4;
// 软件所在的局域网 IP
string server_ip = 5;
// WebAPI 监听端口
int32 webapi_port = 6;
// Grpc通讯端口
int32 grpc_port = 7;
// 启动时间
int64 start_time_ticks = 9;
// 描述信息
string description = 10;
int32 process_id = 1; // 进程 ID (用于区分同一台机器上的多个实例)
int32 invoke_process_id = 2; // 调用进程句柄
string instance_id = 3; // 实例唯一标识符 (例如 "Stream_1")
string version = 4; // 软件版本号
string server_ip = 5; // 软件所在的局域网 IP
int32 webapi_port = 6; // WebAPI 监听端口
int32 grpc_port = 7; // Grpc通讯端口
int64 start_time_ticks = 9; // 启动时间
string description = 10; // 描述信息
}
// --- 2. 状态上报相关 ---
message StatusBatchRequest {
string protocol = 1;
int64 timestamp = 2;
repeated StatusEventItem items = 3;
int64 timestamp = 1; // 上报时间戳
repeated StatusEventItem items = 2; // 状态事件列表
}
// 设备状态变更通知包
message StatusEventItem {
string camera_id = 1;
bool is_online = 2;
string reason = 3;
int64 timestamp = 4;
string camera_id = 1; // 摄像头ID
bool is_online = 2; // 是否在线
string reason = 3; // 状态变更原因描述
}
// --- 3. 视频流相关 ---
// --- 3. 视频流传输协议 ---
// 职责:承载高频传输的实时视频帧、算法处理图及相关的 AI 诊断元数据
message VideoFrameRequest {
string camera_id = 1;
int64 capture_timestamp = 2;
int64 dispatch_timestamp = 3;
int32 original_width = 4;
int32 original_height = 5;
int32 target_width = 6;
int32 target_height = 7;
repeated string subscriber_ids = 8;
map<string, string> diagnostics = 9;
bool has_original_image = 10;
bool has_target_image = 11;
bytes original_image_bytes = 12;
bytes target_image_bytes = 13;
string camera_id = 1; // 摄像头唯一物理标识符
int64 capture_timestamp = 2; // 图像在传感器端的原始采集时间戳 (Ticks/Unixms)
int64 dispatch_timestamp = 3; // 图像在分析节点端的分发/外传时间戳 (用于测量网络传输耗时)
int32 original_width = 4; // 原始采集图像的宽度
int32 original_height = 5; // 原始采集图像的高度
int32 target_width = 6; // 算法处理(如缩放或裁剪)后的目标图像宽度
int32 target_height = 7; // 算法处理后的目标图像高度
repeated string subscriber_ids = 8; // 订阅此帧的应用标识列表 (例如: "UI", "AI", "Record")
map<string, string> diagnostics = 9; // 诊断与扩展元数据 键值对存储:例如 {"fps": "25", "bitrate": "4Mbps", "algo_latency": "12ms"}
bool has_original_image = 10; // 状态标志:包内是否包含原始图像二进制数据
bool has_target_image = 11; // 状态标志:包内是否包含算法处理图(或带 OSD 渲染的图)
bytes original_image_bytes = 12; // 原始图像二进制数据 (通常为 JPG/NV12 格式)
bytes target_image_bytes = 13; // 算法处理图/标注图二进制数据
}
// --- 4. 指令下发相关 (对应 C# CommandPayload) ---
message CommandStreamRequest {
string instance_id = 1; // 告知服务端我是哪个节点
}
message CommandPayloadProto {
string protocol = 1; // 协议类型,默认 "COMMAND"
string cmd_code = 2; // 指令代码,如 "Sync_Camera"
string target_id = 3; // 目标对象 ID
string json_params = 4; // 业务参数 JSON
string request_id = 5; // 请求追踪 ID
int64 timestamp_ticks = 6; // 发送时间戳 (Ticks)
bool require_ack = 7; // 是否需要回执
int32 retry_count = 8; // 重试计数
int64 expire_time = 9; // 过期时间戳
string instance_id = 1; // 告知服务端我是哪个节点
int32 process_id = 2; // 告知服务端我是哪个进程
}
message GenericResponse {