海康威视 NET_DVR_GetDVRWorkState 错误
/// <summary> /// 通道信息(通道状态) /// NET_DVR_CHANNELSTATE, *LPNET_DVR_CHANNELSTATE; /// </summary> public struct NET_DVR_CHANNELSTATE { public byte byRecordStatic; //通道是否在录像,0-不录像,1-录像 public byte bySignalStatic; //连接的信号状态,0-正常,1-信号丢失 public byte byHardwareStatic;//通道硬件状态,0-正常,1-异常,例如DSP死掉 public char reservedData; public uint dwBitRate;//实际码率 public uint dwLinkNum;//客户端连接的个数 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] //MAX_LINK public uint[] dwClientIP;//客户端的IP地址 } /// <summary> /// 14.2.1 硬盘信息结构体 /// NET_DVR_DISKSTATE, *LPNET_DVR_DISKSTATE; /// </summary> public struct NET_DVR_DISKSTATE { public uint dwVolume;//硬盘的容量 public uint dwFreeSpace;//硬盘的剩余空间 public uint dwHardDiskStatic; //硬盘的状态,休眠,活动,不正常等 } /// <summary> /// 设备状态信息结构体(DVR工作状态) /// NET_DVR_WORKSTATE, *LPNET_DVR_WORKSTATE; /// </summary> public struct NET_DVR_WORKSTATE { public uint dwDeviceStatic; //设备的状态,0-正常,1-CPU占用率太高,超过85%,2-硬件错误,例如串口死掉 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public NET_DVR_DISKSTATE[] struHardDiskStatic; //MAX_DISKNUM [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public NET_DVR_CHANNELSTATE[] struChanStatic;//通道的状态MAX_CHANNUM [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] byAlarmInStatic; //报警端口的状态,0-没有报警,1-有报警MAX_ALARMIN [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] byAlarmOutStatic; //报警输出端口的状态,0-没有输出,1-有报警输出MAX_ALARMOUT public uint dwLocalDisplay;//本地显示状态,0-正常,1-不正常 } /// <summary> /// 获取硬盘录像机工作状态 /// NET_DVR_API BOOL __stdcall NET_DVR_GetDVRWorkState(LONG lUserID, LPNET_DVR_WORKSTATE lpWorkState); /// </summary> /// <param name="lUserID">[in]NET_DVR_Login或者NET_DVR_Login_V30的返回值</param> /// <param name="lpWorkState">[out]存放获得工作状态信息</param> /// <returns></returns> [DllImport("HCNetSDK.dll")] public static extern bool NET_DVR_GetDVRWorkState(int lUserID, out NET_DVR_WORKSTATE lpWorkState);
HCNetSDK.NET_DVR_WORKSTATE WorkState;
if (HCNetSDK.IsInitDvr == true && lUserID >= 0)
{
HCNetSDK.NET_DVR_GetDVRWorkState(lUserID, out WorkState);
}
生活不易,五行缺金,求打点