新增 Mjpegplayer 用来播放 Web 流
This commit is contained in:
47
SHH.Contracts.Grpc/Payloads/ProtocolCodes.cs
Normal file
47
SHH.Contracts.Grpc/Payloads/ProtocolCodes.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace SHH.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// 协议代码定义常量类
|
||||
/// <para>职责:统一管理 gRpc 通讯中所涉及的协议大类 (Protocol) 与具体业务指令码 (CmdCode)</para>
|
||||
/// </summary>
|
||||
public static class ProtocolCodes
|
||||
{
|
||||
#region --- 1. 协议类型定义 (对应 Protocol 字段) ---
|
||||
|
||||
/// <summary>
|
||||
/// 基础指令协议头
|
||||
/// <para>用于标记该消息是一个业务控制指令</para>
|
||||
/// </summary>
|
||||
public const string Command = "Command";
|
||||
|
||||
/// <summary>
|
||||
/// 指令执行结果反馈协议头
|
||||
/// <para>用于分析节点执行完指令后,向主控端回执操作结果</para>
|
||||
/// </summary>
|
||||
public const string Command_Result = "Command_Result";
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- 2. 业务指令码定义 (对应 CmdCode 字段) ---
|
||||
|
||||
/// <summary>
|
||||
/// 服务器注册指令
|
||||
/// <para>触发场景:节点启动时向主控端注册自身信息</para>
|
||||
/// </summary>
|
||||
public const string ServerRegister = "SERVER_REGISTER";
|
||||
|
||||
/// <summary>
|
||||
/// 同步摄像头配置指令
|
||||
/// <para>触发场景:节点上线全量同步、数据库摄像头信息变更增量同步</para>
|
||||
/// </summary>
|
||||
public static string Sync_Camera { get; } = "Sync_Camera";
|
||||
|
||||
/// <summary>
|
||||
/// 移除摄像头指令
|
||||
/// <para>触发场景:本地数据库删除摄像头后,通知远程节点停止相关流采集与分析</para>
|
||||
/// </summary>
|
||||
public static string Remove_Camera { get; } = "Remove_Camera";
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
64
SHH.Contracts.Grpc/Payloads/RegisterPayload.cs
Normal file
64
SHH.Contracts.Grpc/Payloads/RegisterPayload.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
namespace SHH.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务端身份注册信息 (DTO)
|
||||
/// <para>用于服务端主动连上客户端后,上报自身的端口和身份信息</para>
|
||||
/// </summary>
|
||||
public class RegisterPayload
|
||||
{
|
||||
#region --- 0. 协议自描述 ---
|
||||
|
||||
/// <summary>协议类型标识 (人工可读)</summary>
|
||||
public string Protocol { get; set; } = ProtocolCodes.ServerRegister;
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- 1. 身份标识 ---
|
||||
|
||||
/// <summary>进程 ID (用于区分同一台机器上的多个实例)</summary>
|
||||
public int ProcessId { get; set; }
|
||||
|
||||
/// <summary>调用进程 ID (用于区分同一台机器上的多个实例)</summary>
|
||||
public int InvokeProcId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实例唯一标识符
|
||||
/// <para>启动时通过命令行传入,例如 "Gateway_Factory_A"</para>
|
||||
/// </summary>
|
||||
public string InstanceId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>服务端版本号</summary>
|
||||
public string Version { get; set; } = "1.0.0";
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- 2. 网络诊断信息 (用于运维) ---
|
||||
|
||||
/// <summary>
|
||||
/// 服务端所在的局域网 IP
|
||||
/// <para>客户端无法直接连接此IP(因为可能是内网),但运维人员需要知道</para>
|
||||
/// </summary>
|
||||
public string ServerIp { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// WebAPI 监听端口 (HTTP)
|
||||
/// <para>用于运维人员打开 Swagger 进行调试</para>
|
||||
/// </summary>
|
||||
public int WebApiPort { get; set; }
|
||||
|
||||
/// <summary>Grpc通讯端口</summary>
|
||||
public int GrpcPort { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- 3. 运行时状态 ---
|
||||
|
||||
/// <summary>启动时间</summary>
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
/// <summary>描述信息 (可选)</summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
23
SHH.Contracts.Grpc/Payloads/StatusEventPayload.cs
Normal file
23
SHH.Contracts.Grpc/Payloads/StatusEventPayload.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace SHH.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// [控制面] 设备状态变更通知包
|
||||
/// </summary>
|
||||
public class StatusEventPayload
|
||||
{
|
||||
/// <summary>摄像头ID</summary>
|
||||
public string CameraId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>IP地址</summary>
|
||||
public string IpAddress { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>true: 上线/活跃, false: 离线/超时</summary>
|
||||
public bool IsOnline { get; set; }
|
||||
|
||||
/// <summary>变更原因 (e.g. "Ping Success", "Frame Timeout")</summary>
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>时间戳</summary>
|
||||
public long Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user