/// <summary>
		/// Called when [update].
		/// </summary>
		/// <param name="gyroData">The gyro data.</param>
		/// <param name="error">The error.</param>
		private void OnUpdate(CMGyroData gyroData, NSError error)
		{
			if (error != null)
			{
				this.readingAvailable.Invoke(
					this,
					new Vector3(gyroData.RotationRate.x, gyroData.RotationRate.y, gyroData.RotationRate.z));
			}
		}
Exemple #2
0
 /// <summary>
 /// Called when [update].
 /// </summary>
 /// <param name="gyroData">The gyro data.</param>
 /// <param name="error">The error.</param>
 private void OnUpdate(CMGyroData gyroData, NSError error)
 {
     if (error != null)
     {
         this.readingAvailable.Invoke(
             this,
             new Vector3(gyroData.RotationRate.x, gyroData.RotationRate.y, gyroData.RotationRate.z));
     }
 }
 void HandleCMGyroHandler(CMGyroData gyroData, NSError error)
 {
     _gyroscoperRepository.Add(new Gyroscope()
     {
         Timestamp = DateTimeOffset.Now,
         X         = Convert.ToSingle(gyroData.RotationRate.x),
         Y         = Convert.ToSingle(gyroData.RotationRate.y),
         Z         = Convert.ToSingle(gyroData.RotationRate.z)
     });
 }
 /// <summary>
 /// Raises the gyroscope changed event.
 /// </summary>
 /// <param name="data">Data.</param>
 /// <param name="error">Error.</param>
 void OnGyroscopeChanged(CMGyroData data, NSError error)
 {
     if (error == null)
     {
         OnReadingChanged?.Invoke(this, new DeviceSensorReadingEventArgs <VectorReading>(new VectorReading(data.RotationRate.x, data.RotationRate.y, data.RotationRate.z)));
     }
     else
     {
         OnReadingError?.Invoke(this, new DeviceSensorReadingErrorEventArgs(error.Description));
     }
 }
Exemple #5
0
        void DataUpdated(CMGyroData data, NSError error)
        {
            if (data == null)
            {
                return;
            }

            var field    = data.RotationRate;
            var gyroData = new GyroscopeData(field.x, field.y, field.z);

            RaiseReadingChanged(gyroData);
        }
Exemple #6
0
 private void OnGyroscopeChanged(CMGyroData data, NSError error)
 {
     OnSensorValueChanged(new SensorValueChangedEventArgs
     {
         ValueType  = MotionSensorValueType.Vector,
         SensorType = MotionSensorType.Gyroscope,
         Value      = new MotionVector()
         {
             X = data.RotationRate.x, Y = data.RotationRate.y, Z = data.RotationRate.z
         }
     });
 }
Exemple #7
0
        void DataUpdated(CMGyroData data, NSError error)
        {
            if (data == null)
            {
                return;
            }

#pragma warning disable CA1416 // https://github.com/xamarin/xamarin-macios/issues/14619
            var field = data.RotationRate;
#pragma warning restore CA1416
            var gyroData = new GyroscopeData(field.x, field.y, field.z);
            RaiseReadingChanged(gyroData);
        }
Exemple #8
0
        private void UpdateHandler(CMGyroData gyroData, NSError error)
        {
            if (error == null)
            {
                var rate = gyroData.RotationRate;
                this.readingAvailable.Invoke<GyroReading>(
                    gyroData,
                    new GyroReading(rate.x, rate.y, rate.z));
            }

            if (this.OnError != null)
            {
                this.OnError.Invoke<Exception>(this.manager, new Exception(error.LocalizedDescription));
            }
        }
Exemple #9
0
        private void UpdateHandler(CMGyroData gyroData, NSError error)
        {
            if (error == null)
            {
                var rate = gyroData.RotationRate;
                this.readingAvailable.Invoke <GyroReading>(
                    gyroData,
                    new GyroReading(rate.x, rate.y, rate.z));
            }

            if (this.OnError != null)
            {
                this.OnError.Invoke <Exception>(this.manager, new Exception(error.LocalizedDescription));
            }
        }
        private void OnGyroReadingValueChanged(CMGyroData gyroData, NSError error)
        {
            if (this.SensorValueChanged == null)
            {
                return;
            }


            this.SensorValueChanged((object)this, new SensorReadingValueChangedEventArgs()
            {
                SensorType = SensorType.Gyroscope,
                Value      = new SensorVectorValue()
                {
                    X = gyroData.RotationRate.x, Y = gyroData.RotationRate.y, Z = gyroData.RotationRate.z
                },
            });
        }
        /// <summary>
        /// Raises the gyroscope changed event.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <param name="error">Error.</param>
        private void OnGyroscopeChanged(CMGyroData data, NSError error)
        {
            if (SensorValueChanged == null)
                return;

            SensorValueChanged(this, new SensorValueChangedEventArgs { ValueType = MotionSensorValueType.Vector, SensorType = MotionSensorType.Gyroscope, Value = new MotionVector() { X = data.RotationRate.x, Y = data.RotationRate.y, Z = data.RotationRate.z } });

        }
Exemple #12
0
 /// <summary>
 /// Raises the gyroscope changed event.
 /// </summary>
 /// <param name="data">Data.</param>
 /// <param name="error">Error.</param>
 void OnGyroscopeChanged(CMGyroData data, NSError error)
 {
     OnReadingChanged?.Invoke(this, new DeviceSensorReadingEventArgs <VectorReading>(new VectorReading(data.RotationRate.x, data.RotationRate.y, data.RotationRate.z)));
 }
Exemple #13
0
 void HandleChanged(CMGyroData data, NSError _)
 {
     OnChanged(new MotionVector(data.RotationRate.x, data.RotationRate.y, data.RotationRate.z));
 }