MS波段:所有传感器数据报告在高度计传感器报告数据后停止[可能的错误?]

时间:2016-02-15 18:02:03

标签: c# win-universal-app microsoft-band

我正在为Microsoft Band开发一个UWP应用程序,并最近从Band SDK ver 1.3.11121升级到Microsoft Band SDK ver 1.3.20115。

我注意到如果我订阅了几个传感器的ReadingChanged事件(包括高度计传感器),一旦高度计传感器第一次报告数据,我就不会收到任何传感器(包括高度计)的数据。

我有代码的简化版本,我仍然可以看到问题:

    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
        }

    }
  1. 通过上面的代码,我看到了陀螺仪传感器的大量更新,但是一旦高度计传感器报告了数据,陀螺仪和高度计的所有数据报告都会停止。
  2. 代码显示Debug和Release(使用.Net Native编译器工具链)构建的问题
  3. 如果我使用Microsoft Band SDK 1.3.11121,此代码可以正常工作,但不适用于SDK 1.3.20115。
  4. 我在代码中遗漏了什么或做错了吗?

1 个答案:

答案 0 :(得分:1)

这被证实是一个问题。此问题已在SDK版本20217中得到修复。