Beispiel #1
0
        void PlatformStart(SensorSpeed sensorSpeed)
        {
            sensor = DefaultSensor;

            var interval = sensorSpeed.ToPlatform();

            sensor.ReportInterval = sensor.MinimumReportInterval >= interval ? sensor.MinimumReportInterval : interval;

            sensor.ReadingChanged += DataUpdated;
        }
Beispiel #2
0
 public static Magnetometer GetDefault()
 {
     if (_initializationAttempted)
     {
         return(_instance);
     }
     lock (_syncLock)
     {
         if (!_initializationAttempted)
         {
             _instance = TryCreateInstance();
             _initializationAttempted = true;
         }
         return(_instance);
     }
 }
Beispiel #3
0
        internal static void PlatformStart(SensorSpeed sensorSpeed)
        {
            sensor = DefaultSensor;
            var interval = NormalInterval;

            switch (sensorSpeed)
            {
            case SensorSpeed.Fastest:
                interval = FastestInterval;
                break;

            case SensorSpeed.Game:
                interval = GameInterval;
                break;
            }

            sensor.ReportInterval = sensor.MinimumReportInterval >= interval ? sensor.MinimumReportInterval : interval;

            sensor.ReadingChanged += DataUpdated;
        }
Beispiel #4
0
 void PlatformStop()
 {
     sensor.ReadingChanged -= DataUpdated;
     sensor.ReportInterval  = 0;
     sensor = null;
 }