コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DeviceData()
 {
     _ethernetConfig = new LJV7IF_ETHERNET_CONFIG();
     _profileData    = new List <ProfileData>();
     _measureData    = new List <MeasureData>();
 }
コード例 #3
0
 internal static extern int LJV7IF_HighSpeedDataEthernetCommunicationInitalize(
     int lDeviceId, ref LJV7IF_ETHERNET_CONFIG pEthernetConfig, ushort wHighSpeedPortNo,
     HighSpeedDataCallBack pCallBack, uint dwProfileCnt, uint dwThreadId);
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public OpenEthernetForm()
 {
     InitializeComponent();
     _ethernetConfig = new LJV7IF_ETHERNET_CONFIG();
 }
コード例 #5
0
 internal static extern int LJV7IF_EthernetOpen(int lDeviceId, ref LJV7IF_ETHERNET_CONFIG ethernetConfig);