/// <summary> /// 初始化函数 /// </summary> /// <param name="strServerIP">视频IP</param> /// <param name="iChannel">通道号</param> /// <param name="strUserName">用户名</param> /// <param name="strPsw">密码</param> /// <param name="strPath">抓图存储路径 如:\\LoadWeightPic\\FrontImage.jpg</param> public void Initialize(string strServerIP, int iChannel, string strUserName, string strPsw, string strPath) { try { if (IsLogin) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312); deviceInfo = new NET_DEVICEINFO(); int iLoginError = 0; iLogin = DHClient.DHLogin(strServerIP, ushort.Parse("37777"), strUserName, strPsw, out deviceInfo, out iLoginError); IsLogin = false; } _strPath = strPath; _strServerIP = strServerIP; _iChannel = iChannel; iRealPlay = DHClient.DHRealPlay(iLogin, _iChannel, this.Pic.Handle); } catch (Exception ex) { Log.WriteLog("大华视频显示控件-初始化:", ex); } }
public FrmCarPlateOfDaHua() { InitializeComponent(); disConnect = new fDisConnect(DisConnectEvent); onlineMsg = new fHaveReConnect(OnlineEvent); anaCallback = new fAnalyzerDataCallBack(AnalyzerDataCallBackEvent); }
/// <summary> /// Multi-device demo procedure loading /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMultiDVRSample_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); NETClient.NETInit(disConnect, IntPtr.Zero); NETClient.NETSetEncoding(LANGUAGE_ENCODING.gb2312);// Character encoding format setting, default is gb2312 encoding,please set if it is other encoding. Utility.StringUtil.InitControlText(this); }
public DaHuaVideoPanel() { InitializeComponent(); disConnect = new fDisConnect(DisConnectEvent); onlineMsg = new fHaveReConnect(OnlineEvent); //anaCallback = new fAnalyzerDataCallBack(AnalyzerDataCallBackEvent); }
/// <summary> /// 多设备演示程序加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMultiDVRSample_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 Utility.StringUtil.InitControlText(this); }
private void frm_Main_Load(object sender, EventArgs e) { groupBoxVentanas1.Location = new Point(4, 4); groupBoxVentanas4.Location = groupBoxVentanas1.Location; groupBoxVentanas9.Location = groupBoxVentanas1.Location; groupBoxVentanas16.Location = groupBoxVentanas1.Location; disConnect = new fDisConnect(DisConnectEvent); bool blnInit = DHClient.DHInit(disConnect, IntPtr.Zero); login(this.cantidadVentanas); }
/// <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); }
private void InitSDK() { m_disConnect = new fDisConnect(DisConnectEvent); m_SnapRecv = new fSnapRev(SnapRev); m_bInit = DHClient.DHInit(m_disConnect, IntPtr.Zero); if (!m_bInit) { MessageBox.Show("初始化失败"); } else { DHClient.DHSetSnapRevCallBack(m_SnapRecv, 0); } }
private void InitSDK() { m_disConnect = new fDisConnect(DisConnectEvent); m_SnapRecv = new fSnapRev(SnapRev); m_bInit = NETClient.NETInit(m_disConnect, IntPtr.Zero); if (!m_bInit) { MessageBox.Show("Initialization Failure "); } else { NETClient.NETSetSnapRevCallBack(m_SnapRecv, 0); } }
private void InitSDK() { m_disConnect = new fDisConnect(DisConnectEvent); m_SnapRecv = new fSnapRev(SnapRev); m_bInit = DHClient.DHInit(m_disConnect, IntPtr.Zero); if (!m_bInit) { MessageBox.Show("初始化失败"); } else { DHClient.DHSetSnapRevCallBack(m_SnapRecv, 0); } }
private void DHDVRStart() { cbDisConnect = new fDisConnect(DataCallBack); bool initOK = DHSDK.CLIENT_Init(cbDisConnect, this.Handle); deviceInfo = new NET_DEVICEINFO(); int error = 0; loginID = DHSDK.CLIENT_Login("192.168.1.20", 37777, "admin", "admin", out deviceInfo, out error); if (loginID != 0) { realplay1 = DHSDK.CLIENT_RealPlay(loginID, 0, Play1.Handle); realplay2 = DHSDK.CLIENT_RealPlay(loginID, 1, Play2.Handle); } }
public string InitSDK() { m_disConnect = new fDisConnect(DisConnectEvent); m_SnapRecv = new fSnapRev(SnapRev); m_bInit = NETClient.NETInit(m_disConnect, IntPtr.Zero); if (!m_bInit) { //MessageBox.Show("初始化失败"); return("初始化失败"); } else { NETClient.NETSetSnapRevCallBack(m_SnapRecv, 0); } return("初始化成功"); }
/// <summary> /// 画面初期化处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_MainC_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 pRealPlayHandle = null; btnRealPlay.Text = StringUtil.ConvertString("实时监视开始"); btnRealPlay.Enabled = false; btnPlayBackByTime.Enabled = false; gpbPlayBackControl.Enabled = false; btnUserLogout.Enabled = false; gpbPTZControl.Enabled = false; btnPlayByRecordFile.Enabled = false; 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"); }); }
public bool Init(CameraData _cameraData) { cameraData = _cameraData; server.start(Convert.ToInt32(cameraData.Code)); disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding((int)LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 pLoginID = DHClient.DHLogin(cameraData.IP, (ushort)cameraData.Port, cameraData.UserName, cameraData.Pwd, out deviceInfo, out error); // cameraData.control.Text = pLoginID + ""; if (pLoginID != 0) { // (cameraData.control as UserControl).Text = pLoginID.ToString(); pPlayBackHandle = new int[deviceInfo.byChanNum]; //画面按钮有效性控制 pRealPlayHandle = null; //for (int i = 0; i < deviceInfo.byChanNum; i++) //{ // cmbChannelSelect.Items.Add(i.ToString()); // //cmbChannelSelect.Items.Add((i+1).ToString()); //} NET_SDK_CLIENTINFO lsc = new NET_SDK_CLIENTINFO(); lsc.lChannel = deviceInfo.byChanNum; //预览的通道 lsc.streamType = 1; // 码流 lsc.hPlayWnd = cameraData.Handle; //pictureBox.Handle lLiveHandle = (IntPtr)DHClient.DHRealPlay(pLoginID, 0, lsc.hPlayWnd); //ID 通道 ,Picture句柄 IntPtr userdata = (IntPtr)Convert.ToInt32(_cameraData.Code); DHClient.DHSetRealDataCallBack((int)lLiveHandle, fd, userdata); // DHPlay.PLAY_OpenStream(tongdao, IntPtr.Zero, 0, (UInt32)900 * 1024); //播放的部分 //bool b2 = DHPlay.DHPlayControl(PLAY_COMMAND.OpenStream, tongdao, IntPtr.Zero, 0, 900 * 1024); //DHPlay.DHSetStreamOpenMode(tongdao, PLAY_MODE.STREAME_FILE); //DHPlay.DHPlayControl(0, tongdao, _cameraData.control.Handle); return(true); } else { return(false); } }
/// <summary> /// Image Initial Porcessing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_MainC_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); NETClient.NETInit(disConnect, IntPtr.Zero); NETClient.NETSetEncoding(LANGUAGE_ENCODING.gb2312);//Character Encoding Format Setting.Default Value is gb2312 Character Encoding,Otherwise Please Set it. pRealPlayHandle = null; btnRealPlay.Text = StringUtil.ConvertString("Start Real-time Monitoring"); btnRealPlay.Enabled = false; btnPlayBackByTime.Enabled = false; gpbPlayBackControl.Enabled = false; btnUserLogout.Enabled = false; gpbPTZControl.Enabled = false; btnPlayByRecordFile.Enabled = false; btnMultiPlay.Enabled = false; pMultiPlayHandle = 0; stuOriRect = new Rectangle(); InitPlayBoxManger(); StringUtil.InitControlText(this); }
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); }
private void frm_Main_Load(object sender, EventArgs e) { cargarToolTipes(); groupBoxVentanas1.Location = new Point(4, 4); groupBoxVentanas4.Location = groupBoxVentanas1.Location; groupBoxVentanas9.Location = groupBoxVentanas1.Location; groupBoxVentanas16.Location = groupBoxVentanas1.Location; groupBoxRecord.Location = groupBoxVentanas1.Location; //se cargan las calidades disponibles this.comboBoxCalidad.Items.Insert(0, "Alta"); this.comboBoxCalidad.Items.Insert(1, "Baja"); this.comboBoxCalidad.SelectedIndex = 0;//eliminar esta línea cuando este el parámetro //setea calidad segun parámetro // comboBoxCalidad.SelectedIndex = qualityCam; //estado boton records según parámetro /* * if (bykomCanViewRecords == 1) * { * btnGrabaciones.Enabled = true; * } * else * { * btnGrabaciones.Enabled = false; * } */ disConnect = new fDisConnect(DisConnectEvent); bool blnInit = DHClient.DHInit(disConnect, IntPtr.Zero); login(this.cantidadVentanas); }
private static extern Int32 CLIENT_Init(fDisConnect cbDisConnect, IntPtr dwUser);
/// <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_Init(fDisConnect cbDisConnect, IntPtr dwUser);
private void frm_Main_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); bool blnInit= DHClient.DHInit(disConnect, IntPtr.Zero); //MessageBox.Show((blnInit == true ? "成功" : "失败"), pMsgTitle); }
private void frm_Main_Load(object sender, EventArgs e) { cargarToolTipes(); groupBoxVentanas1.Location = new Point(4, 4); groupBoxVentanas4.Location = groupBoxVentanas1.Location; groupBoxVentanas9.Location = groupBoxVentanas1.Location; groupBoxVentanas16.Location = groupBoxVentanas1.Location; groupBoxRecord.Location = groupBoxVentanas1.Location; //se cargan las calidades disponibles this.comboBoxCalidad.Items.Insert(0, "Alta"); this.comboBoxCalidad.Items.Insert(1, "Baja"); this.comboBoxCalidad.SelectedIndex = 0;//eliminar esta línea cuando este el parámetro //setea calidad segun parámetro // comboBoxCalidad.SelectedIndex = qualityCam; //estado boton records según parámetro /* if (bykomCanViewRecords == 1) { btnGrabaciones.Enabled = true; } else { btnGrabaciones.Enabled = false; } */ disConnect = new fDisConnect(DisConnectEvent); bool blnInit= DHClient.DHInit(disConnect, IntPtr.Zero); login(this.cantidadVentanas); }
private void SingleVideoDisplayForm_Load(object sender, EventArgs e) { picRealPlay1.Visible = false; picRealPlay2.Visible = false; picRealPlay3.Visible = false; picRealPlay4.Visible = false; picRealPlay5.Visible = false; picRealPlay6.Visible = false; switch (b) { case 0: groupBox1.Text = "一号电机视频监控"; break; case 1: groupBox1.Text = "二号电机视频监控"; break; case 2: groupBox1.Text = "三号电机视频监控"; break; case 3: groupBox1.Text = "控制室视频监控"; break; case 4: groupBox1.Text = "过道视频监控"; break; default: break; } int[] pPlayBackHandle; NET_DEVICEINFO deviceInfo; fDisConnect disConnect; disConnect = new fDisConnect(DisConnectEvent); //DHClient.initialized = false; DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 deviceInfo = new NET_DEVICEINFO(); int error = 0; pLoginID = DHClient.DHLogin(IP, Port, Username, Password, out deviceInfo, out error); if (pLoginID != 0) { pPlayBackHandle = new int[5]; //画面按钮有效性控制 btnPlayByRecordFile.Enabled = true; RealPlay(true, b); } else { MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle); } gpbPlayBackControl.Enabled = false; picRealPlay6.VisibleChanged += new EventHandler((o, j) => { if (picRealPlay6.Visible == false) { gpbPlayBackControl.Enabled = false; btnPlayBackByTime.Enabled = true; btnPlayByRecordFile.Enabled = true; } else {//如果回放激活 gpbPlayBackControl.Enabled = true; } }); }
public DaHuaSDKManager() { disConnect = new fDisConnect(DisConnectEvent); onlineMsg = new fHaveReConnect(OnlineEvent); }
private void frm_Main_Load(object sender, EventArgs e) { groupBoxVentanas1.Location = new Point(4, 4); groupBoxVentanas4.Location = groupBoxVentanas1.Location; groupBoxVentanas9.Location = groupBoxVentanas1.Location; groupBoxVentanas16.Location = groupBoxVentanas1.Location; disConnect = new fDisConnect(DisConnectEvent); bool blnInit= DHClient.DHInit(disConnect, IntPtr.Zero); login(this.cantidadVentanas); }
private bool InitSDK() { m_disConnect = new fDisConnect(DisConnectEvent); m_SnapRecv = new fSnapRev(SnapRev); m_bInit = NETClient.NETInit(m_disConnect, IntPtr.Zero); if (!m_bInit) { // MessageBox.Show("Initialization Failure "); return false; } else { NETClient.NETSetSnapRevCallBack(m_SnapRecv, 0); return true; } }
/// <summary> /// 多设备演示程序加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMultiDVRSample_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 Utility.StringUtil.InitControlText(this); }
/// <summary> /// 画面加载处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_Main_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero);//SDK初始化 DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 grbMain.Enabled = false; }
/// <summary> /// 画面初期化处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_MainC_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 pRealPlayHandle = null; btnRealPlay.Text = StringUtil.ConvertString("RealPlay"); btnRealPlay.Enabled = false; btnPlayBackByTime.Enabled = false; gpbPlayBackControl.Enabled = false; btnUserLogout.Enabled = false; gpbPTZControl.Enabled = false; btnPlayByRecordFile.Enabled = false; StringUtil.InitControlText(this); }
/// <summary> /// 画面加载处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_Main_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero);//SDK初始化 DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 grbMain.Enabled = false; hUpgradeId = 0; upgradeCallBack = new fUpgradeCallBack(UpgradeCallBack); this.updatePosDelegate = this.UpdatePos; StringUtil.InitControlText(this); }
public static extern bool CLIENT_Init(fDisConnect cbDisConnect, IntPtr deUser);
//摄像头视频显示 private void RealPlay() { try { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 pRealPlayHandle = null; deviceInfo = new NET_DEVICEINFO(); int error = 0; pLoginID = DHClient.DHLogin(Program.g_localVedioIp, ushort.Parse(Program.g_localVedioPort), Program.g_localVadioUsername, Program.g_localVadioPassword, out deviceInfo, out error); if (pLoginID != 0) { pPlayBackHandle = new int[deviceInfo.byChanNum]; //画面按钮有效性控制 pRealPlayHandle = null; pRealPlayHandle = new int[deviceInfo.byChanNum]; for (int i = 0; i < deviceInfo.byChanNum; i++) { switch (i) { case 0: //通道0的实时监视 pictureBox17.Invoke((MethodInvoker) delegate { pRealPlayHandle[i] = DHClient.DHRealPlay(pLoginID, i, pictureBox17.Handle); }); break; case 1: //通道1的实时监视 pictureBox18.Invoke((MethodInvoker) delegate { pRealPlayHandle[i] = DHClient.DHRealPlay(pLoginID, i, pictureBox18.Handle); }); break; case 2: //通道2的实时监视 pictureBox19.Invoke((MethodInvoker) delegate { pRealPlayHandle[i] = DHClient.DHRealPlay(pLoginID, i, pictureBox19.Handle); }); break; case 3: //通道3的实时监视 pictureBox20.Invoke((MethodInvoker) delegate { pRealPlayHandle[i] = DHClient.DHRealPlay(pLoginID, i, pictureBox20.Handle); }); break; case 4: //通道4的实时监视 pictureBox21.Invoke((MethodInvoker) delegate { pRealPlayHandle[i] = DHClient.DHRealPlay(pLoginID, i, pictureBox21.Handle); }); break; } } } } catch (Exception vedioError) { Program.WriteLog("调用摄像头异常:" + vedioError.ToString()); } }
/// <summary> /// initialization SDK /// </summary> /// <param name="cbDisConnect"> /// Disconnect the callback function, see the entrusted:<seealso cref="fDisConnect"/> /// </param> /// <param name="dwUser">User data, there is no data, please use IntPtr. Zero</param> /// <returns>true:succeed;false:fail</returns> public static bool NETInit(fDisConnect cbDisConnect, IntPtr dwUser) { bool returnValue = false; if (initialized == false) { returnValue = CLIENT_Init(cbDisConnect, dwUser); NETThrowLastError(returnValue); initialized = true; } return returnValue; }
public static extern int H264_DVR_Init(fDisConnect cbDisConnect, IntPtr dwUser);
private void frm_Main_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); bool blnInit = NETClient.NETInit(disConnect, IntPtr.Zero); //MessageBox.Show((blnInit == true ? "successfully" : "failed"), pMsgTitle); }
/// <summary> /// 画面加载初始化处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_Main_Load(object sender, EventArgs e) { msgCallBack = new fMessCallBack(GetAlarmMessage); disConnect = new fDisConnect(DisConnectEvent); AlarmAudio = new byte[16]; AlarmDiskErr = new byte[32];//DVR最大可挂32块硬盘,每一位表示一个硬盘的状态,0:硬盘状态正常;1:硬盘出错 AlarmDiskFull = false; AlarmShelter = new byte[16]; AlarmExternal = new byte[16]; DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 StringUtil.InitControlText(this); }
/// <summary> /// 初始化函数 /// </summary> /// <param name="strServerIP">视频IP</param> /// <param name="iChannel">通道号</param> /// <param name="strUserName">用户名</param> /// <param name="strPsw">密码</param> /// <param name="strPath">抓图存储路径 如:\\LoadWeightPic\\FrontImage.jpg</param> public void Initialize(string strServerIP, int iChannel, string strUserName, string strPsw, string strPath) { try { if (IsLogin) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312); deviceInfo = new NET_DEVICEINFO(); int iLoginError = 0; iLogin = DHClient.DHLogin(strServerIP, ushort.Parse("37777"), strUserName, strPsw, out deviceInfo, out iLoginError); IsLogin = false; } _strPath = strPath; _strServerIP = strServerIP; _iChannel = iChannel; iRealPlay = DHClient.DHRealPlay(iLogin, _iChannel, this.Pic.Handle); } catch(Exception ex) { Log.WriteLog("大华视频显示控件-初始化:", ex); } }
public bool Init(CameraData _cameraData) { cameraData = _cameraData; server.start(Convert.ToInt32(cameraData.Code)); disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); DHClient.DHSetEncoding((int)LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置 pLoginID = DHClient.DHLogin(cameraData.IP, (ushort)cameraData.Port, cameraData.UserName, cameraData.Pwd, out deviceInfo, out error); // cameraData.control.Text = pLoginID + ""; if (pLoginID != 0) { // (cameraData.control as UserControl).Text = pLoginID.ToString(); pPlayBackHandle = new int[deviceInfo.byChanNum]; //画面按钮有效性控制 pRealPlayHandle = null; //for (int i = 0; i < deviceInfo.byChanNum; i++) //{ // cmbChannelSelect.Items.Add(i.ToString()); // //cmbChannelSelect.Items.Add((i+1).ToString()); //} NET_SDK_CLIENTINFO lsc = new NET_SDK_CLIENTINFO(); lsc.lChannel = deviceInfo.byChanNum; //预览的通道 lsc.streamType = 1;// 码流 lsc.hPlayWnd = cameraData.Handle;//pictureBox.Handle lLiveHandle = (IntPtr)DHClient.DHRealPlay(pLoginID, 0, lsc.hPlayWnd);//ID 通道 ,Picture句柄 IntPtr userdata = (IntPtr)Convert.ToInt32(_cameraData.Code); DHClient.DHSetRealDataCallBack((int)lLiveHandle, fd, userdata); // DHPlay.PLAY_OpenStream(tongdao, IntPtr.Zero, 0, (UInt32)900 * 1024); //播放的部分 //bool b2 = DHPlay.DHPlayControl(PLAY_COMMAND.OpenStream, tongdao, IntPtr.Zero, 0, 900 * 1024); //DHPlay.DHSetStreamOpenMode(tongdao, PLAY_MODE.STREAME_FILE); //DHPlay.DHPlayControl(0, tongdao, _cameraData.control.Handle); return true; } else { return false; } }