Inheritance: IInclinometerReadingChangedEventArgs
Beispiel #1
0
 private void onInclinometerReadingChanged(object sender, InclinometerReadingChangedEventArgs e)
 {
     string str = e.Reading.PitchDegrees.ToString();
     str += "\n"+e.Reading.RollDegrees.ToString();
     str += "\n"+e.Reading.YawDegrees.ToString();
     this.window.setInclinometerReading(str);
 }
 async void inclinometer_ReadingChanged( Inclinometer sender, InclinometerReadingChangedEventArgs args )
 {
     await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ProjectionImage.RotationX = 90 - args.Reading.PitchDegrees;
         ProjectionImage.RotationZ = args.Reading.RollDegrees;
         ProjectionImage.RotationY = -args.Reading.YawDegrees;
     } );
 }
 private async void inclinometer_ReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         PitchValue.Text = args.Reading.PitchDegrees.ToString();
         RollValue.Text = args.Reading.RollDegrees.ToString();
         YawValue.Text = args.Reading.YawDegrees.ToString();
         TimeStamp.Text = args.Reading.Timestamp.ToString();
     });
 }
 private async void ReadingChanged(object sender, InclinometerReadingChangedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         InclinometerReading reading = args.Reading;
         lblIncX.Text = "X = " + String.Format("{0,5:0.00}", reading.RollDegrees);
         lblIncY.Text = "Y = " + String.Format("{0,5:0.00}", reading.PitchDegrees);
         lblIncZ.Text = "Z = " + String.Format("{0,5:0.00}", reading.YawDegrees);
     });
 }
        private async void InclinometerOnReadingChanged(Sensor.Inclinometer sender, Sensor.InclinometerReadingChangedEventArgs args)
        {
            await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                PitchDegrees = args.Reading.PitchDegrees;
                RollDegrees  = args.Reading.RollDegrees;
                YawDegrees   = args.Reading.YawDegrees;

                SetupNewLocation();
            });
        }
        /// <summary>
        /// inclinometer handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        async void InclinometerReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                InclinometerReading reading = args.Reading;
                var pitchDouble = reading.PitchDegrees;
                var rollDouble = reading.RollDegrees;
                var yawDouble = reading.YawDegrees;
                int pitch = Convert.ToInt32(pitchDouble);
                int roll = Convert.ToInt32(rollDouble);
                int yaw = Convert.ToInt32(yawDouble);
                //Pitch.Text = pitch.ToString();
                //Roll.Text = roll.ToString();
                //Yaw.Text = yaw.ToString();

                //Vector.Text = GetCameraViewDirection(pitch, roll, yaw).ToString();
                DirectionTextblock.Text = GetCameraViewDirection(pitch, roll, yaw).ToString();
            });
        }
        void _inclinometer_ReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
        {
            try
            {
                InclinometerReading reading = args.Reading;

                if (reading != null)
                {
                    SensorEventArgs sensorArgs = new SensorEventArgs(reading.RollDegrees);

                    if (SensorReadingChanged != null)
                    {
                        SensorReadingChanged(sender, sensorArgs);
                    }
                }
            }
            catch (Exception)
            {
                _inclinometerEnabled = false;
            }

            _inclinometerChecked = true;
        }
 async void MainPage_ReadingChanged( Inclinometer sender, InclinometerReadingChangedEventArgs args )
 {
     await Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () =>
     {
         TextInclinometer.Text = string.Format( @"Inclinometer : P={0} R={1} Y={2}", args.Reading.PitchDegrees, args.Reading.RollDegrees, args.Reading.YawDegrees );
     } );
 }
        async private void ReadingChanged(object sender, InclinometerReadingChangedEventArgs e)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                InclinometerReading reading = e.Reading;
                
                String result = null;
                if (Helpers.SensorCalculation.learningMode)
                {
                    result = Helpers.SensorCalculation.GetPitchDirection(reading.PitchDegrees);
                    // add splash - device learning is done
                }
                else
                {
                    Helpers.SensorCalculation.checkCurrentPitchValue(reading.PitchDegrees);
                }

                //MaxValue.Text = result != null ? result : Helpers.SensorCalculation.maxPitchValue.ToString();

                if (Helpers.SensorCalculation.doBeep)
                {
                    PlaySound(_dingSound);
                    Helpers.SensorCalculation.doBeep = false;
                }
            });
        }
