Band 1 allows setting reporting intervals for sensor readings.
Now band 2, looks like it has only one supported reading interval and it cannot be changed. Does anyone know:
So far, as an example, I have the following code:
this.bandClient.SensorManager.Altimeter.ReadingChanged += this.OnAltimeterReadingChanged;
//bandClient.SensorManager.Altimeter.ReportingInterval = TimeSpan.FromMilliseconds(1000);
//get a list of available reporting intervals
IEnumerable<TimeSpan> supportedAltimeterReportingIntervals =bandClient.SensorManager.Altimeter.SupportedReportingIntervals;
foreach (var ri in supportedAltimeterReportingIntervals)
{
Debug.WriteLine("Altimeter Reporting Interval is {0}", ri.ToString());
}
This line:
//bandClient.SensorManager.Altimeter.ReportingInterval = TimeSpan.FromMilliseconds(1000);
Returns:
Exception thrown: 'System.ArgumentOutOfRangeException' in Microsoft.Band.ni.DLL
The enumeration of supported reporting intervals, returns: Altimeter Reporting Interval is 00:00:00.5000000 (Only 1 interval)
Each sensor on the Band has its own set of supported reporting intervals (and sometimes only a single supported interval). Neither that nor the way in which reporting intervals are set has changed between Band 1 and 2. (Band 2 adds new sensors, such as the altimeter, that did not exist in Band 1.)
Regarding question #1, you can find information about each of the sensors in the documentation at the Microsoft Health development site. (Curiously, they list the altimeter as being 1Hz, but the SDK is apparently returning 2Hz as the reporting interval.)
Regarding question #2, you set the reporting interval using the IBandSensor.ReportingInterval = <TimeSpan>
where the TimeSpan
is one of the values from IBandSensor.SupportedReportingIntervals
.
In your example code, you were attempting to set the altimeter sensor to report at an unsupported interval, which is why you see the exception.