コード例 #1
0
ファイル: Pedometer.cs プロジェクト: woohyun/TizenFX
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, uint events_count, IntPtr data) => {
                updateBatchEvents(eventPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();

                TimeSpan              = new TimeSpan((Int64)sensorData.timestamp);
                StepCount             = (uint)sensorData.values[0];
                WalkStepCount         = (uint)sensorData.values[1];
                RunStepCount          = (uint)sensorData.values[2];
                MovingDistance        = sensorData.values[3];
                CalorieBurned         = sensorData.values[4];
                LastSpeed             = sensorData.values[5];
                LastSteppingFrequency = sensorData.values[6];
                LastStepStatus        = (PedometerState)sensorData.values[7];

                DataUpdated?.Invoke(this, new PedometerDataUpdatedEventArgs(sensorData.values));
            };

            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for pedometer sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pedometer");
            }
        }
コード例 #2
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, uint events_count, IntPtr data) => {
                updateBatchEvents(eventPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();

                TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
                X        = sensorData.values[0];
                Y        = sensorData.values[1];
                Z        = sensorData.values[2];
                BiasX    = sensorData.values[3];
                BiasY    = sensorData.values[4];
                BiasZ    = sensorData.values[5];

                DataUpdated?.Invoke(this, new UncalibratedMagnetometerDataUpdatedEventArgs(sensorData.values));
            };

            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for uncalibrated magnetometer sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for uncalibrated magnetometer");
            }
        }
コード例 #3
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
        private void GetProperty()
        {
            int error = (int)SensorError.None;

            error = Interop.Sensor.GetName(_sensorHandle, out _name);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor name");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Name Failed");
            }

            error = Interop.Sensor.GetVendor(_sensorHandle, out _vendor);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor vendor name");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Vendor Failed");
            }

            error = Interop.Sensor.GetMinRange(_sensorHandle, out _minValue);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor min value");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinValue Failed");
            }

            error = Interop.Sensor.GetMaxRange(_sensorHandle, out _maxValue);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor max value");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxValue Failed");
            }

            error = Interop.Sensor.GetResolution(_sensorHandle, out _resolution);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor resolution");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Resolution Failed");
            }

            error = Interop.Sensor.GetMinInterval(_sensorHandle, out _minInterval);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor min interval");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinInterval Failed");
            }

            error = Interop.Sensor.GetFifoCount(_sensorHandle, out _fifoCount);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor fifo count");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.FifoCount Failed");
            }

            error = Interop.Sensor.GetMaxBatchCount(_sensorHandle, out _maxBatchCount);
            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor max batch count");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxBatchCount Failed");
            }
        }
コード例 #4
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, uint events_count, IntPtr data) => {
                updateBatchEvents(eventPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();

                Timestamp = sensorData.timestamp;
                if (sensorData.values[0] == 0)
                {
                    Rotation = AutoRotationState.Degree_0;
                }
                else
                {
                    Rotation = (AutoRotationState)sensorData.values[0];
                }
                Accuracy = sensorData.accuracy;

                DataUpdated?.Invoke(this, new AutoRotationSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy));
            };

            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for auto-rotation sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for auto-rotation");
            }
        }
コード例 #5
0
 internal override void EventListenStop()
 {
     int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
     if (error != (int)SensorError.None)
     {
         Log.Error(Globals.LogTag, "Error unsetting event callback for uncalibrated gyroscope sensor");
         throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for uncalibrated gyroscope");
     }
 }
コード例 #6
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
        private void CreateListener()
        {
            int error = Interop.SensorListener.CreateListener(_sensorHandle, out _listenerHandle);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error cerating sensor listener handle");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.CreateListener Failed");
            }
        }
コード例 #7
0
        internal override void EventListenStop()
        {
            int error = Interop.SensorListener.UnsetEventsCallback(ListenerHandle);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error unsetting event callback for HeartRateMonitorLEDGreenBatch sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for HeartRateMonitorLEDGreenBatch");
            }
        }
コード例 #8
0
ファイル: GravitySensor.cs プロジェクト: yunmiha/TizenFX
        private void AccuracyListenStop()
        {
            int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for gravity sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for gravity");
            }
        }
コード例 #9
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
 private void SetMaxBatchLatency()
 {
     if (CheckListenerHandle())
     {
         int error = Interop.SensorListener.SetMaxBatchLatency(_listenerHandle, _maxBatchLatency);
         if (error != (int)SensorError.None)
         {
             Log.Error(Globals.LogTag, "Error setting max batch latency");
             throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.MaxBatchLatency Failed");
         }
     }
 }
コード例 #10
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
 internal void SetAttribute(SensorAttribute attribute, int option)
 {
     if (CheckListenerHandle())
     {
         int error = Interop.SensorListener.SetAttribute(_listenerHandle, attribute, option);
         if (error != (int)SensorError.None)
         {
             Log.Error(Globals.LogTag, "Error setting sensor pause policy");
             throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed");
         }
     }
 }
