MS Band: all data on the sensor data is terminated after the altimeter sensors report [Possible error?]

I am developing a UWP application for the Microsoft Band and recently updated it to the Microsoft Band SDK version 1.3.20115 from the Band SDK version 1.3.11121.

I noticed that if I signed up for the ReadingChanged event of several sensors (including an altimeter sensor), I do not receive data for any sensor (including an altimeter) as soon as the altimeter sensor reports data for the first time.

I have a simplified version of the code where I 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
        }

    }
  • With the code above, I see a set of updates for the gyro sensor, but as soon as the altimeter sensor reports data, all further data messages for the gyro and altimeter stop.
  • , ( .Net).
  • , Microsoft Band SDK 1.3.11121, SDK 1.3.20115.

- ?

+4
1

. ​​ SDK 20217.

+1

Source: https://habr.com/ru/post/1628885/


All Articles