c# – MS 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
        }

    }

>通过上面的代码,我看到陀螺仪传感器的大量更新,但是一旦高度计传感器报告数据,所有进一步的陀螺仪和高度计数据报告都会停止.
>代码显示了Debug和Release(带有.Net Native编译器工具链)构建的问题
>如果我使用Microsoft Band SDK 1.3.11121,此代码可以正常工作,但不适用于SDK 1.3.20115.

我在代码中遗漏了什么或做错了吗?

最佳答案 这被证实是一个问题.此问题现已在SDK版本20217中修复.

点赞