コード例 #1
0
ファイル: Form1.cs プロジェクト: stellant/Barcode
 private void barcodeReaderControl1_OnDataReceived(object sender, OnDataReceivedEventArgs e)
 {
     //
     // Delegate display processing of the received data to the textBox
     //
     this.textBox2.Invoke(new updateTextBoxDelegate(updateTextBox), e.data);
 }
コード例 #2
0
        private void NetworkServer_OnDataReceived(object sender, OnDataReceivedEventArgs e)
        {
            if (this.networkServer.IsActive)
            {
                ////this.networkServer.Broadcast(e.Data);
                this.networkServer.BroadcastExcept(e.Data, e.SenderId);
            }

            Console.WriteLine("DEBUG: Server received command \"" + ((Game.Commands)e.Data[0]).ToString() + "\" from byte array (" + string.Join(", ", e.Data) + ")");
        }
コード例 #3
0
 /// <summary>
 /// This is the function to write barcode data into file and it is called whenever there is an OnDataReceived event occurs.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataReceived(object sender,OnDataReceivedEventArgs e)
 {
     textBox_status.Invoke(new updateData(updateDataValue),e.data);
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: stellant/Flextronics
 private void dataReceived(object sender,OnDataReceivedEventArgs e)
 {
     try
     {
         barcodeData = new BarcodeData();
         barcodeData.DataBytes = e.data;
         getWriter(filePath).WriteLine(barcodeData.ToString() + " " + new DateTime());
         getWriter(filePath).Flush();
         textBox_status.AppendText(barcodeData.ToString());
     }
     catch (Exception ex)
     {
         textBox_status.AppendText(ex.ToString() + "\n");
     }
     finally
     {
         getWriter(filePath).Close();
     }
 }
コード例 #5
0
        public void DynoDataReceivedEventHandler(object sender, OnDataReceivedEventArgs e)
        {
            powerKW.y = (float)e.processedDynoSample.wheelHP / (float)1.35962;
            if (Properties.Status.Default.reset_distance)
            {
                Properties.Status.Default.reset_distance = false;
                distance.y = 0;
                //MessageBox.Show("Reset"); //DEBUG
            }

            float rollerRPM;

            if (SensorAndBrakeConfig.NumberOfRPMSensors() == 2)
            {
                rollerRPM = (float)(e.processedDynoSample.instantRoller1RPM + e.processedDynoSample.instantRoller2RPM) / 2;
            }
            else
            {
                rollerRPM = (float)e.processedDynoSample.instantRoller1RPM;
            }

            ///change status to be able to block relays
            if (rollerRPM > 0)
            {
                Properties.Status.Default.RollersTurning = true;
            }
            else
            {
                Properties.Status.Default.RollersTurning = false;
            }


            if (Settings.Properties.Settings.Default.UnitSelection == "Metric")
            {
                speed.y = rollerRPM * Properties.Settings.Default.brakeCirc * 60 / 1000;

                if (false)//!dynoDataConnection.isLogging)
                {
                    distance.y = 0;
                }
                else
                {
                    distance.y += rollerRPM / 60 * Properties.Settings.Default.brakeCirc * (float)e.processedDynoSample.timeStamp;
                }
            }
            else
            {
                speed.y = rollerRPM * Properties.Settings.Default.brakeCirc * 60 / 1000 * (float)0.621371;

                if (false)//!dynoDataConnection.isLogging)
                {
                    distance.y = 0;
                }
                else
                {
                    distance.y += rollerRPM / 60 * Properties.Settings.Default.brakeCirc * (float)e.processedDynoSample.timeStamp * (float)3.28084;
                }
            }

            Properties.Status.Default.speed_kph  = speed.y;
            Properties.Status.Default.distance_m = distance.y;

            /////////////Drag Racing:



            switch (Properties.Settings.Default.race_mode)
            {
            case 0:
                distance_target = 201.168F;     //1/8th mile
                speed_target    = 1000;
                break;

            case 1:
                distance_target = 402.336F;     //1/4th mile
                speed_target    = 1000;
                break;

            case 2:
                distance_target = 804.672F;     //1/2 mile
                speed_target    = 1000;
                break;

            case 3:
                distance_target = 10000; //NA
                speed_target    = 100;   //0-100kmh
                break;

            case 4:
                distance_target = 10000; //NA
                speed_target    = 200;   //0-100kmh
                break;
            }


            switch (Properties.Status.Default.race_state) //not yet handled...
            {
            case 0:
                //come to stop
                break;

            case 1:
                if (rollerRPM > 0)
                {
                    Properties.Status.Default.race_state = 3;     //false start
                }
                break;

            case 2:
                if (distance.y > distance_target | speed.y > speed_target)
                {
                    Properties.Status.Default.race_state = 4;     //finished
                }
                break;
            }
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: stellant/Barcode_Keyence
 /// <summary>
 /// This is the function to write barcode data into file and it is called whenever there is an OnDataReceived event occurs.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataReceived(object sender,OnDataReceivedEventArgs e)
 {
     try
     {
         barcodeData = new BarcodeData();
         barcodeData.DataBytes = e.data;
         WriteData(barcodeData.ToString() + "   " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss:fff"));
         textBox_status.AppendText(barcodeData.ToString());
     }
     catch (Exception ex)
     {
         textBox_status.AppendText(ex.ToString() + "\n");
     }
     finally
     {
         getWriter(filePath).Close();
     }
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: stellant/Barcode
 /// <summary>
 /// This is the function to write barcode data into file and it is called whenever there is an OnDataReceived event occurs.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataReceived(object sender,OnDataReceivedEventArgs e)
 {
     try
     {
         barcodeData = new BarcodeData();
         barcodeData.DataBytes = e.data;
         WriteData(barcodeData.ToString() + "   " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss:fff"));
         textBox_status.AppendText(barcodeData.ToString());
     }
     catch (Exception ex)
     {
         WriteLog(ex.ToString() + Environment.NewLine + "   at " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss:fff"));
         textBox_status.AppendText("Exception Occured. Please refer log file." + "\n");
     }
     finally
     {
         CloseData();
     }
 }