using System;
using System.Collections.Generic;
namespace YuncangTrace.LocalService.Services.Hik;
///
/// 云台(PTZ)命令码表 —— 与 HCNetSDK.h 保持一致。
///
/// 注意:
/// - 方向/变倍/聚焦/光圈都是**连续动作**:先 stop=0 开始,再 stop=1 停止;
/// - 预置点走另一套接口(NET_DVR_PTZPreset_Other);
/// - PAN_AUTO(自动扫描)也是连续动作,需要停止才会结束。
///
internal static class HikPtz
{
// 连续动作
internal const uint ZoomIn = 11;
internal const uint ZoomOut = 12;
internal const uint FocusNear = 13;
internal const uint FocusFar = 14;
internal const uint IrisOpen = 15;
internal const uint IrisClose = 16;
internal const uint TiltUp = 21;
internal const uint TiltDown = 22;
internal const uint PanLeft = 23;
internal const uint PanRight = 24;
internal const uint UpLeft = 25;
internal const uint UpRight = 26;
internal const uint DownLeft = 27;
internal const uint DownRight = 28;
internal const uint PanAuto = 29;
// 灯光 / 雨刷 / 风扇 / 加热
internal const uint LightPowerOn = 2;
internal const uint WiperPowerOn = 3;
internal const uint FanPowerOn = 4;
internal const uint HeaterPowerOn = 5;
// 预置点
internal const uint PresetSet = 8;
internal const uint PresetClear = 9;
internal const uint PresetGoto = 39;
/// 前端用的名字 → 命令码
internal static readonly Dictionary Commands = new(StringComparer.OrdinalIgnoreCase)
{
[ "up" ] = TiltUp,
[ "down" ] = TiltDown,
[ "left" ] = PanLeft,
[ "right" ] = PanRight,
[ "up-left" ] = UpLeft,
[ "up-right" ] = UpRight,
[ "down-left" ] = DownLeft,
[ "down-right" ] = DownRight,
[ "auto" ] = PanAuto,
[ "zoom-in" ] = ZoomIn,
[ "zoom-out" ] = ZoomOut,
[ "focus-near" ] = FocusNear,
[ "focus-far" ] = FocusFar,
[ "iris-open" ] = IrisOpen,
[ "iris-close" ] = IrisClose,
[ "light-on" ] = LightPowerOn,
[ "wiper-on" ] = WiperPowerOn,
[ "fan-on" ] = FanPowerOn,
[ "heater-on" ] = HeaterPowerOn,
};
/// 预置点动作 → 命令码
internal static readonly Dictionary PresetActions = new(StringComparer.OrdinalIgnoreCase)
{
[ "set" ] = PresetSet,
[ "goto" ] = PresetGoto,
[ "clear" ] = PresetClear,
};
}