Floating point 蓝牙浮点表示
我正在尝试实现此蓝牙网格特性:Floating point 蓝牙浮点表示,floating-point,bluetooth-mesh,Floating Point,Bluetooth Mesh,我正在尝试实现此蓝牙网格特性: <!-- Copyright 2017 Bluetooth SIG, Inc. All rights reserved. --> <Characteristic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd
<!--
Copyright 2017 Bluetooth SIG, Inc. All rights reserved.
-->
<Characteristic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd" name="Illuminance" type="org.bluetooth.characteristic.illuminance" uuid="2AFB" last-modified="2017-07-11" approved="Yes">
<InformativeText>
<Abstract>
The Illuminance characteristic is used to represent a measure of illuminance in units of lux.
</Abstract>
</InformativeText>
<Value>
<Field name="Illuminance">
<InformativeText>Unit is lux with a resolution of 0.01.</InformativeText>
<Format>uint24</Format>
<Unit>org.bluetooth.unit.lux</Unit>
<Minimum>0</Minimum>
<Maximum>167772.14</Maximum>
<DecimalExponent>-2</DecimalExponent>
<BinaryExponent>0</BinaryExponent>
<Multipler>1</Multipler>
<Description>
A value of 0xFFFFFF represents 'value is not known'. All other values are Prohibited.
</Description>
</Field>
</Value>
</Characteristic>
. 此特性表示以3字节为单位的勒克斯值
但我不知道如何才能将0x123456这样的值转换为真正的浮点数。似乎没有使用标准IEEE 754标准。我也不知道它们在decisemalexponent
和binaryIndex
中的含义
有人能帮我吗?
您好,Daan您链接到的页面中没有浮点。它将-2
与十进制指数一起使用
仅用于指定一个24位整数值,在纯二进制中,该整数值为0到16777214之间的某个数字x(16777215保留为“未知”)表示一个x•10的值−2勒克斯,范围从0.00勒克斯到167772.14勒克斯。这是定点,不是浮点;该点固定在以纯二进制整数表示的位置左侧两位数字处。您链接到的页面文本较短,应包含在您的问题中。外部链接更改或消失,这会导致堆栈溢出问题变得错误或无用。始终在问题本身中包含与您的问题相关的所有信息。非常感谢,这一点现在非常清楚。我还编辑了开场白。