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); }
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); }
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); }
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); }
/// <summary> /// 开始对讲 /// </summary> /// <param name="talkModel"></param> /// <returns></returns> public override bool StartTlak(Enum_TalkModel talkModel) { if (CurrentTalkStatus != Enum_TalkStatus.Null) //处于对讲中 先关闭 { StopTalk(); } StartTalking(null); int intResult = 0; int intLenght = 0; int intTalkChannel = CurrentTalkChannel.VideoTalkChannel - 1; callBack = new SDK_EzvizSDK.MsgHandler(Ezviz_MsgCallback); string strUser = CurrentVideoInfo.DVSAddress + "_" + CurrentTalkChannel.VideoTalkChannel; iUser = Marshal.StringToHGlobalAnsi(strUser); intResult = SDK_EzvizSDK.OpenSDK_AllocSessionEx(callBack, iUser, out intptrSessionID, out intLenght); IntPtr intptrdevSerial = Marshal.StringToHGlobalAnsi(CurrentVideoInfo.DVSAddress); SDK_EzvizSDK.OpenSDK_StartVoiceTalkEx(intptrSessionID, intptrdevSerial, CurrentTalkChannel.VideoTalkChannel); CurrentTalkStatus = (Enum_TalkStatus)(int)talkModel; return(false); }
public void OpenSDK_Data_GetDeviceInfoTest() { int intResult = 0; intResult = TestInit(); IntPtr intptrSession = IntPtr.Zero; int intLenght = 0; SDK_EzvizSDK.MsgHandler m = new SDK_EzvizSDK.MsgHandler(MsgHandler); intResult = SDK_EzvizSDK.OpenSDK_AllocSessionEx(m, IntPtr.Zero, out intptrSession, out intLenght); SDK_EzvizSDK.DataCallBack callback = new SDK_EzvizSDK.DataCallBack(DataCallBack); IntPtr intptrToken = Marshal.StringToHGlobalAnsi(ProgParameter.strEzviz_AccessToken); IntPtr intptrDevSerial = Marshal.StringToHGlobalAnsi("756217914"); IntPtr intptrDevInfo = IntPtr.Zero; int intLength; intResult = SDK_EzvizSDK.OpenSDK_Data_GetDeviceInfo(intptrToken, intptrDevSerial, out intptrDevInfo, out intLength); string strResult = Marshal.PtrToStringAnsi(intptrDevInfo); intResult = TestRelease(intptrSession); Assert.AreEqual("1", strResult); }
private bool Ezviz_VideoPlay() { bool bolResult = false; int intLenght = 0; int intResult = 0; //CurrentVideoInfo.NetworkState = SDK_EzvizSDK.GetDevOnlineState(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel); int Temp_intResult = SDK_EzvizSDK.GetDevOnlineState(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel); if (Temp_intResult == -2) { //设备无权限 VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.NoDeviceAuthority }); return(bolResult); } CurrentVideoInfo.NetworkState = Temp_intResult; if (Temp_intResult == 0) { //设备离线 VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.VideoDeviceNotOnline }); return(bolResult); } //状态未明进行连接 callBack = new SDK_EzvizSDK.MsgHandler(Ezviz_MsgCallback); Ezviz_gchMsgBack = GCHandle.Alloc(callBack); strUser = CurrentVideoInfo.DVSAddress + "_" + CurrentCameraInfo.Channel; iUser = Marshal.StringToHGlobalAnsi(strUser); VideoPlayState = Enum_VideoPlayState.Connecting; intResult = SDK_EzvizSDK.OpenSDK_AllocSessionEx(callBack, iUser, out intptrSessionID, out intLenght); if (CurrentVideoPlaySet.VideoRecordEnable) { //录像启用 strRealSavePath = GetLocalSavePath(CurrentVideoPlaySet.VideoRecordFilePath, CurrentVideoPlaySet.VideoRecordFileName); if (!Directory.Exists(CurrentVideoPlaySet.VideoRecordFilePath)) { Directory.CreateDirectory(CurrentVideoPlaySet.VideoRecordFilePath); } Ezviz_DataCallBack = new SDK_EzvizSDK.DataCallBack(Ezviz_DataCallBackEvent); Ezviz_gchVideoRecord = GCHandle.Alloc(Ezviz_DataCallBack); intResult = SDK_EzvizSDK.OpenSDK_SetDataCallBack(intptrSessionID, Ezviz_DataCallBack, iUser); VideoRecordStatus = true; } IntPtr intptrdevSerial = Marshal.StringToHGlobalAnsi(CurrentVideoInfo.DVSAddress); if (CurrentVideoInfo.DVSAddress.StartsWith("C")) { intResult = SDK_EzvizSDK.OpenSDK_StartPlayWithStreamType(intptrSessionID, intptrPlayMain, intptrdevSerial, CurrentCameraInfo.Channel, CurrentVideoInfo.Password, -1); } else { intResult = SDK_EzvizSDK.OpenSDK_StartRealPlayEx(intptrSessionID, intptrPlayMain, intptrdevSerial, CurrentCameraInfo.Channel, CurrentVideoInfo.Password); } if (intResult == 0) { VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.ConnSuccess }); } else { VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.ConnFailed }); } return(bolResult); }