public bool VideoClose()
        {
            CommonMethod.LogWrite.WriteEventLog("EzvizLog", "VideClose", ProgParameter.ProgLogAddress);
            bool bolResult = false;

            SDK_EzvizSDK.OpenSDK_StopRealPlayEx(intptrSessionID);
            SDK_EzvizSDK.OpenSDK_FreeSession(intptrSessionID.ToString());

            //if (Ezviz_gchMsgBack != null && Ezviz_gchMsgBack.IsAllocated)
            //{
            //    Ezviz_gchMsgBack.Free();
            //}
            if (CurrentVideoPlaySet.VideoRecordEnable)
            {
                byte[] bytsSource = lstVideoRecord.ToArray();
                lstVideoRecord.Clear();
                Ezviz_GenerateRecord(bytsSource, strRealSavePath);
                //if (Ezviz_gchVideoRecord != null && Ezviz_gchVideoRecord.IsAllocated)
                //{
                //    Ezviz_gchVideoRecord.Free();
                //}
            }
            else
            {
                lstVideoRecord = new List <byte>();
            }
            VideoRecordStatus = false;
            intptrSessionID   = IntPtr.Zero;
            strRealSavePath   = "";
            if (ProgParameter.Ezviz_VideoPlayEnvironmentReset)
            {
                SDKState.Ezviz_SDKRelease();
            }
            return(bolResult);
        }
示例#2
0
        public void OpenSDK_StartRealPlay_OldTest()
        {
            VideoPlayControl.ProgParameter.strEzviz__AppID    = "5b97c1d157474f96b8d4c75b936a0057";
            VideoPlayControl.ProgParameter.strEzviz_AppSecret = "4318d0cc4c43ca156052ba688bc9006a";

            SDK_EzvizSDK.OpenSDK_InitLib(ProgParameter.strEzviz__AuthAddr, ProgParameter.strEzviz__PlatForm, ProgParameter.strEzviz__AppID);
            JsonRequestResult result = SDK_EzvizSDK.GetAccessToken();

            timStartTime = DateTime.Now;
            string     strSession;
            IntPtr     intptrSession = IntPtr.Zero;
            int        intLenght     = 0;
            PictureBox pic           = new PictureBox();

            SDK_EzvizSDK.MsgHandler m = new SDK_EzvizSDK.MsgHandler(MsgHandler);
            int intResult             = SDK_EzvizSDK.OpenSDK_AllocSession(m, IntPtr.Zero, ref intptrSession, ref intLenght, false, uint.MaxValue);

            strSession = Marshal.PtrToStringAnsi(intptrSession);
            intResult  = SDK_EzvizSDK.OpenSDK_StartRealPlay_Old(intptrSession, pic.Handle, "667ed52a9d834fdfa3692ba0a39b94a5", ProgParameter.strEzviz_AccessToken, 0, null, ProgParameter.strEzviz__AppID);
            Delay_Millisecond(10000);
            intResult = SDK_EzvizSDK.OpenSDK_StopRealPlay(intptrSession, 0);
            //Thread.Sleep(5000);
            intResult = SDK_EzvizSDK.OpenSDK_FreeSession(strSession);
            SDK_EzvizSDK.OpenSDK_FiniLib();
            Assert.AreEqual("1", strSession);
        }
示例#3
0
        public int TestRelease(IntPtr intptrSession)
        {
            int intResult = 0;

            intResult = SDK_EzvizSDK.OpenSDK_StopRealPlayEx(intptrSession);
            intResult = SDK_EzvizSDK.OpenSDK_FreeSession(intptrSession);
            intResult = SDK_EzvizSDK.OpenSDK_FiniLib();
            return(intResult);
        }
示例#4
0
        public void OpenSDK_AllocSessionExTest()
        {
            SDK_EzvizSDK.OpenSDK_InitLib(ProgParameter.strEzviz__AuthAddr, ProgParameter.strEzviz__PlatForm, ProgParameter.strEzviz__AppID);
            //GetTokenResult result = SDK_EzvizSDK.GetAccessToken();
            string strSession;
            IntPtr intptrSession = IntPtr.Zero;
            int    intLenght     = 0;

            SDK_EzvizSDK.MsgHandler m = new SDK_EzvizSDK.MsgHandler(MsgHandler);
            int intResult             = SDK_EzvizSDK.OpenSDK_AllocSessionEx(m, IntPtr.Zero, out intptrSession, out intLenght);

            strSession = Marshal.PtrToStringAnsi(intptrSession);
            intResult  = SDK_EzvizSDK.OpenSDK_FreeSession(strSession);
            SDK_EzvizSDK.OpenSDK_FiniLib();
            Assert.AreEqual("1", strSession);
        }
