コード例 #1
0
 /// <summary>
 /// Monitors the connection to with the arduino
 /// </summary>
 private void monitorConnection()
 {
     while (true)
     {
         string tempCom = autoFindComm.GetCommPort();
         if (tempCom != _currentCommPort)
         {
             if (tempCom != String.Empty)
             {
                 if (!connected)
                 {
                     Connect(tempCom);
                 }
                 else
                 {
                     Disconnect();
                     Connect(tempCom);
                 }
                 RequestModel();
                 RequestPartPresent();
             }
             else
             {
                 Disconnect();
             }
             _currentCommPort = tempCom;
             if (CommPortChanged != null)
             {
                 CommPortChanged(_currentCommPort);
             }
         }
         Thread.Sleep(1000);
     }
 }
コード例 #2
0
        private iPhBtnHardwareControl()
        {
            this.serial = new SerialCommunication();
            AutoFindCom autofindComm = new AutoFindCom();

            this.serial.PortName       = autofindComm.GetCommPort();
            serial.PortConnected      += new SerialDataPortEventHandler(serial_PortConnected);
            serial.DataReceived       += new SerialDataReceivedEventHandler(serial_DataReceived);
            timer.Elapsed             += new ElapsedEventHandler(timer_Elapsed);
            disconnectedTimer.Elapsed += new ElapsedEventHandler(disconnectedTimer_Elapsed);
            connectingTimer.Elapsed   += new ElapsedEventHandler(connectingTimer_Elapsed);
            disconnectedTimer.Start();
        }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SickDistanceSensor()
 {
     foundComm         = commFinder.GetCommPort();
     measurementThread = new Thread(new ThreadStart(MeasurementThreadMethod));
 }
コード例 #4
0
ファイル: iPhoneButtonTest.cs プロジェクト: ponchio22/clover
 private void SetConnectionStatusLabelText()
 {
     connectionStatusLabel.Text = (control.ConnectionState == iPhBtnHardwareControl.CONN_STATE.CONNECTED)? "Connected on " + autofindComm.GetCommPort():"Disconnected";
 }