namespace EC.Helper.CameraSDK; /// /// 相机信息 /// public class CameraInfo { #region Attr /// /// 相机厂商 /// public int Manufactor { get; set; } /// /// ip 地址 /// public string Ip { get; set; } = string.Empty; /// /// 端口 /// public int Port { get; set; } /// /// 账号 /// public string UserName { get; set; } = string.Empty; /// /// 密码 /// public string Password { get; set; } = string.Empty; #endregion Attr public static CameraInfo New(int manufactor, string ip, int port, string userName, string password) { CameraInfo info = new() { Manufactor = manufactor, Ip = ip, Port = port, UserName = userName, Password = password }; if (port <= 0) throw new Exception("Camera manufactor not support."); return info; } public static CameraInfo New(int manufactor, string ip, string userName, string password) { CameraInfo info = new() { Manufactor = manufactor, Ip = ip, UserName = userName, Password = password }; int port = (CameraManufactor)manufactor switch { CameraManufactor.HiK => (int)CameraPort.HiK, CameraManufactor.DaHua => (int)CameraPort.DaHua, CameraManufactor.YuShi => (int)CameraPort.YuShi, _ => -1, }; info.Port = port; if (port <= 0) throw new Exception("Camera manufactor not support."); return info; } } /// /// 相机厂商 /// public enum CameraManufactor : int { HiK = 1, DaHua, YuShi, } /// /// 相机默认连接端口 /// public enum CameraPort : int { HiK = 8000, DaHua = 37777, YuShi = 8800, } /// /// Ptz 信息 /// public class PtzInfo { #region Attr public double Pan { get; set; } public double Tilt { get; set; } public double Zoom { get; set; } #endregion Attr public PtzInfo(double pan, double tilt, double zoom) { Pan = pan; Tilt = tilt; Zoom = zoom; } public static PtzInfo Default { get { return new(0, 0, 0); } } public static PtzInfo New(double pan, double tilt, double zoom) { return new PtzInfo(pan, tilt, zoom); } }