示例#5
0
        public void OpenSDK_StartRealPlayExTest()
        {
            VideoPlayControl.ProgParameter.strEzviz__AppID    = "5b97c1d157474f96b8d4c75b936a0057";
            VideoPlayControl.ProgParameter.strEzviz_AppSecret = "4318d0cc4c43ca156052ba688bc9006a";
            int intResult = 0;

            intResult = SDK_EzvizSDK.OpenSDK_InitLib(ProgParameter.strEzviz__AuthAddr, ProgParameter.strEzviz__PlatForm, ProgParameter.strEzviz__AppID);
            JsonRequestResult result      = SDK_EzvizSDK.GetAccessToken();
            IntPtr            intptrToken = Marshal.StringToHGlobalAnsi(ProgParameter.strEzviz_AccessToken);

            intResult = SDK_EzvizSDK.OpenSDK_SetAccessToken(intptrToken);
            IntPtr     intptrSession = IntPtr.Zero;
            int        intLenght     = 0;
            PictureBox pic           = new PictureBox();

            SDK_EzvizSDK.MsgHandler m = new SDK_EzvizSDK.MsgHandler(MsgHandler);
            timStartTime = DateTime.Now;
            intResult    = SDK_EzvizSDK.OpenSDK_AllocSessionEx(m, IntPtr.Zero, out intptrSession, out intLenght);
            //intResult = SDK_EzvizSDK.OpenSDK_SetVideoLevel(intptrSession, 1, 1);
            SDK_EzvizSDK.DataCallBack callback = new SDK_EzvizSDK.DataCallBack(DataCallBack);
            //IntPtr inptrUser = Marshal.StringToHGlobalAnsi("10086");
            //intResult = SDK_EzvizSDK.OpenSDK_SetDataCallBack(intptrSession, callback, inptrUser);
            intResult = SDK_EzvizSDK.GetDevOnlineState("797085722", 1);
            IntPtr ii = Marshal.StringToHGlobalAnsi("797085722");

            intResult = SDK_EzvizSDK.OpenSDK_StartRealPlayEx(intptrSession, IntPtr.Zero, ii, 1, "CHZUVA");
            //int intErrorCode = 0;
            //string strErrorDesc = "";
            //if (intResult == -1)
            //{
            //    //错误码
            //    intErrorCode = SDK_EzvizSDK.OpenSDK_GetLastErrorCode();
            //    IntPtr i = SDK_EzvizSDK.OpenSDK_GetLastErrorDesc();
            //    strErrorDesc = Marshal.PtrToStringAnsi(i);
            //}
            Delay_Millisecond(10000);
            intResult = SDK_EzvizSDK.OpenSDK_StopRealPlayEx(intptrSession);
            intResult = SDK_EzvizSDK.OpenSDK_FreeSession(intptrSession);
            SDK_EzvizSDK.OpenSDK_FiniLib();
            Assert.AreEqual("1", intResult);
        }
示例#6
0
        public void OpenSDK_StartRealPlayTest()
        {
            SDK_EzvizSDK.OpenSDK_InitLib(ProgParameter.strEzviz__AuthAddr, ProgParameter.strEzviz__PlatForm, ProgParameter.strEzviz__AppID);
            JsonRequestResult result = SDK_EzvizSDK.GetAccessToken();
            string            strSession;
            IntPtr            intptrSession = IntPtr.Zero;
            int        intLenght            = 0;
            PictureBox pic = new PictureBox();

            SDK_EzvizSDK.MsgHandler m = new SDK_EzvizSDK.MsgHandler(MsgHandler);
            int intResult             = SDK_EzvizSDK.OpenSDK_AllocSession(m, IntPtr.Zero, ref intptrSession, ref intLenght, false, uint.MaxValue);

            strSession = Marshal.PtrToStringAnsi(intptrSession);
            intResult  = SDK_EzvizSDK.OpenSDK_StartRealPlay(intptrSession, pic.Handle, "7e1c18bad66544408b38d1711552e320", ProgParameter.strEzviz_AccessToken, 0, null, ProgParameter.strEzviz__AppID, 0);
            Delay_Millisecond(10000);
            intResult = SDK_EzvizSDK.OpenSDK_StopRealPlayEx(intptrSession);
            Delay_Millisecond(10000);
            intResult = SDK_EzvizSDK.OpenSDK_FreeSession(strSession);
            SDK_EzvizSDK.OpenSDK_FiniLib();
            Assert.AreEqual("1", strSession);
        }