Exemplo n.º 1
0
 public bool Open()
 {
     try
     {
         int ret = -1;
         if (!HCNetSDK.NET_DVR_Init())
         {
             return(false);
         }
         _user_id = HCNetSDK.NET_DVR_Login_V30(_ip, _port, _user_name, _password, out deviceInfo);
         if (_user_id < 0)
         {
             return(false);
         }
         _dec_handle = HCNetSDK.NET_DVR_InitG722Encoder();
         // 增加消息处理时间
         if (MessageReceived != null)
         {
             IntPtr pUser = new IntPtr();
             bool   bRet  = HCNetSDK.NET_DVR_SetDVRMessageCallBack_V30(MessageReceived, pUser);
             _alarm_handle = HCNetSDK.NET_DVR_SetupAlarmChan_V30(_user_id);
         }
         return(true);
     }
     catch (Exception ex)
     {
         WriteLog("硬盘录像机打开失败:" + ex.Message);
         return(false);
     }
 }
Exemplo n.º 2
0
        public bool Connect(string DVRIPAddress, ushort DVRPortNumber, string DVRUserName, string DVRPassword)
        {
            NET_DVR_DEVICEINFO_V30 lpDeviceInfo;

            if (Environment.Is64BitProcess)
            {
                lUserID = HCNetSDKia64.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, out lpDeviceInfo);
            }
            else
            {
                lUserID = HCNetSDK.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, out lpDeviceInfo);
            }
            if (lUserID == -1)
            {
                Error();
            }
            if (lpDeviceInfo.byIPChanNum > 0)
            {
                this.Mode = DevType.NVR;
            }
            else
            {
                this.Mode = DevType.IPC;
                Channel   = lpDeviceInfo.byChanNum;
            }
            return(true);
        }
Exemplo n.º 3
0
 //-----------------------------新API-------------------------------
 #region <DVR 函数>
 // 登录DVR系统
 public bool Login()
 {
     _user_id = HCNetSDK.NET_DVR_Login_V30(_ip, _port, _user_name, _password, out deviceInfo);
     if (_user_id < 0)
     {
         return(false);
     }
     return(true);
 }
        public void Init(ref DeviceInfo deviceInfo)
        {
            try
            {
                ErrMessage    = "";
                IsValidDevice = false;
                int  devicenumber = 0;
                bool bRtn         = HCNetSDK.NET_DVR_Init(); //初始化SDK
                if (!bRtn)
                {
                    return;
                }
                NET_DVR_DEVICEINFO_V30 RESULT;  //得到设备参数的结构体
                int serviceId = HCNetSDK.NET_DVR_Login_V30(deviceInfo.source, (ushort)deviceInfo.Port, deviceInfo.login, deviceInfo.pwd, out RESULT);
                ServiceId = serviceId;
                HikPlayer.PlayM4_InitDDrawDevice();
                deviceInfo.ServiceID = serviceId;
                if (serviceId > -1)
                {
                    deviceInfo.IsReady = true;
                    IsValidDevice      = true;
                }
                else
                {
                    deviceInfo.IsReady = false;
                    IsValidDevice      = false;
                }
                IsValidEncodeCard = HCNetSDK.NET_DVR_InitDevice_Card(ref devicenumber);
                DecodeCardNum     = devicenumber;
                if (devicenumber > 0)
                {
                    IsValidEncodeCard = HCNetSDK.NET_DVR_InitDDraw_Card(deviceInfo.Handle, 0xffffff);
                }



                _deviceInfo = deviceInfo;
            }
            catch (Exception ex)
            {
                ErrMessage = ex.Message;
            }
        }
Exemplo n.º 5
0
        public void Init(ref DeviceInfo deviceInfo)
        {
            if ((!deviceInfo.IsReady) || deviceInfo.ServiceID < 0)
            {
                bool bRtn = HCNetSDK.NET_DVR_Init(); //初始化SDK

                NET_DVR_DEVICEINFO_V30 RESULT;       //得到设备参数的结构体
                int serviceId = HCNetSDK.NET_DVR_Login_V30(deviceInfo.source, (ushort)deviceInfo.Port, deviceInfo.login, deviceInfo.pwd, out RESULT);
                deviceInfo.ServiceID = serviceId;
                if (serviceId > -1)
                {
                    deviceInfo.IsReady = true;
                }
                else
                {
                    deviceInfo.IsReady = false;
                }
                HikPlayer.PlayM4_InitDDrawDevice();
            }
            _deviceInfo = deviceInfo;
        }
Exemplo n.º 6
0
 // 登录DVR系统
 public int SDK_Login(string ip, ushort port, string username, string password)
 {
     _user_id = HCNetSDK.NET_DVR_Login_V30(ip, port, username, password, out deviceInfo);
     return(_user_id);
 }