/// 视频测点登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void videoLogin() { try { VideoDispose(); m_lUserID = -1; loginID = IntPtr.Zero; if (currentDefInfo != null) { string ipAddress = currentDefInfo.IPAddress; int port = Convert.ToInt32(currentDefInfo.Port); string username = currentDefInfo.Username; string password = currentDefInfo.Password; if (currentDefInfo.Vendor == 0) { HK32ChCNetSDK.NET_DVR_DEVICEINFO_V30 DeviceInfo = new HK32ChCNetSDK.NET_DVR_DEVICEINFO_V30(); m_lUserID = HK32ChCNetSDK.NET_DVR_Login_V30(ipAddress, port, username, password, ref DeviceInfo); if (m_lUserID < 0) { var iLastErr = HK32ChCNetSDK.NET_DVR_GetLastError(); staticMsg = string.Format("视频测点 {0} 登陆失败: NET_DVR_Login_V30_{1}", currentDefInfo.Devname, iLastErr); this.StaticMsg.Caption = staticMsg; } else { staticMsg = string.Format("视频测点 {0} 登陆成功...", currentDefInfo.Devname); this.StaticMsg.Caption = staticMsg; btnpreview_Click(new object(), new EventArgs()); } } else if (currentDefInfo.Vendor == 1)//大华 { NET_DEVICEINFO_Ex deviceInfo = new NET_DEVICEINFO_Ex(); loginID = NETClient.Login(ipAddress, (ushort)port, username, password, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref deviceInfo); if (loginID != IntPtr.Zero) { staticMsg = string.Format("视频测点 {0} 登陆成功...", currentDefInfo.Devname); this.StaticMsg.Caption = staticMsg; btnpreview_Click(new object(), new EventArgs()); } else { staticMsg = string.Format("视频测点 {0} 登陆失败...", currentDefInfo.Devname); this.StaticMsg.Caption = staticMsg; } } } } catch (Exception ex) { LogHelper.Error("视频测点登陆失败!" + ex.Message); } }
public Result Post([FromBody] LoginParam param) { Result result = new Result(); //初始化 NETClient.Init(disConnectCallBack, IntPtr.Zero, null); if (IntPtr.Zero == loginID) { ushort port = 0; try { port = Convert.ToUInt16(param.wDVRPort); } catch { result.Message = "Input port error"; return(result); } device = new NET_DEVICEINFO_Ex(); loginID = NETClient.Login(param.pchDVRIP, port, param.pchUserName, param.pchPassword, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref device); if (IntPtr.Zero == loginID) { result.Message = NETClient.GetLastError(); return(result); } else { result.Success = true; result.Message = "登录成功"; return(result); } } else { if (realLoadID != IntPtr.Zero) { NETClient.StopLoadPic(realLoadID); realLoadID = IntPtr.Zero; } bool lo = NETClient.Logout(loginID); if (!lo) { result.Message = NETClient.GetLastError(); return(result); } loginID = IntPtr.Zero; NETClient.Cleanup(); result.Success = true; result.Message = "登出成功"; return(result); } }
private void login_button_Click(object sender, EventArgs e) { if (IntPtr.Zero == m_LoginID) { ushort port = 0; try { port = Convert.ToUInt16(PORT.Trim()); //port = Convert.ToUInt16(this.port_textBox.Text.Trim()); } catch { ErrorText.Text = "Input port error(输入端口错误)!"; ErrorText.Visible = true; return; } m_DeviceInfo = new NET_DEVICEINFO_Ex(); m_LoginID = NETClient.Login(IPADDRESS.Trim(), port, USERNAME.Trim(), PASSWORD.Trim(), EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); //m_LoginID = NETClient.Login(this.ip_textBox.Text.Trim(), port, this.name_textBox.Text.Trim(), this.pwd_textBox.Text.Trim(), EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == m_LoginID) { ErrorText.Text = NETClient.GetLastError(); ErrorText.Visible = true; //MessageBox.Show(this, NETClient.GetLastError()); return; } LoginUI(); } else { bool result = NETClient.Logout(m_LoginID); if (!result) { ErrorText.Text = NETClient.GetLastError(); ErrorText.Visible = true; return; } m_LoginID = IntPtr.Zero; InitOrLogoutUI(); } }
/// <summary> /// 設備登陸 /// </summary> /// <param name="DVR_IP"></param> /// <param name="DVR_Port"></param> /// <param name="DVR_Name"></param> /// <param name="DVR_PassWord"></param> /// <returns></returns> public IntPtr LoginClick(String DVR_IP, String DVR_Port, String DVR_Name, String DVR_PassWord, ref NET_DEVICEINFO_Ex m_DeviceInfo) { if (IntPtr.Zero == m_LoginID) { ushort port = 0; port = Convert.ToUInt16(DVR_Port); m_DeviceInfo = new NET_DEVICEINFO_Ex(); //獲取登陸信息-->傳遞(IP,端口,帳號,密碼,傳輸協議TCP,參數,登出設備信息<返回參數>) m_LoginID = NETClient.Login(DVR_IP, port, DVR_Name, DVR_PassWord, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == m_LoginID) { return(IntPtr.Zero);//登陸失敗 } } return(m_LoginID); }
private void btn_Login_Click(object sender, EventArgs e) { if (IntPtr.Zero == m_LoginID) { ushort port = 0; try { port = Convert.ToUInt16(port_textBox.Text.Trim()); } catch { MessageBox.Show("Input port error"); return; } m_DeviceInfo = new NET_DEVICEINFO_Ex(); m_LoginID = NETClient.Login(ip_textBox.Text.Trim(), port, user_textBox.Text.Trim(), pwd_textBox.Text.Trim(), EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == m_LoginID) { MessageBox.Show(this, NETClient.GetLastError()); return; } LoginUI(); //Start listening m_RealLoadID = NETClient.RealLoadPicture(m_LoginID, 0, (uint)EM_EVENT_IVS_TYPE.ALL, true, m_AnalyzerDataCallBack, IntPtr.Zero, IntPtr.Zero); } else { bool result = NETClient.Logout(m_LoginID); if (!result) { MessageBox.Show(this, NETClient.GetLastError()); return; } m_LoginID = IntPtr.Zero; InitOrLogoutUI(); } }
public ORespuesta LoginDahua() { ORespuesta _Respuesta = new ORespuesta(); fDisConnectCallBack m_DisConnectCallBack; fHaveReConnectCallBack m_ReConnectCallBack; m_DisConnectCallBack = new fDisConnectCallBack(DisConnectCallBack); m_ReConnectCallBack = new fHaveReConnectCallBack(ReConnectCallBack); bool result = NETClient.Init(m_DisConnectCallBack, IntPtr.Zero, null); if (!result) { _Respuesta.Mensaje = NETClient.GetLastError(); return(_Respuesta); } NETClient.SetAutoReconnect(m_ReConnectCallBack, IntPtr.Zero); NET_PARAM param = new NET_PARAM() { nWaittime = 10000, nConnectTime = 5000, }; NETClient.SetNetworkParam(param); NET_DEVICEINFO_Ex m_DeviceInfo = new NET_DEVICEINFO_Ex(); this.DUserID = NETClient.LoginWithHighLevelSecurity(this.IP, this.Puerto, this.Usuario, this.Password, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == this.DUserID) { _Respuesta.Mensaje = NETClient.GetLastError(); return(_Respuesta); } for (int i = 1; i <= m_DeviceInfo.nChanNum; i++) { this.Canales.Add(i); } //Se extraen los canales del dispositivo _Respuesta.Exitoso = true; return(_Respuesta); }
private void login() { ushort port = 0; try { port = Convert.ToUInt16(porta.Trim()); } catch { MessageBox.Show("Input port error!"); return; } m_DeviceInfo = new NET_DEVICEINFO_Ex(); m_LoginID = NETClient.Login(ip.Trim(), port, usuario.Trim(), senha.Trim(), EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == m_LoginID) { MessageBox.Show(this, NETClient.GetLastError()); return; } LoginUI(); start_realplay_button.Enabled = true; }
public void LoginDevice(String device_ip, String device_port, String device_user, String device_pwd) { if (IntPtr.Zero == loginID) { ushort port = 0; try { port = Convert.ToUInt16(device_port); } catch { Console.WriteLine("Input port error"); return; } device = new NET_DEVICEINFO_Ex(); // 172.5.2.136 loginID = NETClient.Login(device_ip, port, device_user, device_pwd, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref device); if (IntPtr.Zero == loginID) { Console.WriteLine(NETClient.GetLastError()); return; } Console.WriteLine("\nLogin success"); } else { NETClient.StopListen(loginID); bool result = NETClient.Logout(loginID); if (!result) { Console.WriteLine(NETClient.GetLastError()); return; } loginID = IntPtr.Zero; Console.WriteLine("Logout"); } }
private void login_button_Click(object sender, EventArgs e) { if (IntPtr.Zero == m_LoginID) { ushort port = 0; try { port = Convert.ToUInt16(port_textBox.Text.Trim()); } catch { MessageBox.Show("Input port error!"); return; } m_DeviceInfo = new NET_DEVICEINFO_Ex(); m_LoginID = NETClient.Login(ip_textBox.Text.Trim(), port, name_textBox.Text.Trim(), pwd_textBox.Text.Trim(), EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref m_DeviceInfo); if (IntPtr.Zero == m_LoginID) { MessageBox.Show(this, NETClient.GetLastError()); return; } LoginUI(); start_realplay_button.Enabled = true; } else { bool result = NETClient.Logout(m_LoginID); if (!result) { MessageBox.Show(this, NETClient.GetLastError()); return; } m_LoginID = IntPtr.Zero; InitOrLogoutUI(); } }
public static extern IntPtr CLIENT_LoginEx2(string pchDVRIP, ushort wDVRPort, string pchUserName, string pchPassword, EM_LOGIN_SPAC_CAP_TYPE emSpecCap, IntPtr pCapParam, ref NET_DEVICEINFO_Ex lpDeviceInfo, ref int error);