2016-01-21 74 views
2

Band 1允許設置傳感器讀數的報告間隔。Microsoft Band 2支持的報告間隔

現在band 2看起來像只有一個支持的讀取間隔並且不能更改。有誰知道:

  1. Microsoft Band上每個傳感器允許支持的報告間隔時間?
  2. 如何更改報告間隔?

到目前爲止,作爲一個例子,我有以下代碼:

this.bandClient.SensorManager.Altimeter.ReadingChanged += this.OnAltimeterReadingChanged; 

//bandClient.SensorManager.Altimeter.ReportingInterval = TimeSpan.FromMilliseconds(1000); 

//get a list of available reporting intervals 
IEnumerable<TimeSpan> supportedAltimeterReportingIntervals =bandClient.SensorManager.Altimeter.SupportedReportingIntervals; 

foreach (var ri in supportedAltimeterReportingIntervals) 
{ 
    Debug.WriteLine("Altimeter Reporting Interval is {0}", ri.ToString()); 
} 

這條線:

//bandClient.SensorManager.Altimeter.ReportingInterval = TimeSpan.FromMilliseconds(1000); 

返回:

拋出異常:「系統。 ArgumentOutOfRangeException'in Microsoft.Band.ni.DLL

支持報告間隔中的枚舉,返回:高度表 報告間隔是00:00:00.5000000(僅1個間隔)

回答

2

在帶中的每個傳感器具有其自己的一組支持的報告間隔中(有時只有一個支持的時間間隔)。無論是那也不該報告的時間間隔設置了帶1和2之間改變了(帶2增加了新的傳感器,如高度計,未在頻帶1存在)

關於問題#1,你可以找到有關中Microsoft Health development site處的每個傳感器的信息。 (奇怪的是,他們列出的高度表爲1Hz,但SDK顯然返回2Hz作爲報告間隔。)

關於問題#2,您使用IBandSensor.ReportingInterval = <TimeSpan>來設置報告間隔,其中TimeSpan是其中的一個值IBandSensor.SupportedReportingIntervals

在您的示例代碼中,您試圖將高度計傳感器設置爲以不支持的間隔進行報告,這就是您看到異常的原因。

+0

剛剛在第4頁找到了頻率。非常感謝! – MadProgrammer