Ejemplo n.º 1
0
 public void StartPlay(IntPtr handle)
 {
     iRealHandle = DHNetSDK.CLIENT_StartRealPlay(iLoginUserId, VideoInfo.Channel, handle, DHNetSDK.EM_RealPlayType.Realplay, null, null, IntPtr.Zero, 0);
     if (IntPtr.Zero == iRealHandle)
     {
         throw new Exception("[大华]播放失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(iRealHandle));
     }
 }
Ejemplo n.º 2
0
        public void StopRecord()
        {
            bool result = DHNetSDK.CLIENT_StopSaveRealData(iRealHandle);

            if (!result)
            {
                throw new Exception("[大华]保存录像失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(result));
            }
        }
Ejemplo n.º 3
0
        public void StopPlay()
        {
            bool result = DHNetSDK.CLIENT_StopRealPlayEx(iRealHandle);

            if (!result)
            {
                throw new Exception("[大华]停止预览失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(result));
            }
        }
Ejemplo n.º 4
0
        public void StartRecord()
        {
            bool result = DHNetSDK.CLIENT_SaveRealData(iRealHandle, Helper.UniqueFile(SaveFileType.Video, FileExtensionType.dav));

            if (!result)
            {
                throw new Exception("[大华]录像失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(result));
            }
        }
Ejemplo n.º 5
0
        public void LogOut()
        {
            bool logout = DHNetSDK.CLIENT_Logout(iLoginUserId);

            if (!logout)
            {
                throw new Exception("[大华]注销登录失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(logout));
            }
            else
            {
                iLoginUserId = IntPtr.Zero;
            }
        }
Ejemplo n.º 6
0
        public void Login(LoginInfo logininfo)
        {
            DHNetSDK.NET_DEVICEINFO_Ex dinfo = new DHNetSDK.NET_DEVICEINFO_Ex();

            int error = 0;

            iLoginUserId = DHNetSDK.CLIENT_LoginEx2(logininfo.Ip, Convert.ToUInt16(logininfo.Port), logininfo.UserName, logininfo.Password, DHNetSDK.EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref dinfo, ref error);

            if (IntPtr.Zero == iLoginUserId)
            {
                throw new Exception("[大华]登录失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(iLoginUserId));
            }
        }
Ejemplo n.º 7
0
        public string Capture2Image()
        {
            string fileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.jpg);
            bool   result   = DHNetSDK.CLIENT_CapturePicture(iRealHandle, fileName, DHNetSDK.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG);

            if (!result)
            {
                throw new Exception("[大华]抓图失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(result));
            }
            else
            {
                return(fileName);
            }
        }
Ejemplo n.º 8
0
 public void Init()
 {
     try
     {
         bool init = DHNetSDK.CLIENT_Init(null, IntPtr.Zero);
         if (!init)
         {
             throw new Exception("[大华]SDK初始化失败:" + DHNetSDK.GetErrorMessage(init));
         }
     }
     catch (Exception ex)
     {
         throw new Exception("[大华]SDK初始化失败:" + Environment.NewLine + ex.Message);
     }
 }
Ejemplo n.º 9
0
        public string Capture2Base64()
        {
            string fileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.jpg);
            bool   result   = DHNetSDK.CLIENT_CapturePicture(iRealHandle, fileName, DHNetSDK.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG);

            if (!result)
            {
                throw new Exception("[大华]抓图失败:" + Environment.NewLine + DHNetSDK.GetErrorMessage(result));
            }
            else
            {
                Bitmap bmp = new Bitmap(fileName);

                using (MemoryStream ms1 = new MemoryStream())
                {
                    bmp.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] arr1 = new byte[ms1.Length];
                    ms1.Position = 0;
                    ms1.Read(arr1, 0, (int)ms1.Length);
                    ms1.Close();
                    return(Convert.ToBase64String(arr1));
                }
            }
        }