public void StartHighSpeedAcquistion(CancellationToken ct, Progress <int> progress, uint profileCount) { try { if (_connected) { _receivedProfileCount = 0; var ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); StopHighSpeedAquisition(); Thread.Sleep(50); _timerHighSpeed.Start(); LJSetting.SetOpMode(_currentDeviceId, LJV7IF_OP_MODE.HIGH_SPEED); Thread.Sleep(50); InitHighSpeedUSBComms(20); StartHighSpeedDataCommunication(); _highSpeedCommsActive = true; } } catch (Exception) { throw; } }
/// <summary> /// 打开视觉通讯 /// </summary> /// <returns></returns> private bool OpenEthernet() { for (int i = 0; i < NativeMethods.DeviceCount; i++) { _deviceData[i] = new DeviceData(); } bool boo = false; //using (OpenEthernetForm openEthernetForm = new OpenEthernetForm()) //{ // if (DialogResult.OK == openEthernetForm.ShowDialog()) // { LJV7IF_ETHERNET_CONFIG ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); //= openEthernetForm.EthernetConfig; ethernetConfig.abyIpAddress = VisionPath; int rc = NativeMethods.LJV7IF_EthernetOpen(_currentDeviceId, ref ethernetConfig); if (rc == (int)Rc.Ok) { Debug.WriteLine("3D相机连接成功-->OK"); _deviceData[_currentDeviceId].Status = DeviceStatus.Ethernet; _deviceData[_currentDeviceId].EthernetConfig = ethernetConfig; boo = true; } else { AddTips("3D相机连接失败!-->ERROR"); _deviceData[_currentDeviceId].Status = DeviceStatus.NoConnection; } // } //} return(boo); }
/// <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); }
void InitHighSpeedEthernetComms(LJV7IF_ETHERNET_CONFIG ethernetConfig, uint profileCount) { try { _deviceData.ProfileData.Clear(); //Clear the retained profile data. _deviceData.MeasureData.Clear(); LJV7IF_ETHERNET_CONFIG config = ethernetConfig; ushort portNo = 0; rc = (Rc)NativeMethods.LJV7IF_HighSpeedDataEthernetCommunicationInitalize(_currentDeviceId, ref config, portNo, _callback, profileCount, (uint)_currentDeviceId); CheckReturnValue(rc); PreStartHighSpeedAquisition(); } catch (Exception) { throw; } }
void InitHighSpeedComms(DeviceStatus deviceStatus, LJV7IF_ETHERNET_CONFIG ethernetConfig, uint profileCount) { try { switch (deviceStatus) { case DeviceStatus.UsbFast: InitHighSpeedUSBComms(profileCount); break; case DeviceStatus.EthernetFast: InitHighSpeedEthernetComms(ethernetConfig, profileCount); break; } } catch (Exception) { throw; } }
/// <summary> /// Constructor /// </summary> public DeviceData() { _ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); _profileData = new List<ProfileData>(); _measureData = new List<MeasureData>(); }
/// <summary> /// Constructor /// </summary> public DeviceData() { _ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); _profileData = new List <ProfileData>(); _measureData = new List <MeasureData>(); }
/// <summary> /// Constructor /// </summary> public OpenEthernetForm() { InitializeComponent(); _ethernetConfig = new LJV7IF_ETHERNET_CONFIG(); }