|
|
|
namespace EC.Helper.CameraSDK;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 相机信息
|
|
|
|
/// </summary>
|
|
|
|
public class CameraInfo
|
|
|
|
{
|
|
|
|
#region Attr
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 相机类型
|
|
|
|
/// </summary>
|
|
|
|
public int Type { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ip 地址
|
|
|
|
/// </summary>
|
|
|
|
public string Ip { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 端口
|
|
|
|
/// </summary>
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 账号
|
|
|
|
/// </summary>
|
|
|
|
public string UserName { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 密码
|
|
|
|
/// </summary>
|
|
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
#endregion Attr
|
|
|
|
|
|
|
|
public static CameraInfo New(int type, string ip, int port, string userName, string password)
|
|
|
|
{
|
|
|
|
CameraInfo info = new() { Type = type, Ip = ip, Port = port, UserName = userName, Password = password };
|
|
|
|
if (port <= 0)
|
|
|
|
throw new Exception("Camera type not support.");
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static CameraInfo New(int type, string ip, string userName, string password)
|
|
|
|
{
|
|
|
|
CameraInfo info = new() { Type = type, Ip = ip, UserName = userName, Password = password };
|
|
|
|
int port = (CameraType)type switch
|
|
|
|
{
|
|
|
|
CameraType.HiK => (int)CameraPort.HiK,
|
|
|
|
CameraType.DaHua => (int)CameraPort.DaHua,
|
|
|
|
CameraType.YuShi => (int)CameraPort.YuShi,
|
|
|
|
_ => -1,
|
|
|
|
};
|
|
|
|
info.Port = port;
|
|
|
|
if (port <= 0)
|
|
|
|
throw new Exception("Camera type not support.");
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 相机类型
|
|
|
|
/// </summary>
|
|
|
|
public enum CameraType : int
|
|
|
|
{
|
|
|
|
HiK = 1,
|
|
|
|
DaHua,
|
|
|
|
YuShi,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 相机默认连接端口
|
|
|
|
/// </summary>
|
|
|
|
public enum CameraPort : int
|
|
|
|
{
|
|
|
|
HiK = 8000,
|
|
|
|
DaHua = 37777,
|
|
|
|
YuShi = 8800,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Ptz 信息
|
|
|
|
/// </summary>
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|