简体   繁体   English

如何从诺基亚Health Api读取温度?

[英]How to read temperature from Nokia Health Api?

When reading the temperature from the Nokia health API, I am getting the following readings. 从诺基亚健康API读取温度时,我得到以下读数。 However, these are not correct. 但是,这些是不正确的。 In the Nokia app, the readings in Celsius are as follows: 在诺基亚应用程序中,摄氏温度读数如下:

35C { value: 26918, type: 12, unit: -3 }

35.6C { value: 23569, type: 12, unit: -3 }

36.7C { value: 27398, type: 12, unit: -3 }

From what I could gather from the docs : 从我可以从文档中收集到的信息

value is the value of the measure. value是度量值。 This needs to be used in conjunction with the unit parameter to get the correct value. 需要将此参数与unit参数结合使用以获取正确的值。

type indicates the measure type. type表示度量类型。 In this case, 12 means temperature 在这种情况下,12表示温度

unit is the exponential multiplier which needs to be multiplied with the value field to get the actual value in SI units. unit是指数乘数,需要将其与value字段相乘才能获得以SI为单位的实际值。

Formula: 式:

actualValue = value * (10 ^ unit)

Breaking down one of your examples: 分解您的示例之一:

{ value: 26918, type: 12, unit: -3 }

Here type is 12 so it's temperature (consequently, we can assume the units to be Kelvin if the API returns in SI units) 这里的类型是12,所以是温度(因此,如果API以SI单位返回,我们可以假设单位为开氏温度)

so, actualValue = 26918 * (10 ^ -3) which is 26.918K 因此, actualValue = 26918 * (10 ^ -3)26.918K

The docs don't explicitly mention what the temperature units are. 文档没有明确提及温度单位是​​什么。 I have assumed it to be Kelvin because that is the SI unit of temperature. 我假设它是开氏温度,因为那是温度的国际单位制。 Excerpt from docs: 摘录自文档:

Value

Value for the measure in SI units (kilogram, meters, etc.). 以SI单位(千克,米等)表示的度量值。 Value should be multiplied by 10 to the power of "unit" (see below) to get the real value. 值应乘以10乘以“单位”的乘方(见下文),以获得真实值。

Unit 单元

Power of ten the "value" parameter should be multiplied to to get the real value. 应将“值”参数的十次幂乘以得出真实值。 Eg : value = 20 and unit=-1 means the value really is 2.0 例如:value = 20和unit = -1表示该值确实为2.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM