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 } }
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 }
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; }
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(); } }
protected MicrosoftBandProbeBase() { _samplingRate = BandSensorSampleRate.Ms16; }
public abstract Task StartReadingsAsync(BandSensorSampleRate sampleRate);