c# - MS 波段 : All sensor data reporting stops after Altimeter sensor reports data [Possible Bug ?]

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

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

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

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

    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. 代码显示了调试和发布(使用 .Net Native 编译器工具链)构建的问题
  3. 如果我使用 Microsoft Band SDK 1.3.11121,此代码可以正常工作,但不适用于 SDK 1.3.20115。

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

最佳答案

已确认这是一个问题。此问题现已在 SDK 版本 20217 中修复。

关于c# - MS 波段 : All sensor data reporting stops after Altimeter sensor reports data [Possible Bug ?],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35416051/

相关文章:

c# - 如何在 C# 中为 Windows Metro 风格应用程序在屏幕上绘图?

visual-studio-2015 - Windows 10 UAP 部署代码 705 和 DEP0700/DEP6100/DEP6200

android - 我可以在没有 Microsoft Health 应用的情况下连接到 Microsoft Band吗

c# - 从 Microsoft Health API 检索数据

c# - 在 asp :image in code-behind 中显示数据表中的图像

c# - 卸载 MVC 4 RC 后难以安装 MVC 3

c# - 排序列表<List<string>>

uwp - 获取通话记录仅返回最后 20 条日志

c# - 在通用 Windows 10 上获取外部 IP 地址

windows - 将手环与我的 Windows 10 应用程序配对