107 lines
3.8 KiB
C#
107 lines
3.8 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Collections.ObjectModel;
|
||
|
||
namespace SHH.CameraSdk;
|
||
|
||
/// <summary>
|
||
/// 通道级能力描述(镜头身份证)
|
||
/// 核心职责:描述单个物理镜头或 NVR 通道的技术参数、功能支持特性与分辨率能力
|
||
/// 协作场景:作为 <see cref="DeviceMetadata"/> 的子级数据,支撑设备能力自发现、配置合法性校验
|
||
/// </summary>
|
||
public class ChannelMetadata
|
||
{
|
||
#region --- 1. 通道基础标识 (Basic Identification) ---
|
||
|
||
/// <summary>
|
||
/// 物理通道索引(从 1 开始计数,与 DVR/NVR 物理通道号一一对应)
|
||
/// 业务用途:作为通道唯一标识,用于码流订阅、参数配置
|
||
/// </summary>
|
||
public int ChannelIndex { get; init; }
|
||
|
||
/// <summary>
|
||
/// 通道名称(用于 OSD 叠加显示、UI 界面展示)
|
||
/// 示例:"北大门主入口" "地下车库A区"
|
||
/// </summary>
|
||
public string Name { get; init; } = string.Empty;
|
||
|
||
#endregion
|
||
|
||
#region --- 2. 功能支持特性 (Capability Support) ---
|
||
|
||
/// <summary>
|
||
/// 是否支持云台控制(PTZ:Pan/Tilt/Zoom 平移/俯仰/变焦)
|
||
/// 业务影响:决定 UI 是否显示云台控制按钮,是否允许下发 PTZ 指令
|
||
/// </summary>
|
||
public bool SupportPtz { get; init; }
|
||
|
||
/// <summary>
|
||
/// 是否支持音频输入(是否接入拾音器)
|
||
/// 业务影响:决定是否开启音频解码、音频流推送功能
|
||
/// </summary>
|
||
public bool SupportAudioIn { get; init; }
|
||
|
||
/// <summary>
|
||
/// 是否支持 AI 智能分析(人脸检测、车牌识别、行为分析等)
|
||
/// 业务影响:决定是否加载 AI 算法插件,是否接收智能事件上报
|
||
/// </summary>
|
||
public bool SupportAiAnalysis { get; init; }
|
||
|
||
#endregion
|
||
|
||
#region --- 3. 分辨率能力 (Resolution Capabilities) ---
|
||
|
||
/// <summary>
|
||
/// 通道支持的分辨率列表(只读集合,防止外部篡改)
|
||
/// 格式示例:["1920x1080", "1280x720", "3840x2160"]
|
||
/// 业务用途:前端清晰度选择下拉列表、动态配置分辨率合法性校验
|
||
/// </summary>
|
||
public ReadOnlyCollection<string> SupportedResolutions { get; init; } = new ReadOnlyCollection<string>(new List<string>());
|
||
|
||
#endregion
|
||
|
||
#region --- 4. 构造函数 (Constructors) ---
|
||
|
||
/// <summary>
|
||
/// 默认构造函数(用于序列化、初始状态初始化)
|
||
/// </summary>
|
||
public ChannelMetadata() { }
|
||
|
||
/// <summary>
|
||
/// 简化构造函数(用于快速创建通道标识、克隆或比对场景)
|
||
/// </summary>
|
||
/// <param name="index">物理通道索引</param>
|
||
/// <param name="name">通道名称</param>
|
||
public ChannelMetadata(int index, string name)
|
||
{
|
||
ChannelIndex = index;
|
||
Name = name;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 完整构造函数(用于创建包含全量能力的通道元数据)
|
||
/// </summary>
|
||
/// <param name="index">物理通道索引</param>
|
||
/// <param name="name">通道名称</param>
|
||
/// <param name="supportPtz">是否支持云台</param>
|
||
/// <param name="supportAudio">是否支持音频输入</param>
|
||
/// <param name="supportAi">是否支持 AI 分析</param>
|
||
/// <param name="resolutions">支持的分辨率列表</param>
|
||
public ChannelMetadata(
|
||
int index,
|
||
string name,
|
||
bool supportPtz = false,
|
||
bool supportAudio = false,
|
||
bool supportAi = false,
|
||
IEnumerable<string>? resolutions = null)
|
||
{
|
||
ChannelIndex = index;
|
||
Name = name;
|
||
SupportPtz = supportPtz;
|
||
SupportAudioIn = supportAudio;
|
||
SupportAiAnalysis = supportAi;
|
||
SupportedResolutions = new ReadOnlyCollection<string>(resolutions?.ToList() ?? new List<string>());
|
||
}
|
||
|
||
#endregion
|
||
} |