作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为 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
}
}
我是否在代码中遗漏了什么或做错了什么?
最佳答案
已确认这是一个问题。此问题现已在 SDK 版本 20217 中修复。
关于c# - MS 波段 : All sensor data reporting stops after Altimeter sensor reports data [Possible Bug ?],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35416051/
我是一名优秀的程序员,十分优秀!