Beispiel #10
0
        void OnReadingChanged(Sensor sender, InclinometerReadingChangedEventArgs args)
        {
            var handler = changed;

            if (handler != null)
            {
                var value = ConvertToInclination(args.Reading);
                var e = new InclinometerEventArgs(value);
                handler.Invoke(this, e);
            }
        }
 private void Inclinometer_ReadingChanged(Windows.Devices.Sensors.Inclinometer sender, Windows.Devices.Sensors.InclinometerReadingChangedEventArgs args)
 {
     if (Interlocked.CompareExchange(ref Updating, 1, 0) == 1)
     {
         return;
     }
     Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         UpdateElementsOnScreen(args.Reading);
         Interlocked.Exchange(ref Updating, 0);
     });
 }
 public void myIncliHandler(Inclinometer i, InclinometerReadingChangedEventArgs e)
 {
     Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
         () =>
         {
             this.value_incli_yaw.Text = e.Reading.YawDegrees.ToString("0.00");
             this.incliYaw = e.Reading.YawDegrees;
             this.value_incli_pitch.Text = e.Reading.PitchDegrees.ToString("0.00");
             this.incliPitch = e.Reading.PitchDegrees;
             this.value_incli_roll.Text = e.Reading.RollDegrees.ToString("0.00");
             this.incliRoll = e.Reading.RollDegrees;
             checkTimeToLog();
         }
     );
 }
 private void InclinometerReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
 {
     if (this.ReadingChanged != null) ReadingChanged(_sensor, args);
 }
Beispiel #14
0
 private void OnInclineReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
 {
 }
 private async void OnInclinometerReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         _reading.InsertVector3("Offset", new Vector3(e.Reading.RollDegrees, e.Reading.PitchDegrees, 0.0f));
     });
 }
Beispiel #16
0
 /// <summary>
 /// This is the event handler for ReadingChanged events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 async private void ReadingChanged(object sender, InclinometerReadingChangedEventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         InclinometerReading reading = e.Reading;
         ScenarioOutput_X.Text = String.Format("{0,5:0.00}", reading.PitchDegrees);
         ScenarioOutput_Y.Text = String.Format("{0,5:0.00}", reading.RollDegrees);
         ScenarioOutput_Z.Text = String.Format("{0,5:0.00}", reading.YawDegrees);
         switch (reading.YawAccuracy)
         {
             case MagnetometerAccuracy.Unknown:
                 ScenarioOutput_YawAccuracy.Text = "Unknown";
                 break;
             case MagnetometerAccuracy.Unreliable:
                 ScenarioOutput_YawAccuracy.Text = "Unreliable";
                 break;
             case MagnetometerAccuracy.Approximate:
                 ScenarioOutput_YawAccuracy.Text = "Approximate";
                 break;
             case MagnetometerAccuracy.High:
                 ScenarioOutput_YawAccuracy.Text = "High";
                 break;
             default:
                 ScenarioOutput_YawAccuracy.Text = "No data";
                 break;
         }
     });
 }
Beispiel #17
0
        /// <summary>
        /// send sensor data to server ,depend on different mode.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void inclinometer_ReadingChanged(Inclinometer sender, InclinometerReadingChangedEventArgs args)
        {
            InclinometerReading reading = args.Reading;

            if (args.Reading.YawAccuracy != InclinometerState)
            {
                InclinometerState = args.Reading.YawAccuracy;
                if (InclinometerStateChanged != null)
                    InclinometerStateChanged(this, EventArgs.Empty);
            }

            if (connected && mode == SensorMode.TRACKER)
                App.comHelper.sendTrack(-(reading.YawDegrees-offYaw), -(reading.RollDegrees-offRoll), -(reading.PitchDegrees-offPitch));
            else if (connected && mode == SensorMode.JOYSTICK)
                App.comHelper.sendAxis((reading.PitchDegrees-offPitch) / 120 + 0.5, -(reading.RollDegrees-offRoll) / 100 + 0.5);
            else if (mode == SensorMode.CALIBRATION)
            {
                offYaw = reading.YawDegrees;
                offRoll = reading.RollDegrees;
                offPitch = reading.PitchDegrees;
            }
        }
 /// <summary>
 /// This is the event handler for ReadingChanged events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 async private void ReadingChanged(object sender, InclinometerReadingChangedEventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         InclinometerReading reading = e.Reading;
         ScenarioOutput_X.Text = String.Format("{0,5:0.00}", reading.PitchDegrees);
         ScenarioOutput_Y.Text = String.Format("{0,5:0.00}", reading.RollDegrees);
         ScenarioOutput_Z.Text = String.Format("{0,5:0.00}", reading.YawDegrees);
     });
 }