/// <summary> /// initialize the images' loading /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); NETClient.NETInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = false; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); }
/// <summary> /// 画面加载初期化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = false; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); }
/// <summary> /// 画面加载初期化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = true; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); this.FormClosing += new FormClosingEventHandler((a, b) => { System.Diagnostics.Process.GetProcessesByName("SDKDownLoadFileDemo.exe"); }); }
private void DownloadProgress(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize) { if (dwDownLoadSize != 0xFFFFFFFF && dwDownLoadSize != 0xFFFFFFFE && dwDownLoadSize <= dwTotalSize) { int iPos = (int)((dwDownLoadSize * 100) / dwTotalSize); Console.WriteLine(iPos.ToString() + " " + dwDownLoadSize.ToString() + "/" + dwTotalSize.ToString()); psbMain.Value = iPos; } else { if (0xFFFFFFFF == dwDownLoadSize) { //btnDownLoad2.Tag = ""; psbMain.Value = 0; MessageUtil.ShowMsgBox(StringUtil.ConvertString("下载结束!")); //btnDownLoad1.Enabled = true; //btnDownLoad2.Enabled = true; psbMain.Value = 0; //DHClient.DHStopDownload(lPlayHandle); } else if (0xFFFFFFFE == dwDownLoadSize) { //btnDownLoad2.Tag = ""; psbMain.Value = 0; MessageUtil.ShowMsgBox(StringUtil.ConvertString("磁盘空间不足!")); //btnDownLoad1.Enabled = true; //btnDownLoad2.Enabled = true; psbMain.Value = 0; //setProgressPos = new fSetProgressPos(DownloadProgress); setProgressPos -= new fSetProgressPos(DownloadProgress); //this.btnOK.Text = "重试"; downLoadFun -= new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun -= new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); this.Close(); //DHClient.DHStopDownload(lPlayHandle); } } }
private void frm_DownLoadVadioByTime_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); for (int i = 0; i < 5; i++) { cmbChannelSelect.Items.Add(i.ToString()); } //cmbChannelSelect.Items.Add("全部"); cmbChannelSelect.SelectedIndex = 0; dtpStart.Value = DateTime.Now.AddDays(-7); txtDirPath2.Text = this.DownLoadPath; txtFileName2.Text = this.DownLoadFileName; Utility.StringUtil.InitControlText(this); }
public static extern IntPtr CLIENT_DownloadMediaFile(IntPtr lLoginID, EM_FILE_QUERY_TYPE emType, IntPtr lpMediaFileInfo, IntPtr sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData, IntPtr reserved);
public static extern IntPtr CLIENT_DownloadByRecordFile(IntPtr lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData);
/// <summary> /// Download designated intelligent analysis of data - pictures /// </summary> /// <param name="lLoginID">CLIENT_Login的return value</param> /// <param name="emType">EM_FILE_QUERY_TYPEEnum values</param> /// <param name="lpMediaFileInfo"></param> /// <param name="sSavedFileName"></param> /// <param name="cbDownLoadPos"></param> /// <param name="dwUserData"></param> /// <param name="reserved"></param> /// <returns></returns> public static Int32 NETDownloadMediaFile(Int32 lLoginID, EM_FILE_QUERY_TYPE emType, IntPtr lpMediaFileInfo, string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, UInt32 dwUserData, IntPtr reserved) { Int32 nReturn = 0; try { nReturn = CLIENT_DownloadMediaFile(lLoginID, emType, lpMediaFileInfo, sSavedFileName, cbDownLoadPos, dwUserData, reserved); VIDEOThrowLastError(nReturn); } catch (System.Exception ex) { VIDEOThrowLastError(ex); nReturn = 0; } return nReturn; }
public static extern int H264_DVR_PlayBackByName_V2(int lLoginID, ref H264_DVR_FILE_DATA sPlayBackFile, fDownLoadPosCallBack cbDownLoadPos, fRealDataCallBack_V2 fDownLoadDataCallBack, int dwDataUser);
public static extern int H264_DVR_PlayBackByName_V2(int lLoginID,ref H264_DVR_FILE_DATA sPlayBackFile, fDownLoadPosCallBack cbDownLoadPos, fRealDataCallBack_V2 fDownLoadDataCallBack, int dwDataUser);
public static extern int H264_DVR_GetFileByName(int lLoginID, ref H264_DVR_FILE_DATA sPlayBackFile, string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, int dwDataUser);
private static extern int CLIENT_PlayBackByRecordFileEx(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser,fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
/// <summary> /// net palyback[note:After the user logs in a device, each channel at the same time can only play a video, can't play the same channel multiple records at the same time] /// </summary> /// <param name="lpRecordFile">Video file information, When press time play is only need to fill the start time and end time, and other items to fill 0</param> /// <param name="hWnd">Playback container name handle</param> /// <param name="cbDownLoadPos">Progress of the callback function</param> /// <param name="dwUserData">SYSNAME</param> /// <returns>Successful return to network playback ID, failure returns 0</returns> public long PlayBackByRecordFile(NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData) { long returnValue; returnValue = CLIENT_PlayBackByRecordFile(pClientInfo.ID, ref lpRecordFile, hWnd, cbDownLoadPos, dwUserData); ThrowLastError(); return returnValue; }
private static extern int CLIENT_DownloadByRecordFile(int lLoginID,ref NET_RECORDFILE_INFO lpRecordFile,string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData);
private static extern Int32 CLIENT_DownloadMediaFile(Int32 lLoginID,EM_FILE_QUERY_TYPE emType, IntPtr lpMediaFileInfo, string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, UInt32 dwUserData, IntPtr reserved);
public static int NETPlayBackByTimeEx2(int lLoginID, int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser, int nDirection, int nWaittime) { try { int returnValue = 0; NET_IN_PLAY_BACK_BY_TIME_INFO pbTimeInParam = new NET_IN_PLAY_BACK_BY_TIME_INFO(); pbTimeInParam.stStartTime = ToNetTime(tmStart); pbTimeInParam.stStopTime = ToNetTime(tmEnd); pbTimeInParam.hWnd = hWnd; pbTimeInParam.cbDownLoadPos = cbDownLoadPos; pbTimeInParam.dwPosUser = dwPosUser; pbTimeInParam.fDownLoadDataCallBack = fDownLoadDataCallBack; pbTimeInParam.dwDataUser = dwDataUser; pbTimeInParam.nPlayDirection = nDirection; pbTimeInParam.nWaittime = nWaittime; NET_OUT_PLAY_BACK_BY_TIME_INFO pbTimeOutParam = new NET_OUT_PLAY_BACK_BY_TIME_INFO(); returnValue = CLIENT_PlayBackByTimeEx2(lLoginID, nChannelID, ref pbTimeInParam, ref pbTimeOutParam); NETThrowLastError(returnValue); return returnValue; } catch (Exception e) { NETThrowLastError(e); return 0; } }
/// <summary> /// network by time playback /// </summary> /// <param name="lLoginID">Device handle user login</param> /// <param name="nChannelID">channelID</param> /// <param name="tmStart">The video start time</param> /// <param name="tmEnd">Recording end time</param> /// <param name="hWnd">Playback container handler</param> /// <param name="cbDownLoadPos">Progress callback function</param> /// <param name="dwPosUser">User-defined data[progress]</param> /// <param name="cbData">Data callback function</param> /// <param name="dwDataUser">User-defined data[progress]</param> /// <returns>Successful return network playback ID,Failure return 0</returns> public static int NETPlayBackByTime(int lLoginID, int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser,fDataCallBack cbData,IntPtr dwDataUser) { try { int returnValue = 0; NET_TIME timeStart = ToNetTime(tmStart); NET_TIME timeEnd = ToNetTime(tmEnd); returnValue = CLIENT_PlayBackByTimeEx(lLoginID, nChannelID, ref timeStart, ref timeEnd, hWnd, cbDownLoadPos, dwPosUser,cbData,dwDataUser); NETThrowLastError(returnValue); return returnValue; } catch (Exception e) { NETThrowLastError(e); return 0; } }
/// <summary> ///Callback with data playback video files by extension interface,Each channel at the same time can only play a video,Can't play the same channel multiple records at the same time。Window parameter(hWnd)Effective correction data return values will be ignored,when window parameter(hWnd)is 0,need to pay attention to the callback function return values,See detail the callback function。 /// </summary> /// <param name="lLoginID">CLIENT_Login return value</param> /// <param name="lpRecordFile">Video file information</param> /// <param name="hWnd">Playback handle container</param> /// <param name="cbDownLoadPos">Progress of the callback function</param> /// <param name="dwPosUser">Progress callback function user data</param> /// <param name="fDownLoadDataCallBack">Data callback function</param> /// <param name="dwDataUser">The callback function data user data</param> /// <returns>Successful return to network playback ID,Failure to return0</returns> public static int NETPlayBackByRecordFile(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser) { int returnValue; //returnValue = CLIENT_PlayBackByRecordFileEx(lLoginID, ref lpRecordFile, hWnd, cbDownLoadPos, dwPosUser,fDownLoadDataCallBack,dwDataUser); returnValue = CLIENT_PlayBackByTimeEx(lLoginID, (int)lpRecordFile.ch, ref lpRecordFile.starttime, ref lpRecordFile.endtime, hWnd, cbDownLoadPos, dwPosUser, fDownLoadDataCallBack, dwDataUser); NETThrowLastError(returnValue); return returnValue; }
public static extern int H264_DVR_GetFileByName(int lLoginID, ref H264_DVR_FILE_DATA sPlayBackFile,string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos , int dwDataUser );
/// <summary> /// According to the time scale network playback[Note: after a user logs in a device, each channel at the same time can only play a video, can't play the same channel multiple records at the same time] /// </summary> /// <param name="nChannelID">channel</param> /// <param name="tmStart">Playback Start Time</param> /// <param name="tmEnd">Playback end Time</param> /// <param name="hWnd">Playback handle container</param> /// <param name="cbDownLoadPos">Progress of the callback function</param> /// <param name="dwUserData">SYSNAME</param> /// <returns>Successful return to network playback ID, failure returns 0</returns> public bool PlayBackByTime(int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData) { bool returnValue=false; NET_TIME netStartTime = ToNetTime(tmStart); NET_TIME netEndTime = ToNetTime(tmEnd); int playHandel = CLIENT_PlayBackByTime(pClientInfo.ID,nChannelID,ref netStartTime,ref netEndTime,hWnd,cbDownLoadPos, dwUserData); if (playHandel != 0) { pClientInfo.Channel[nChannelID].blnPlayBack = true; pClientInfo.Channel[nChannelID].PlayBackHandle = playHandel; returnValue = true; } ThrowLastError(); return returnValue; }
public static extern int H264_DVR_GetFileByTime(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, string sSavedFileDIR, bool bMerge, fDownLoadPosCallBack cbDownLoadPos , int dwDataUser );
private static extern long CLIENT_PlayBackByRecordFile(int lLoginID,ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData);
public static extern int H264_DVR_PlayBackByTimeEx(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo,fRealDataCallBack fDownLoadDataCallBack, int dwDataUser, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser);
/// <summary> /// 画面加载初期化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); grbMain.Enabled = false; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; }
public static extern int H264_DVR_GetFileByTime(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, string sSavedFileDIR, bool bMerge, fDownLoadPosCallBack cbDownLoadPos, int dwDataUser);
/// <summary> /// 带数据回调的按录像文件回放扩展接口,每通道同一时间只能播放一则录像,不能同时播放同一通道的多条记录。窗口参数(hWnd)有效时回调数据的返回值将被忽略,窗口参数 (hWnd)为0时,需要注意回调函数的返回值,具体见回调函数说明。 /// </summary> /// <param name="lLoginID">CLIENT_Login的返回值</param> /// <param name="lpRecordFile">录像文件信息</param> /// <param name="hWnd">回放容器句柄</param> /// <param name="cbDownLoadPos">进度回调函数</param> /// <param name="dwPosUser">进度回调函数用户数据</param> /// <param name="fDownLoadDataCallBack">数据回调函数</param> /// <param name="dwDataUser">数据回调函数用户数据</param> /// <returns>成功返回网络回放ID,失败返回0</returns> public static int DHPlayBackByRecordFile(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser) { int returnValue; returnValue = CLIENT_PlayBackByRecordFileEx(lLoginID, ref lpRecordFile, hWnd, cbDownLoadPos, dwPosUser,fDownLoadDataCallBack,dwDataUser); DHThrowLastError(returnValue); return returnValue; }
public static extern int H264_DVR_PlayBackByTimeEx(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, fRealDataCallBack fDownLoadDataCallBack, int dwDataUser, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser);
private static extern int CLIENT_DownloadByTime(int lLoginID, int nChannelId, int nRecordFileType,ref NET_TIME tmStart,ref NET_TIME tmEnd, string sSavedFileName, fDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData);
private static extern int CLIENT_PlayBackByTime(int lLoginID, int nChannelID, ref NET_TIME lpStartTime, ref NET_TIME lpStopTime, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData);
/// <summary> /// Download video files by file, Information by querying the file to download /// </summary> /// <param name="lLoginID">CLIENT_Loginreture value</param> /// <param name="lpRecordFile">Video file information</param> /// <param name="sSavedFileName">To save the video file name,Full path</param> /// <param name="cbDownLoadPos">Download progress callback function</param> /// <param name="dwUserData">Download progress callback user-defined data</param> /// <returns>Successful return Download ID,Failure to return0</returns> public static int NETDownloadByRecordFile(int lLoginID, NET_RECORDFILE_INFO lpRecordFile,string sSavedFileName, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData) { int intReturnValue = 0; intReturnValue=CLIENT_DownloadByRecordFile(lLoginID, ref lpRecordFile,sSavedFileName, cbDownLoadPos, dwUserData); NETThrowLastError(); return intReturnValue; }
private static extern int CLIENT_PlayBackByTimeEx(int lLoginID, int nChannelID, ref NET_TIME lpStartTime, ref NET_TIME lpStopTime, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
/// <summary> /// 按时间下载,直接输入指定通道起始时间和结束时间下载放录像 /// </summary> /// <param name="lLoginID">CLIENT_Login的返回值</param> /// <param name="nChannelId">图像通道号,从0开始</param> /// <param name="nRecordFileType">保留</param> /// <param name="tmStart">开始时间</param> /// <param name="tmEnd">结束时间</param> /// <param name="sSavedFileName">要保存的录像文件名,全路径</param> /// <param name="cbTimeDownLoadPos">下载进度回调函数</param> /// <param name="dwUserData">下载进度回调用户自定义数据</param> /// <returns>成功返回下载ID,失败返回0</returns> public static int DHDownloadByTime(int lLoginID, int nChannelId, int nRecordFileType, DateTime tmStart, DateTime tmEnd, string sSavedFileName, fDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData) { int intReturnValue = 0; NET_TIME ntStart = ToNetTime(tmStart); NET_TIME ntEnd = ToNetTime(tmEnd); intReturnValue = CLIENT_DownloadByTime(lLoginID, nChannelId, nRecordFileType, ref ntStart, ref ntEnd, sSavedFileName, cbTimeDownLoadPos, dwUserData); DHThrowLastError(); return intReturnValue; }