You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
848 lines
22 KiB
848 lines
22 KiB
2 years ago
|
//#define Linux32
|
||
|
//#define Linux64
|
||
|
//#define Win32
|
||
|
//#define Win64
|
||
|
|
||
|
using System.Runtime.InteropServices;
|
||
|
|
||
|
namespace EC.Helper.CameraSDK;
|
||
|
|
||
|
public static class DaHuaOriSDK
|
||
|
{
|
||
|
#region Lib Attr
|
||
|
|
||
|
#if (Linux32)
|
||
|
private const string LibDhNetSDK = @"./libs/dahua/linux32/libdhnetsdk.so";
|
||
|
#elif (Linux64)
|
||
|
private const string LibDhNetSDK = @"./libs/dahua/linux64/libdhnetsdk.so";
|
||
|
#elif (Win32)
|
||
|
private const string LibDhNetSDK = @"./libs/dahua/win32/dhnetsdk.dll";
|
||
|
#elif (Win64)
|
||
|
private const string LibDhNetSDK = @"./libs/dahua/win64/dhnetsdk.dll";
|
||
|
#endif
|
||
|
|
||
|
#endregion Lib Attr
|
||
|
|
||
|
static DaHuaOriSDK()
|
||
|
{
|
||
|
GlobalInit();
|
||
|
}
|
||
|
|
||
|
#region Global
|
||
|
|
||
|
public static bool InitSuccess { get; private set; }
|
||
|
|
||
|
public static bool GlobalInit()
|
||
|
{
|
||
|
if (InitSuccess) return true;
|
||
|
bool ret = CLIENT_InitEx(null, IntPtr.Zero, IntPtr.Zero);
|
||
|
InitSuccess = ret;
|
||
|
if (!ret) throw new Exception("DaHuaOriSDK global init failure.");
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
public static bool GlobalDestory()
|
||
|
{
|
||
|
if (!InitSuccess) return true;
|
||
|
CLIENT_Cleanup();
|
||
|
InitSuccess = false;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
#endregion Global
|
||
|
|
||
|
#region SDK Enum
|
||
|
|
||
|
/// <summary>
|
||
|
/// login device mode enumeration
|
||
|
/// 登陆设备方式枚举
|
||
|
/// </summary>
|
||
|
public enum EM_LOGIN_SPAC_CAP_TYPE
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// TCP login, default
|
||
|
/// TCP登陆, 默认方式
|
||
|
/// </summary>
|
||
|
TCP = 0,
|
||
|
|
||
|
/// <summary>
|
||
|
/// No criteria login
|
||
|
/// 无条件登陆
|
||
|
/// </summary>
|
||
|
ANY = 1,
|
||
|
|
||
|
/// <summary>
|
||
|
/// auto sign up login
|
||
|
/// 主动注册的登入
|
||
|
/// </summary>
|
||
|
SERVER_CONN = 2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// multicast login, default
|
||
|
/// 组播登陆
|
||
|
/// </summary>
|
||
|
MULTICAST = 3,
|
||
|
|
||
|
/// <summary>
|
||
|
/// UDP method login
|
||
|
/// UDP方式下的登入
|
||
|
/// </summary>
|
||
|
UDP = 4,
|
||
|
|
||
|
/// <summary>
|
||
|
/// only main connection login
|
||
|
/// 只建主连接下的登入
|
||
|
/// </summary>
|
||
|
MAIN_CONN_ONLY = 6,
|
||
|
|
||
|
/// <summary>
|
||
|
/// SSL encryption login
|
||
|
/// SSL加密方式登陆
|
||
|
/// </summary>
|
||
|
SSL = 7,
|
||
|
|
||
|
/// <summary>
|
||
|
/// login IVS box remote device
|
||
|
/// 登录智能盒远程设备
|
||
|
/// </summary>
|
||
|
INTELLIGENT_BOX = 9,
|
||
|
|
||
|
/// <summary>
|
||
|
/// login device do not config
|
||
|
/// 登录设备后不做取配置操作
|
||
|
/// </summary>
|
||
|
NO_CONFIG = 10,
|
||
|
|
||
|
/// <summary>
|
||
|
/// USB key device login
|
||
|
/// 用U盾设备的登入
|
||
|
/// </summary>
|
||
|
U_LOGIN = 11,
|
||
|
|
||
|
/// <summary>
|
||
|
/// LDAP login
|
||
|
/// LDAP方式登录
|
||
|
/// </summary>
|
||
|
LDAP = 12,
|
||
|
|
||
|
/// <summary>
|
||
|
/// AD login
|
||
|
/// AD(ActiveDirectory)登录方式
|
||
|
/// </summary>
|
||
|
AD = 13,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Radius login
|
||
|
/// Radius 登录方式
|
||
|
/// </summary>
|
||
|
RADIUS = 14,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Socks5 login
|
||
|
/// Socks5登陆方式
|
||
|
/// </summary>
|
||
|
SOCKET_5 = 15,
|
||
|
|
||
|
/// <summary>
|
||
|
/// cloud login
|
||
|
/// 云登陆方式
|
||
|
/// </summary>
|
||
|
CLOUD = 16,
|
||
|
|
||
|
/// <summary>
|
||
|
/// dual authentication loin
|
||
|
/// 二次鉴权登陆方式
|
||
|
/// </summary>
|
||
|
AUTH_TWICE = 17,
|
||
|
|
||
|
/// <summary>
|
||
|
/// TS stream client login
|
||
|
/// TS码流客户端登陆方式
|
||
|
/// </summary>
|
||
|
TS = 18,
|
||
|
|
||
|
/// <summary>
|
||
|
/// web private login
|
||
|
/// 为P2P登陆方式
|
||
|
/// </summary>
|
||
|
P2P = 19,
|
||
|
|
||
|
/// <summary>
|
||
|
/// mobile client login
|
||
|
/// 手机客户端登陆
|
||
|
/// </summary>
|
||
|
MOBILE = 20,
|
||
|
|
||
|
/// <summary>
|
||
|
/// invalid login
|
||
|
/// 无效的登陆方式
|
||
|
/// </summary>
|
||
|
INVALID = 21,
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// device type enumeration
|
||
|
/// 设备类型枚举
|
||
|
/// </summary>
|
||
|
public enum EM_NET_DEVICE_TYPE
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Unknow
|
||
|
// 未知
|
||
|
/// </summary>
|
||
|
NET_PRODUCT_NONE = 0,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Non real-time MACE
|
||
|
/// 非实时MACE
|
||
|
/// </summary>
|
||
|
NET_DVR_NONREALTIME_MACE,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Non real-time
|
||
|
/// 非实时
|
||
|
/// </summary>
|
||
|
NET_DVR_NONREALTIME,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Network video server
|
||
|
/// 网络视频服务器
|
||
|
/// </summary>
|
||
|
NET_NVS_MPEG1,
|
||
|
|
||
|
/// <summary>
|
||
|
/// MPEG1 2-ch DVR
|
||
|
/// MPEG1二路录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG1_2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// MPEG1 8-ch DVR
|
||
|
/// MPEG1八路录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG1_8,
|
||
|
|
||
|
/// <summary>
|
||
|
/// MPEG4 8-ch DVR
|
||
|
/// MPEG4八路录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG4_8,
|
||
|
|
||
|
/// <summary>
|
||
|
/// MPEG4 16-ch DVR
|
||
|
/// MPEG4 十六路录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG4_16,
|
||
|
|
||
|
/// <summary>
|
||
|
/// LB series DVR
|
||
|
/// LB系列录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG4_SX2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// GB series DVR
|
||
|
/// GB系列录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MEPG4_ST2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// HB series DVR
|
||
|
/// HB系列录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MEPG4_SH2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// GBE series DVR
|
||
|
/// GBE系列录像机
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG4_GBE,
|
||
|
|
||
|
/// <summary>
|
||
|
/// II network video server
|
||
|
/// II代网络视频服务器
|
||
|
/// </summary>
|
||
|
NET_DVR_MPEG4_NVSII,
|
||
|
|
||
|
/// <summary>
|
||
|
/// New standard configuration protocol
|
||
|
/// 新标准配置协议
|
||
|
/// </summary>
|
||
|
NET_DVR_STD_NEW,
|
||
|
|
||
|
/// <summary>
|
||
|
/// DDNS server
|
||
|
/// DDNS服务器
|
||
|
/// </summary>
|
||
|
NET_DVR_DDNS,
|
||
|
|
||
|
/// <summary>
|
||
|
/// ATM series
|
||
|
/// ATM机
|
||
|
/// </summary>
|
||
|
NET_DVR_ATM,
|
||
|
|
||
|
/// <summary>
|
||
|
/// 2nd non real-time NB series DVR
|
||
|
/// 二代非实时NB系列机器
|
||
|
/// </summary>
|
||
|
NET_NB_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// LN series
|
||
|
/// LN系列产品
|
||
|
/// </summary>
|
||
|
NET_LN_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// BAV series
|
||
|
/// BAV系列产品
|
||
|
/// </summary>
|
||
|
NET_BAV_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// SDIP series
|
||
|
/// SDIP系列产品
|
||
|
/// </summary>
|
||
|
NET_SDIP_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// IPC series
|
||
|
/// IPC系列产品
|
||
|
/// </summary>
|
||
|
NET_IPC_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVS B series
|
||
|
/// NVS B系列
|
||
|
/// </summary>
|
||
|
NET_NVS_B,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVS H series
|
||
|
/// NVS H系列
|
||
|
/// </summary>
|
||
|
NET_NVS_C,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVS S series
|
||
|
/// NVS S系列
|
||
|
/// </summary>
|
||
|
NET_NVS_S,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVS E series
|
||
|
/// NVS E系列
|
||
|
/// </summary>
|
||
|
NET_NVS_E,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Search device type from QueryDevState. it is in string format
|
||
|
/// 从QueryDevState中查询设备类型,以字符串格式
|
||
|
/// </summary>
|
||
|
NET_DVR_NEW_PROTOCOL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVD
|
||
|
/// 解码器
|
||
|
/// </summary>
|
||
|
NET_NVD_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// N5
|
||
|
/// N5
|
||
|
/// </summary>
|
||
|
NET_DVR_N5,
|
||
|
|
||
|
/// <summary>
|
||
|
/// HDVR
|
||
|
/// 混合DVR
|
||
|
/// </summary>
|
||
|
NET_DVR_MIX_DVR,
|
||
|
|
||
|
/// <summary>
|
||
|
/// SVR series
|
||
|
/// SVR系列
|
||
|
/// </summary>
|
||
|
NET_SVR_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// SVR-BS
|
||
|
/// SVR-BS
|
||
|
/// </summary>
|
||
|
NET_SVR_BS,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVR series
|
||
|
/// NVR系列
|
||
|
/// </summary>
|
||
|
NET_NVR_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// N51
|
||
|
/// N51
|
||
|
/// </summary>
|
||
|
NET_DVR_N51,
|
||
|
|
||
|
/// <summary>
|
||
|
/// ITSE Intelligent Analysis Box
|
||
|
/// ITSE 智能分析盒
|
||
|
/// </summary>
|
||
|
NET_ITSE_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Intelligent traffic camera equipment
|
||
|
/// 智能交通像机设备
|
||
|
/// </summary>
|
||
|
NET_ITC_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// radar speedometer HWS
|
||
|
/// 雷达测速仪HWS
|
||
|
/// </summary>
|
||
|
NET_HWS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// portable video record
|
||
|
/// 便携式音视频录像机
|
||
|
/// </summary>
|
||
|
NET_PVR_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// IVS(intelligent video server series)
|
||
|
/// IVS(智能视频服务器系列)
|
||
|
/// </summary>
|
||
|
NET_IVS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// universal intelligent detect video server series
|
||
|
/// 通用智能视频侦测服务器
|
||
|
/// </summary>
|
||
|
NET_IVS_B,
|
||
|
|
||
|
/// <summary>
|
||
|
/// face recognisation server
|
||
|
/// 人脸识别服务器
|
||
|
/// </summary>
|
||
|
NET_IVS_F,
|
||
|
|
||
|
/// <summary>
|
||
|
/// video quality diagnosis server
|
||
|
/// 视频质量诊断服务器
|
||
|
/// </summary>
|
||
|
NET_IVS_V,
|
||
|
|
||
|
/// <summary>
|
||
|
/// matrix
|
||
|
/// 矩阵
|
||
|
/// </summary>
|
||
|
NET_MATRIX_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// N52
|
||
|
/// N52
|
||
|
/// </summary>
|
||
|
NET_DVR_N52,
|
||
|
|
||
|
/// <summary>
|
||
|
/// N56
|
||
|
/// N56
|
||
|
/// </summary>
|
||
|
NET_DVR_N56,
|
||
|
|
||
|
/// <summary>
|
||
|
/// ESS
|
||
|
/// ESS
|
||
|
/// </summary>
|
||
|
NET_ESS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// 人数统计服务器
|
||
|
/// </summary>
|
||
|
NET_IVS_PC,
|
||
|
|
||
|
/// <summary>
|
||
|
/// pc-nvr
|
||
|
/// pc-nvr
|
||
|
/// </summary>
|
||
|
NET_PC_NVR,
|
||
|
|
||
|
/// <summary>
|
||
|
/// screen controller
|
||
|
/// 大屏控制器
|
||
|
/// </summary>
|
||
|
NET_DSCON,
|
||
|
|
||
|
/// <summary>
|
||
|
/// network video storage server
|
||
|
/// 网络视频存储服务器
|
||
|
/// </summary>
|
||
|
NET_EVS,
|
||
|
|
||
|
/// <summary>
|
||
|
/// an embedded intelligent video analysis system
|
||
|
/// 嵌入式智能分析视频系统
|
||
|
/// </summary>
|
||
|
NET_EIVS,
|
||
|
|
||
|
/// <summary>
|
||
|
/// DVR-N6
|
||
|
/// DVR-N6
|
||
|
/// </summary>
|
||
|
NET_DVR_N6,
|
||
|
|
||
|
/// <summary>
|
||
|
/// K-Lite Codec Pack
|
||
|
/// 万能解码器
|
||
|
/// </summary>
|
||
|
NET_UDS,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Bank alarm host
|
||
|
/// 银行报警主机
|
||
|
/// </summary>
|
||
|
NET_AF6016,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Video network alarm host
|
||
|
/// 视频网络报警主机
|
||
|
/// </summary>
|
||
|
NET_AS5008,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Network alarm host
|
||
|
/// 网络报警主机
|
||
|
/// </summary>
|
||
|
NET_AH2008,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Alarm host series
|
||
|
/// 报警主机系列
|
||
|
/// </summary>
|
||
|
NET_A_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Access control series of products
|
||
|
/// 门禁系列产品
|
||
|
/// </summary>
|
||
|
NET_BSC_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// NVS series product
|
||
|
/// NVS系列产品
|
||
|
/// </summary>
|
||
|
NET_NVS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// VTO series product
|
||
|
/// VTO系列产品
|
||
|
/// </summary>
|
||
|
NET_VTO_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// VTNC series product
|
||
|
/// VTNC系列产品
|
||
|
/// </summary>
|
||
|
NET_VTNC_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// TPC series product, it is the thermal device
|
||
|
/// TPC系列产品, 即热成像设备
|
||
|
/// </summary>
|
||
|
NET_TPC_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// ASM series product
|
||
|
/// 无线中继设备
|
||
|
/// </summary>
|
||
|
NET_ASM_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// VTS series product
|
||
|
/// 管理机
|
||
|
/// </summary>
|
||
|
NET_VTS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Alarm host-ARC2016C
|
||
|
/// 报警主机ARC2016C
|
||
|
/// </summary>
|
||
|
NET_ARC2016C,
|
||
|
|
||
|
/// <summary>
|
||
|
/// ASA Attendance machine
|
||
|
/// 考勤机
|
||
|
/// </summary>
|
||
|
NET_ASA,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Industry terminal walkie-talkie
|
||
|
/// 行业对讲终端
|
||
|
/// </summary>
|
||
|
NET_VTT_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Alarm column
|
||
|
/// 报警柱
|
||
|
/// </summary>
|
||
|
NET_VTA_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// SIP Server
|
||
|
/// SIP服务器
|
||
|
/// </summary>
|
||
|
NET_VTNS_SERIAL,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Indoor unit
|
||
|
/// 室内机
|
||
|
/// </summary>
|
||
|
NET_VTH_SERIAL,
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询设备信息参数
|
||
|
/// </summary>
|
||
|
public enum EM_DEVICE_STATE
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Query device online state(return a DWORD value, 1-online, 0-offline)
|
||
|
/// 查询设备的在线状态(返回一个DWORD, 1表示在线, 0表示断线)
|
||
|
/// </summary>
|
||
|
ONLINE = 0x0035,
|
||
|
|
||
|
/// <summary>
|
||
|
/// Query ptz state(struct DH_PTZ_LOCATION_INFO)
|
||
|
/// 查询云台状态信息(对应结构体 DH_PTZ_LOCATION_INFO)
|
||
|
/// </summary>
|
||
|
PTZ_LOCATION = 0x0036,
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 预置点状态枚举
|
||
|
/// </summary>
|
||
|
public enum EM_DH_PTZ_PRESET_STATUS
|
||
|
{
|
||
|
UNKNOWN, // 未知
|
||
|
REACH, // 预置点到达
|
||
|
UNREACH, // 预置点未到达
|
||
|
}
|
||
|
|
||
|
#endregion SDK Enum
|
||
|
|
||
|
#region SDK Struct
|
||
|
|
||
|
/// <summary>
|
||
|
/// CLIENT_LoginWithHighLevelSecurity 输入参数
|
||
|
/// </summary>
|
||
|
public struct NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY
|
||
|
{
|
||
|
public uint dwSize;// 结构体大小
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||
|
public string szIP; // IP
|
||
|
|
||
|
public int nPort; // 端口
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||
|
public string szUserName; // 用户名
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||
|
public string szPassword; // 密码
|
||
|
|
||
|
public EM_LOGIN_SPAC_CAP_TYPE emSpecCap; // 登录模式
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||
|
public byte[] byReserved; // 字节对齐
|
||
|
|
||
|
public IntPtr pCapParam; // 见 CLIENT_LoginEx 接口 pCapParam 与 nSpecCap 关系
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// device information structure
|
||
|
/// 设备信息结构体
|
||
|
/// </summary>
|
||
|
public struct NET_DEVICEINFO_Ex
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// serial number
|
||
|
/// 序列号
|
||
|
/// </summary>
|
||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)]
|
||
|
public string sSerialNumber;
|
||
|
|
||
|
/// <summary>
|
||
|
/// count of alarm input
|
||
|
/// 报警输入个数
|
||
|
/// </summary>
|
||
|
public int nAlarmInPortNum;
|
||
|
|
||
|
/// <summary>
|
||
|
/// count of alarm output
|
||
|
/// 报警输出个数
|
||
|
/// </summary>
|
||
|
public int nAlarmOutPortNum;
|
||
|
|
||
|
/// <summary>
|
||
|
/// number of disk
|
||
|
/// 硬盘个数
|
||
|
/// </summary>
|
||
|
public int nDiskNum;
|
||
|
|
||
|
/// <summary>
|
||
|
/// device type, refer to EM_NET_DEVICE_TYPE
|
||
|
/// 设备类型,见枚举NET_DEVICE_TYPE
|
||
|
/// </summary>
|
||
|
public EM_NET_DEVICE_TYPE nDVRType;
|
||
|
|
||
|
/// <summary>
|
||
|
/// number of channel
|
||
|
/// 通道个数
|
||
|
/// </summary>
|
||
|
public int nChanNum;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Online Timeout, Not Limited Access to 0, not 0 Minutes Limit Said
|
||
|
/// 在线超时时间,为0表示不限制登陆,非0表示限制的分钟数
|
||
|
/// </summary>
|
||
|
public byte byLimitLoginTime;
|
||
|
|
||
|
/// <summary>
|
||
|
/// When login failed due to password error, notice user by this parameter.This parameter is invalid when remaining login times is zero
|
||
|
/// 当登陆失败原因为密码错误时,通过此参数通知用户,剩余登陆次数,为0时表示此参数无效
|
||
|
/// </summary>
|
||
|
public byte byLeftLogTimes;
|
||
|
|
||
|
/// <summary>
|
||
|
/// keep bytes for aligned
|
||
|
/// 保留字节,字节对齐
|
||
|
/// </summary>
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||
|
public byte[] bReserved;
|
||
|
|
||
|
/// <summary>
|
||
|
/// when log in failed,the left time for users to unlock (seconds), -1 indicate the device haven't set the parameter
|
||
|
/// 当登陆失败,用户解锁剩余时间(秒数), -1表示设备未设置该参数
|
||
|
/// </summary>
|
||
|
public int nLockLeftTime;
|
||
|
|
||
|
/// <summary>
|
||
|
/// reserved
|
||
|
/// 保留字节
|
||
|
/// </summary>
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
||
|
public byte[] Reserved;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// CLIENT_LoginWithHighLevelSecurity 输出参数
|
||
|
/// </summary>
|
||
|
public struct NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY
|
||
|
{
|
||
|
public uint dwSize;// 结构体大小
|
||
|
public NET_DEVICEINFO_Ex stuDeviceInfo; // 设备信息
|
||
|
public int nError; // 错误码,见 CLIENT_Login 接口错误码
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 132)]
|
||
|
public byte[] byReserved; // 保留字节
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 云台定位中非归一化坐标和变倍
|
||
|
/// </summary>
|
||
|
public struct NET_PTZSPACE_UNNORMALIZED
|
||
|
{
|
||
|
public int nPosX; // x坐标
|
||
|
public int nPosY; // y坐标
|
||
|
public int nZoom; // 放大倍率
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 52)]
|
||
|
public byte[] byReserved; // 预留字节
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 云台定位信息
|
||
|
/// </summary>
|
||
|
//云台定位信息
|
||
|
public struct DH_PTZ_LOCATION_INFO
|
||
|
{
|
||
|
public int nChannelID; // 通道号
|
||
|
public int nPTZPan; // 云台水平运动位置,有效范围:[0,3600]
|
||
|
public int nPTZTilt; // 云台垂直运动位置,有效范围:[-1800,1800]
|
||
|
public int nPTZZoom; // 云台光圈变动位置,有效范围:[0,128]
|
||
|
public byte bState; // 云台运动状态, 0-未知 1-运动 2-空闲
|
||
|
public byte bAction; // 云台动作,255-未知,0-预置点,1-线扫,2-巡航,3-巡迹,4-水平旋转,5-普通移动,6-巡迹录制,7-全景云台扫描,8-热度图
|
||
|
|
||
|
// 9-精确定位,10-设备校正,11-智能配置,12-云台重启
|
||
|
public byte bFocusState; // 云台聚焦状态, 0-未知, 1-运动状态, 2-空闲
|
||
|
|
||
|
public byte bEffectiveInTimeSection; // 在时间段内预置点状态是否有效
|
||
|
|
||
|
//如果当前上报的预置点是时间段内的预置点,则为1,其他情况为0
|
||
|
public int nPtzActionID; // 巡航ID号
|
||
|
|
||
|
public uint dwPresetID; // 云台所在预置点编号
|
||
|
public float fFocusPosition; // 聚焦位置
|
||
|
public byte bZoomState; // 云台ZOOM状态,0-未知,1-ZOOM,2-空闲
|
||
|
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||
|
public byte[] bReserved; // 对齐
|
||
|
|
||
|
public uint dwSequence; // 包序号,用于校验是否丢包
|
||
|
public uint dwUTC; // 对应的UTC(1970-1-1 00:00:00)秒数。
|
||
|
public EM_DH_PTZ_PRESET_STATUS emPresetStatus; // 预置点位置
|
||
|
|
||
|
/// <summary>
|
||
|
/// 保留字段
|
||
|
/// </summary>
|
||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 248)]
|
||
|
public int[] reserved;
|
||
|
};
|
||
|
|
||
|
#endregion SDK Struct
|
||
|
|
||
|
#region Common Method
|
||
|
|
||
|
/// <summary>
|
||
|
/// network disconnection callback function original shape
|
||
|
/// 断线回调函数
|
||
|
/// </summary>
|
||
|
/// <param name="lLoginID">user LoginID:Login's returns value 登陆ID</param>
|
||
|
/// <param name="pchDVRIP">device IP 设备IP</param>
|
||
|
/// <param name="nDVRPort">device prot 设备端口</param>
|
||
|
/// <param name="dwUser">user data from Init function 用户数据</param>
|
||
|
public delegate void fDisConnectCallBack(IntPtr lLoginID, IntPtr pchDVRIP, int nDVRPort, IntPtr dwUser);
|
||
|
|
||
|
/// <summary>
|
||
|
/// network re-connection callback function original shape
|
||
|
/// 重连回调函数
|
||
|
/// </summary>
|
||
|
/// <param name="lLoginID">user LoginID:Login's returns value 登陆ID</param>
|
||
|
/// <param name="pchDVRIP">device IP,string type 设备IP</param>
|
||
|
/// <param name="nDVRPort">device prot 设备端口</param>
|
||
|
/// <param name="dwUser">user data from SetAutoReconnect function 用户数据</param>
|
||
|
public delegate void fHaveReConnectCallBack(IntPtr lLoginID, IntPtr pchDVRIP, int nDVRPort, IntPtr dwUser);
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern bool CLIENT_InitEx(fDisConnectCallBack? cbDisConnect, IntPtr dwUser, IntPtr lpInitParam);
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern void CLIENT_Cleanup();
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern int CLIENT_GetLastError();
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern IntPtr CLIENT_LoginWithHighLevelSecurity(ref NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY pstInParam, ref NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY pstOutParam);
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern bool CLIENT_Logout(IntPtr lLoginID);
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern void CLIENT_SetAutoReconnect(fHaveReConnectCallBack cbAutoConnect, IntPtr dwUser);
|
||
|
|
||
|
[DllImport(LibDhNetSDK)]
|
||
|
public static extern bool CLIENT_QueryDevState(IntPtr lLoginID, int nType, IntPtr pBuf, int nBufLen, ref int pRetLen, int waittime);
|
||
|
|
||
|
#endregion Common Method
|
||
|
}
|