I am developing a UWP app for Microsoft Band and upgraded recently to Microsoft Band SDK ver 1.3.20115 from Band SDK ver 1.3.11121.
I noticed that if I am subscribed to ReadingChanged event of several sensors (including Altimeter sensor), I don't receive data for any sensor (including Altimeter) once the Altimeter sensor reports the data for the first time.
I have the simplified version of the code, where I can still see the problem:
IBandClient bandClient;
async void SetupBand()
{
IBandInfo[] pairedBands = await BandClientManager.Instance.GetBandsAsync();
try
{
bandClient = await BandClientManager.Instance.ConnectAsync(pairedBands[0]);
if (bandClient.SensorManager.Gyroscope.GetCurrentUserConsent() != UserConsent.Granted)
{
await bandClient.SensorManager.Gyroscope.RequestUserConsentAsync();
}
if (bandClient.SensorManager.Altimeter.GetCurrentUserConsent() != UserConsent.Granted)
{
await bandClient.SensorManager.Altimeter.RequestUserConsentAsync();
}
IEnumerable<TimeSpan> supportedAltimeterReportingIntervals = bandClient.SensorManager.Altimeter.SupportedReportingIntervals;
TimeSpan T1 = supportedAltimeterReportingIntervals.First();
bandClient.SensorManager.Altimeter.ReportingInterval = T1;
IEnumerable<TimeSpan> supportedGyroscopeReportingIntervals = bandClient.SensorManager.Gyroscope.SupportedReportingIntervals;
TimeSpan T2 = supportedGyroscopeReportingIntervals.First();
bandClient.SensorManager.Gyroscope.ReportingInterval = T2;
bandClient.SensorManager.Altimeter.ReadingChanged += (sender, args) =>
{
System.Diagnostics.Debug.WriteLine("Input received for Altimeter");
};
bandClient.SensorManager.Gyroscope.ReadingChanged += (sender, args) =>
{
System.Diagnostics.Debug.WriteLine("Input received for Gyroscope");
};
await bandClient.SensorManager.Gyroscope.StartReadingsAsync();
await bandClient.SensorManager.Altimeter.StartReadingsAsync();
}
catch (BandException ex)
{
// handle a Band connection exception
}
}
Am I missing something or doing incorrectly in the code ?
This was confirmed to be an issue. This issue has been fixed in SDK version 20217 now.