Ejemplo n.º 1
0
        /// <summary>
        /// initialize /Connect sensor
        /// </summary>
        /// <returns></returns>
        public bool  Go_Init_Sensor()
        {
            bool rtn = false;

            try
            {
                KApiLib.Construct();
                GoSdkLib.Construct();
                system_main = new GoSystem();
                accelerator = new GoAccelerator();
                accelerator.Start();
                KIpAddress ipAddress = KIpAddress.Parse(SENSOR_MAIN_IP);
                sensor_main = system_main.FindSensorByIpAddress(ipAddress);
                accelerator.Attach(sensor_main);
                sensor_main.Connect();
                system_main.EnableData(true);
                system_main.SetDataHandler(AsyncReceiveData);
                system_main.Start();
            }
            catch (Exception ex)
            {
                rtn = true;
            }

            return(rtn);
        }
Ejemplo n.º 2
0
        void initialApi()
        {
            KApiLib.Construct();
            GoSdkLib.Construct();
            KIpAddress addr = KIpAddress.Parse(IPAddr);

            _system = new GoSystem();

            _sensor = _system.FindSensorByIpAddress(addr);
            _system.Connect();

            if (_sensor.State == GoState.Ready)
            {
                _context.Post(delegate
                {
                    richTextBox1.AppendText("Connected" + Environment.NewLine);
                }, null);
            }
            else
            {
                _context.Post(delegate
                {
                    richTextBox1.AppendText(@"Connect failed" + Environment.NewLine);
                }, null);
            }



            _system.EnableData(true);
            _system.SetDataHandler(OnDataReceived);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 开始监听拍照数据
 /// </summary>
 public void StartListen()
 {
     if (sensor.IsConnected())
     {
         system.EnableData(true);
         system.SetDataHandler(onData);
         system.Start();
     }
 }
Ejemplo n.º 4
0
 public bool InitialAcq()
 {
     mSystem = new GoSystem();
     mSensor = mSystem.FindSensorByIpAddress(KIpAddress.Parse(IPAddr));
     DeviceStatusEvent?.Invoke(this, $"Find device @ IP address {IPAddr}");
     mSystem.Connect();
     DeviceStatusEvent?.Invoke(this, $"Connect to {IPAddr}");
     mSystem.EnableData(true);
     mSystem.SetDataHandler(OnData);
     return(true);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// initial api constructor and open data channel
        /// </summary>
        /// <returns></returns>
        public bool InitialDevice()
        {
            try
            {
                KApiLib.Construct();
                GoSdkLib.Construct();
            }
            catch (KException kEx)
            {
                Trace.WriteLine(kEx.ToString());
            }

            _system = new GoSystem();
            KIpAddress kIpAddress = KIpAddress.Parse(IPAddress);

            Trace.WriteLine($"Sonsor IP {IPAddress}");
            _sensor = _system.FindSensorByIpAddress(kIpAddress);
            if (_sensor.State == GoState.Ready)
            {
                _sensor.Connect();
                Trace.WriteLine("Sonsor Connected");
            }
            else
            {
                return(false);
            }
            _system.EnableData(true);
            Trace.WriteLine("Data channel open");

            _system.SetDataHandler(onData);
            if (_sensor.State == GoState.Running)
            {
                _system.Stop();
                _system.Start();
            }
            else
            {
                _system.Start();
                Trace.WriteLine("Sysem Start");
            }


            return(true);
        }
Ejemplo n.º 6
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //생성 :
        //수정 :
        //목적 : 3D 센서( Gocator )
        //설명 :
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public override bool HL3DStart()
        {
            bool bReturn = false;

            do
            {
                try {
                    m_objCameraSystem.EnableData(true);
                    m_objCameraSystem.SetDataHandler(ReceiveData);
                    m_objCameraSystem.Start();
                } catch (Exception ex) {
                    Trace.WriteLine("HL3DStart : " + ex.ToString());
                    break;
                }

                bReturn = true;
            } while(false);
            return(bReturn);
        }
Ejemplo n.º 7
0
        public void GoSystemConstruct(string IPAddress, long profileCount)
        {
            initialApi();
            _system       = new GoSystem();
            _profileCount = profileCount;
            KIpAddress addr = KIpAddress.Parse(IPAddress);

            _sensor = _system.FindSensorByIpAddress(addr);
            _syncContext.Post(delegate { yRes.Content = profileCount.ToString(); }, null);
            _system.Connect();
            if (_sensor.IsConnected())
            {
                _system.EnableData(true);
                _system.SetDataHandler(OnDataReceived);
                _syncContext.Post(delegate { UpdateMsg("Systeme Construct successfully"); }, null);
            }
            else
            {
                _syncContext.Post(delegate { UpdateMsg("System Construct Failed"); }, null);
            }
        }
Ejemplo n.º 8
0
        public void StartGetPoint()
        {
            if (File.Exists(strFileSave) == true)
            {
                File.Delete(strFileSave);
            }
            length = 0;

            system.EnableData(true);
            system.SetDataHandler(onData);

            try
            {
                sensor.CopyFile("test.job", "_live.job");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("请检查相机连接状态");
                return;
            }
            system.Start();
        }
Ejemplo n.º 9
0
        void goRun()
        {
            try
            {
                KApiLib.Construct();
                GoSdkLib.Construct();
                system = new GoSystem();
                GoSensor   sensor;
                KIpAddress ipAddress = KIpAddress.Parse(IPAddress);
                GoDataSet  dataSet   = new GoDataSet();
                sensor = system.FindSensorByIpAddress(ipAddress);
                sensor.Connect();
                infoTxt.Text = "Conn" + Environment.NewLine;
                GoSetup setup = sensor.Setup;
                setup.ScanMode = GoMode.Surface;

                system.EnableData(true);
                system.SetDataHandler(OnDataReceived);
                infoTxt.Text += "Binding data handler" + Environment.NewLine;

                system.Start();

                infoTxt.Text += "System Started" + Environment.NewLine;
                infoTxt.Text += "Waiting Data" + Environment.NewLine;

                GoActiveAreaConfig goActiveAreaConfig = new GoActiveAreaConfig();



                sensor.Setup.GetActiveAreaLength(GoRole.Main);
                GoSetup set = sensor.Setup;
                setup.

                // wait for Enter key
            }
            catch (KException ex)
            {
            }
        }
Ejemplo n.º 10
0
        static int Main(string[] args)
        {
            try
            {
                KApiLib.Construct();
                GoSdkLib.Construct();
                GoSystem   system = new GoSystem();
                GoSensor   sensor;
                KIpAddress ipAddress = KIpAddress.Parse(Constants.SENSOR_IP);
                sensor = system.FindSensorByIpAddress(ipAddress);
                sensor.Connect();
                system.EnableData(true);
                system.SetDataHandler(onData);
                system.Start();

                // wait for Enter key
                Console.WriteLine("\nPress ENTER to stop");
                do
                {
                    //System.Threading.Thread.Sleep(100);
                } while (Console.Read() != (int)ConsoleKey.Enter);
                system.Stop();
            }

            catch (KException ex)
            {
                Console.WriteLine("Error: {0}", ex.Status);
            }

            // wait for Enter key
            Console.WriteLine("\nPress ENTER to continue");
            do
            {
                System.Threading.Thread.Sleep(100);
            } while (Console.Read() != (int)ConsoleKey.Enter);
            return(1);
        }
Ejemplo n.º 11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // 主窗口大小、位置
            int Desk_width  = Screen.PrimaryScreen.WorkingArea.Width;
            int Desk_height = Screen.PrimaryScreen.WorkingArea.Height;

            Width    = Desk_width;
            Height   = Desk_height;
            Location = new Point(0, 0);

            // 尝试连接ABB
            NetworkScanner networkScanner = new NetworkScanner();

            networkScanner.Scan();
            controllers = networkScanner.Controllers;
            foreach (ControllerInfo info in controllers)
            {
                ListViewItem item = new ListViewItem("PC");
                item.SubItems.Add("ABB");
                item.SubItems.Add("Detected");
                item.Tag = info;
                listView_Log.Items.Add(item);
                ABB_Connect_OK = true;
                if_ABB_init    = true;
            }



            // 初始化内存映射
            if (If_Init_mmf == false)
            {
                try
                {
                    mmf = MemoryMappedFile.CreateNew(memo_file_name, memo_capacity);
                }
                catch (Exception Memo_e)
                {
                    Console.WriteLine("Memo File: {0} Exception caught.", Memo_e);
                    return;
                }

                try
                {
                    accessor = mmf.CreateViewAccessor();
                }
                catch (Exception Memo_e)
                {
                    Console.WriteLine("Memo File: {0} Exception caught.", Memo_e);
                    return;
                }
                If_Init_mmf = true;
            }
            // Endof-初始化内存映射

            // Gocator启动
            // 进行Gocator初始化的相关工作
            KApiLib.Construct();
            GoSdkLib.Construct();
            GC_system = new GoSystem();
            KIpAddress ipAddress = KIpAddress.Parse(SENSOR_IP);

            try
            {
                sensor = GC_system.FindSensorByIpAddress(ipAddress);
            }
            catch (Exception GC_e)
            {
                Console.WriteLine("XX Gocator Error XX : {0} Exception caught.", GC_e);
                return;
            }

            sensor.Connect();
            sensor_setup = sensor.Setup;
            GC_system.EnableData(true);
            GC_system.SetDataHandler(onData);
            if_Gocator_init = true;
            // Endof-Gocator启动
        }// - Endof - Form1Load