海康摄像头增加了云台控制等
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using OpenCvSharp;
|
||||
using SHH.CameraSdk.HikFeatures;
|
||||
using System;
|
||||
|
||||
namespace SHH.CameraSdk;
|
||||
|
||||
@@ -9,7 +11,8 @@ namespace SHH.CameraSdk;
|
||||
/// 2. [Feat A] 热更新支持:实现 OnApplyOptions,支持码流/句柄不亦断线热切换。
|
||||
/// 3. [Feat B] 审计集成:全面接入 AddAuditLog,对接 Web 运维仪表盘。
|
||||
/// </summary>
|
||||
public class HikVideoSource : BaseVideoSource
|
||||
public class HikVideoSource : BaseVideoSource,
|
||||
IHikContext, ITimeSyncFeature, IRebootFeature, IPtzFeature
|
||||
{
|
||||
#region --- 静态资源 (Global Resources) ---
|
||||
|
||||
@@ -22,6 +25,33 @@ public class HikVideoSource : BaseVideoSource
|
||||
|
||||
#endregion
|
||||
|
||||
// 声明组件
|
||||
private readonly HikTimeSyncProvider _timeProvider;
|
||||
private readonly HikRebootProvider _rebootProvider;
|
||||
private readonly HikPtzProvider _ptzProvider;
|
||||
|
||||
// ==========================================
|
||||
// 实现 IHikContext (核心数据暴露)
|
||||
// ==========================================
|
||||
public int GetUserId() => _userId; // 暴露父类或私有的 _userId
|
||||
public string GetDeviceIp() => Config.IpAddress;
|
||||
|
||||
// ==========================================
|
||||
// 实现 ITimeSyncFeature (路由转发)
|
||||
// ==========================================
|
||||
// 核心逻辑:全部委托给 _timeProvider 处理,自己不写一行逻辑
|
||||
public Task<DateTime> GetTimeAsync() => _timeProvider.GetTimeAsync();
|
||||
|
||||
public Task SetTimeAsync(DateTime time) => _timeProvider.SetTimeAsync(time);
|
||||
|
||||
public Task RebootAsync() => _rebootProvider.RebootAsync();
|
||||
|
||||
public Task PtzControlAsync(PtzAction action, bool stop, int speed = 4)
|
||||
=> _ptzProvider.PtzControlAsync(action, stop, speed);
|
||||
|
||||
public Task PtzStepAsync(PtzAction action, int durationMs, int speed = 4)
|
||||
=> _ptzProvider.PtzStepAsync(action, durationMs, speed);
|
||||
|
||||
#region --- 实例成员 (Instance Members) ---
|
||||
|
||||
private int _userId = -1; // SDK 登录句柄
|
||||
@@ -53,7 +83,10 @@ public class HikVideoSource : BaseVideoSource
|
||||
|
||||
public HikVideoSource(VideoSourceConfig config) : base(config)
|
||||
{
|
||||
// 构造函数保持简洁
|
||||
// 初始化组件,将 "this" 作为上下文传进去
|
||||
_timeProvider = new HikTimeSyncProvider(this);
|
||||
_rebootProvider = new HikRebootProvider(this);
|
||||
_ptzProvider = new HikPtzProvider(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user