我注意到如果我订阅了几个传感器的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中修复. 总结以上是内存溢出为你收集整理的c# – MS Band:所有传感器数据报告在高度计传感器报告数据后停止[可能的错误?]全部内容,希望文章能够帮你解决c# – MS Band:所有传感器数据报告在高度计传感器报告数据后停止[可能的错误?]所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)