コード例 #11
0
        /// <summary>
        /// Read face down gesture detector data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading face down gesture detector data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading face down gesture detector data failed");
            }

            TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
            FaceDown = (DetectorState)sensorData.values[0];
        }
コード例 #12
0
ファイル: ProximitySensor.cs プロジェクト: yunmiha/TizenFX
        /// <summary>
        /// Read proximity sensor data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading proximity sensor data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading proximity sensor data failed");
            }

            Timestamp = sensorData.timestamp;
            Proximity = (ProximitySensorState)sensorData.values[0];
        }
コード例 #13
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
 private void SetInterval()
 {
     if (CheckListenerHandle())
     {
         if (_isSensing)
         {
             int error = Interop.SensorListener.SetInterval(_listenerHandle, _interval);
             if (error != (int)SensorError.None)
             {
                 Log.Error(Globals.LogTag, "Error setting sensor interval");
                 throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.SetInterval Failed");
             }
         }
     }
 }
コード例 #14
0
ファイル: GravitySensor.cs プロジェクト: yunmiha/TizenFX
        private void AccuracyListenStart()
        {
            _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => {
                Timestamp = timestamp;
                _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(timestamp, accuracy));
            };

            int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting accuracy event callback for gravity sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for gravity");
            }
        }
コード例 #15
0
        /// <summary>
        /// Reads HeartRateMonitorBatch data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            int error = Interop.SensorListener.ReadDataList(ListenerHandle, out IntPtr eventsPtr, out uint events_count);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading HeartRateMonitorBatch data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading HeartRateMonitorBatch data failed");
            }
            UpdateBatchData(eventsPtr, events_count);
            Interop.SensorEventStruct sensorData = latestEvent();
            Timestamp = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds();
            Accuracy  = sensorData.accuracy;
            Interop.Libc.Free(eventsPtr);
        }
コード例 #16
0
        /// <summary>
        /// Read stationary activity detector data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading stationary activity detector data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading stationary activity detector data failed");
            }

            TimeSpan         = new TimeSpan((Int64)sensorData.timestamp);
            Stationary       = (DetectorState)sensorData.values[0];
            ActivityAccuracy = (SensorDataAccuracy)sensorData.accuracy;
        }
コード例 #17
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
 /// <summary>
 /// Starts the sensor.
 /// After this, event handlers will start receiving events.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
 public void Start()
 {
     Log.Info(Globals.LogTag, "Starting the sensor");
     if (CheckListenerHandle())
     {
         int error = Interop.SensorListener.StartListener(_listenerHandle);
         if (error != (int)SensorError.None)
         {
             Log.Error(Globals.LogTag, "Error starting sensor");
             throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Start Sensor Listener");
         }
         EventListenStart();
         _isSensing = true;
         Log.Info(Globals.LogTag, "Sensor started");
     }
 }
コード例 #18
0
        /// <summary>
        /// Read accelerometer data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading accelerometer data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading accelerometer data failed");
            }

            TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
            X        = sensorData.values[0];
            Y        = sensorData.values[1];
            Z        = sensorData.values[2];
        }
コード例 #19
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
 /// <summary>
 /// Stops the sensor.
 /// After this, event handlers will stop receiving events.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
 public void Stop()
 {
     Log.Info(Globals.LogTag, "Stopping the sensor");
     if (_isSensing)
     {
         int error = Interop.SensorListener.StopListener(_listenerHandle);
         if (error != (int)SensorError.None)
         {
             Log.Error(Globals.LogTag, "Error stopping the sensor");
             throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Stop Sensor Listener");
         }
         EventListenStop();
         _isSensing = false;
         Log.Info(Globals.LogTag, "Sensor stopped");
     }
 }
コード例 #20
0
ファイル: OrientationSensor.cs プロジェクト: yunmiha/TizenFX
        /// <summary>
        /// Read orientation sensor data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading orientation sensor data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading orientation sensor data failed");
            }

            Timestamp = sensorData.timestamp;
            Azimuth   = sensorData.values[0];
            Pitch     = sensorData.values[1];
            Roll      = sensorData.values[2];
        }
コード例 #21
0
ファイル: Sensor.cs プロジェクト: yourina/TizenFX
        private void GetHandleList(SensorType type, uint index)
        {
            IntPtr list;

            IntPtr[] sensorList;
            int      count;
            int      error = Interop.SensorManager.GetSensorList(type, out list, out count);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error getting sensor list");
                throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.GetSensorList Failed");
            }
            sensorList    = Interop.IntPtrToIntPtrArray(list, count);
            _sensorHandle = sensorList[index];
            Interop.Libc.Free(list);
        }
