/// <summary> /// 打开视觉通讯 /// </summary> /// <returns>是否连接成功</returns> public bool OpenVision() { bool boo = true; for (int i = 0; i < NativeMethods.DeviceCount; i++) { _deviceData[i] = new DeviceData(); } //using (OpenEthernetForm openEthernetForm = new OpenEthernetForm()) //{ // if (DialogResult.OK == openEthernetForm.ShowDialog()) // { LJV7IF_ETHERNET_CONFIG ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); //= openEthernetForm.EthernetConfig; ethernetConfig.abyIpAddress = VisionIp; ethernetConfig.wPortNo = VisionPort; try { int rc = NativeMethods.LJV7IF_EthernetOpen(_currentDeviceId, ref ethernetConfig);//连接延迟10S if (rc == (int)Rc.Ok) { _deviceData[_currentDeviceId].Status = DeviceStatus.Ethernet; _deviceData[_currentDeviceId].EthernetConfig = ethernetConfig; m_connnectState = boo = true; } else { m_connnectState = boo = false; } //else //{ // _deviceData[_currentDeviceId].Status = DeviceStatus.NoConnection; //} } catch (Exception ex) { m_connnectState = boo = false; //Program.LogNet.WriteError("异常", "3D相机连接失败!--> " + ex.Message); } // } //} return(boo); }
/// <summary> /// Constructor /// </summary> public DeviceData() { _ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); _profileData = new List <ProfileData>(); _measureData = new List <MeasureData>(); }
internal static extern int LJV7IF_HighSpeedDataEthernetCommunicationInitalize( int lDeviceId, ref LJV7IF_ETHERNET_CONFIG pEthernetConfig, ushort wHighSpeedPortNo, HighSpeedDataCallBack pCallBack, uint dwProfileCnt, uint dwThreadId);
/// <summary> /// Constructor /// </summary> public OpenEthernetForm() { InitializeComponent(); _ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); }
internal static extern int LJV7IF_EthernetOpen(int lDeviceId, ref LJV7IF_ETHERNET_CONFIG ethernetConfig);