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