一个 BLE 特征中多个字段的字节顺序

Byte order of multiple fields in one BLE characteristic

on bluetooth.org 我看到一个 BLE 特性可以有多个字段。我现在搜索了一段时间,但没有得到关于字节顺序的答案。

比如这个特征: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gatt.service_changed.xml

它有两个字段。 "Start of Affected Attribute Handle Range"是高16位还是低位?

问候 马兹

GATT 字段总是(或者至少应该总是)小端。这在 Bluetooth Core Spec.

中讨论

来自规范的 v4.2,第 3 卷,G 部分(涵盖 GATT),第 523 页:

2.4 Profile Fundamentals

...

• Multi-octet fields within the GATT Profile shall be sent least significant octet first (little endian).

请务必仔细阅读此规范,因为有 部分按网络顺序(大端)排列,但 GATT 属性始终应采用小端排列。

(我说“应该 永远是”的唯一原因是蓝牙设备的一个规则是你总会在现场找到一些打破蓝牙设备的设备规则....但规范很明确。)