Exemplo n.º 1
0
        public static NativeSampleRate ToNative(this BandSensorSampleRate sampleRate)
        {
            switch (sampleRate)
            {
            case BandSensorSampleRate.Ms128:
#if __ANDROID__
                return(NativeSampleRate.Ms128);
#elif WINDOWS_PHONE_APP
                return(NativeSampleRate.FromMilliseconds(128));
#endif
            case BandSensorSampleRate.Ms32:
#if __ANDROID__
                return(NativeSampleRate.Ms32);
#elif WINDOWS_PHONE_APP
                return(NativeSampleRate.FromMilliseconds(32));
#endif
            case BandSensorSampleRate.Ms16:
            default:
#if __ANDROID__
                return(NativeSampleRate.Ms16);
#elif WINDOWS_PHONE_APP
                return(NativeSampleRate.FromMilliseconds(16));
#endif
            }
        }
Exemplo n.º 2
0
        public override async Task StartReadingsAsync(BandSensorSampleRate sampleRate)
        {
#if __ANDROID__
            Native.StartReadings();
#elif __IOS__
            Native.StartReadings();
#elif WINDOWS_PHONE_APP
            Native.ApplySampleRate(sampleRate);
            await Native.StartReadingsAsync();
#endif
        }
Exemplo n.º 3
0
        protected MicrosoftBandProbeBase()
        {
            _samplingRate = BandSensorSampleRate.Ms16;

            // non-contact band probes should stop when the band is not being worn. if
            // the user sets _stopWhenNotWorn to true on the contact probe, nothing will
            // happen (i.e., the contact probe will continue running) because we don't
            // hook up the contact event below.
            _stopWhenNotWorn       = !(this is MicrosoftBandContactProbe);
            _stoppedBecauseNotWorn = false;
        }
Exemplo n.º 4
0
        public static void ApplySampleRate <T>(this Microsoft.Band.Sensors.IBandSensor <T> sensor, BandSensorSampleRate sampleRate)
            where T : Microsoft.Band.Sensors.IBandSensorReading
        {
            var nativeRate = ToNative(sampleRate);
            var intervals  = sensor.SupportedReportingIntervals;

            if (intervals.Contains(nativeRate))
            {
                sensor.ReportingInterval = nativeRate;
            }
            else
            {
                sensor.ReportingInterval = intervals.First();
            }
        }
Exemplo n.º 5
0
 protected MicrosoftBandProbeBase()
 {
     _samplingRate = BandSensorSampleRate.Ms16;
 }
 public abstract Task StartReadingsAsync(BandSensorSampleRate sampleRate);