Esempio n. 1
0
 /// <summary>
 /// Request sensor data in a non-stop loop.
 /// ONLY FOR EXECUTION ON AN DEDICATED THREAD.
 /// </summary>
 private void RecursiveSensorReading()
 {
     while (true)
     {
         Values = GetSensorData();
         // inform everybody of new sensor data
         OnSensorDataUpdated();
         if (NewSensorValuesAvailable != null)
         {
             NewSensorValuesAvailable(this, new EventArgs());
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Request sensor data in a non-stop loop.
 /// ONLY FOR EXECUTION ON AN DEDICATED THREAD.
 /// </summary>
 private void EmulateRecursiveSensorReading()
 {
     while (true)
     {
         Values = EmualateGetSensorData();
         // inform everybody of new sensor data
         OnSensorDataUpdated();
         OnBatteryLevelUpdated();
         if ((NewSensorValuesAvailable != null) & (NewBatteryLevelAvailable != null))
         {
             NewSensorValuesAvailable(this, new EventArgs());
             NewBatteryLevelAvailable(this, new EventArgs());
         }
         Thread.Sleep(500); // pause for a while
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Request sensor data in a non-stop loop.
 /// ONLY FOR EXECUTION ON AN DEDICATED THREAD.
 /// </summary>
 private void RecursiveSensorReading()
 {
     while (!_abortPollingRequest)
     {
         if (IsConnected & EmulationMode)
         {
             Values = EmulateGetSensorData();
         }
         else if (IsConnected & !EmulationMode & _brick != null)
         {
             try
             {
                 Values = GetSensorData();
             }
             catch (Exception)
             {
                 // do nothing
             }
         }
     }
 }