Exemplo n.º 1
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        public override KeyValuePair <bool, string> Login()
        {
            if (this.IsLogin)
            {
                this.Logout();
            }
            try
            {
                //Sdk 初始化
                if (!this.sdkInit)
                {
                    if (!SDKWrap.NET_DVR_Init())
                    {
                        return(new KeyValuePair <bool, string>(false, string.Format("初始化SDK失败,错误消息:{0}", this.GetLastError())));
                    }
                    else
                    {
                        this.sdkInit = true;
                    }
                }

                var deviceInfo = new SDKTypes.NET_DVR_DEVICEINFO_V30();

                //执行SDK登录
                int ret = SDKWrap.NET_DVR_Login_V30(this.IP, this.Port, this.UserName, this.Password, ref deviceInfo);

                if (ret < 0)
                {
                    return(new KeyValuePair <bool, string>(false, string.Format("登录失败,错误消息:{0}", this.GetLastError())));
                }
                else
                {
                    this.userId     = ret;
                    this.DeviceInfo = deviceInfo;
                    return(new KeyValuePair <bool, string>(true, "登录成功!"));
                }
            }
            catch (Exception ex)
            {
                return(new KeyValuePair <bool, string>(false, string.Format("登录失败,异常消息:{0}", ex.Message)));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 设备登录 NET_DVR_Login_V30
 /// </summary>
 /// <param name="sDVRIP"> 设备IP地址 </param>
 /// <param name="wDVRPort"> 设备端口号 </param>
 /// <param name="sUserName"> 登录的用户名 </param>
 /// <param name="sPassword"> 用户密码 </param>
 /// <param name="lpDeviceInfo"> [out] 设备信息 </param>
 /// <returns></returns>
 public static Int32 NET_DVR_Login_V30(string sDVRIP, Int32 wDVRPort, string sUserName, string sPassword, ref SDKTypes.NET_DVR_DEVICEINFO_V30 lpDeviceInfo)
 {
     if (IsLinux())
     {
         return(NET_DVR_Login_V30_LINUX(sDVRIP, wDVRPort, sUserName, sPassword, ref lpDeviceInfo));
     }
     else
     {
         return(NET_DVR_Login_V30_WIN(sDVRIP, wDVRPort, sUserName, sPassword, ref lpDeviceInfo));
     }
 }
Exemplo n.º 3
0
 private static extern Int32 NET_DVR_Login_V30_LINUX(string sDVRIP, Int32 wDVRPort, string sUserName, string sPassword, ref SDKTypes.NET_DVR_DEVICEINFO_V30 lpDeviceInfo);