gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 12:41:57 28 4
gpt4 key购买 nike

我正在为 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com