コード例 #22
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventsPtr, uint events_count, IntPtr data) =>
            {
                UpdateBatchData(eventsPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();
                Timestamp = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds();
                Accuracy  = sensorData.accuracy;
                DataUpdated?.Invoke(this, new HeartRateMonitorBatchDataUpdatedEventArgs((IReadOnlyList <HeartRateMonitorBatchData>)Data));
            };
            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for HeartRateMonitorBatch sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for HeartRateMonitorBatch");
            }
        }
コード例 #23
0
        /// <summary>
        /// Read magnetometer rotation vector sensor data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading magnetometer rotation vector sensor data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading magnetometer rotation vector sensor data failed");
            }

            Timestamp = sensorData.timestamp;
            X         = sensorData.values[0];
            Y         = sensorData.values[1];
            Z         = sensorData.values[2];
            W         = sensorData.values[3];
            Accuracy  = sensorData.accuracy;
        }
コード例 #24
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => {
                Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr);

                TimeSpan         = new TimeSpan((Int64)sensorData.timestamp);
                UltravioletIndex = sensorData.values[0];

                DataUpdated?.Invoke(this, new UltravioletSensorDataUpdatedEventArgs(sensorData.values[0]));
            };

            int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for ultraviolet sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for ultraviolet");
            }
        }
コード例 #25
0
        /// <summary>
        /// Read uncalibrated gyroscope data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading uncalibrated gyroscope data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading uncalibrated gyroscope data failed");
            }

            Timestamp = sensorData.timestamp;
            X         = sensorData.values[0];
            Y         = sensorData.values[1];
            Z         = sensorData.values[2];
            BiasX     = sensorData.values[3];
            BiasY     = sensorData.values[4];
            BiasZ     = sensorData.values[5];
        }
コード例 #26
0
ファイル: Pedometer.cs プロジェクト: woohyun/TizenFX
        /// <summary>
        /// Read pedometer sensor data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct pedoSensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out pedoSensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading pedometer sensor data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading pedometer sensor data failed");
            }

            StepCount             = (uint)pedoSensorData.values[0];
            WalkStepCount         = (uint)pedoSensorData.values[1];
            RunStepCount          = (uint)pedoSensorData.values[2];
            MovingDistance        = pedoSensorData.values[3];
            CalorieBurned         = pedoSensorData.values[4];
            LastSpeed             = pedoSensorData.values[5];
            LastSteppingFrequency = pedoSensorData.values[6];
            LastStepStatus        = (PedometerState)pedoSensorData.values[7];
        }
コード例 #27
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => {
                Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr);

                TimeSpan         = new TimeSpan((Int64)sensorData.timestamp);
                InVehicle        = (DetectorState)sensorData.values[0];
                ActivityAccuracy = (SensorDataAccuracy)sensorData.accuracy;

                DataUpdated?.Invoke(this, new InVehicleActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
            };

            int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for invehicle activity detector");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for invehicle activity detector");
            }
        }
コード例 #28
0
ファイル: ProximitySensor.cs プロジェクト: yunmiha/TizenFX
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, uint events_count, IntPtr data) => {
                updateBatchEvents(eventPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();

                Timestamp = sensorData.timestamp;
                Proximity = (ProximitySensorState)sensorData.values[0];

                DataUpdated?.Invoke(this, new ProximitySensorDataUpdatedEventArgs(sensorData.values[0]));
            };

            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for proximity sensor");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for proximity");
            }
        }
コード例 #29
0
        internal override void EventListenStart()
        {
            _callback = (IntPtr sensorHandle, IntPtr eventPtr, uint events_count, IntPtr data) => {
                updateBatchEvents(eventPtr, events_count);
                Interop.SensorEventStruct sensorData = latestEvent();

                TimeSpan         = new TimeSpan((Int64)sensorData.timestamp);
                Running          = (DetectorState)sensorData.values[0];
                ActivityAccuracy = (SensorDataAccuracy)sensorData.accuracy;

                DataUpdated?.Invoke(this, new RunningActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
            };

            int error = Interop.SensorListener.SetEventsCallback(ListenerHandle, _callback, IntPtr.Zero);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error setting event callback for running activity detector");
                throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for running activity detector");
            }
        }
コード例 #30
0
        /// <summary>
        /// Read auto-rotation data synchronously.
        /// </summary>
        internal override void ReadData()
        {
            Interop.SensorEventStruct sensorData;
            int error = Interop.SensorListener.ReadData(ListenerHandle, out sensorData);

            if (error != (int)SensorError.None)
            {
                Log.Error(Globals.LogTag, "Error reading auto-rotation data");
                throw SensorErrorFactory.CheckAndThrowException(error, "Reading auto-rotation data failed");
            }

            Timestamp = sensorData.timestamp;
            if (sensorData.values[0] == 0)
            {
                Rotation = AutoRotationState.Degree_0;
            }
            else
            {
                Rotation = (AutoRotationState)sensorData.values[0];
            }
            Accuracy = sensorData.accuracy;
        }