What's the maximum length of a BLE Manufacturer Specific Data AD?

风流意气都作罢 提交于 2021-02-07 06:12:49

问题


A BLE advertisement can send out 31 bytes at max. Inside an advertisement, there might be several ADs.

I'm wondering whether it is valid to make an advertisement contains just one Manufacturer Specific Data AD, and whether this kind of AD can fill up all the 31 bytes(1 byte of length field, 1 byte of type field(0xff), 2 bytes of CIC and 27 bytes of custom data).

Is the Bluetooth Core Specification or any other specification specify this?


回答1:


From the spec- Supplement to the Bluetooth Core Specification Version 4 Part A 1.4:

1.4.1 Description

The Manufacturer Specific data type is used for manufacturer specific data. The first two data octets shall contain a company identifier code from the Assigned Numbers - Company Identifiers document. The interpretation of any other octets within the data shall be defined by the manufacturer specified by the company identifier.

1.4.2 Format Data Type <>

Description: Size: 2 or more octets The first 2 octets contain the Company Identifier Code followed by additional manufacturer specific data

Table 1.4: Manufacturer Specific Data Type

So there is no limit except the advertising packet length itself, which is 31 bytes per advertising data and another 31 bytes for scan response.

There is the requirement for the 3 bytes at the beginning of advertising data that have the Flags ad type (required for any non-zero length advertising, see Core V4.0 Volume 3 Part C 11.1.3), reducing your advertising data length by 3.

Then there is the manufacturing ad type flags and length that get added to your manufacturing data, minus another 2 bytes. This leaves you with:

  • 26 bytes in the advertising data or
  • 29 bytes in the scan response

for manufacturing data itself (although two of those bytes should be used for specifying the Company Identifier Code) which would bring it to:

  • 24 bytes of actual data in the advertising data or
  • 27 bytes in the scan response.



回答2:


There is no restriction in the BT spec about the AD Type data in the avertising data (AdvData) The AdvData can be empty or contain one/more AD Type data. That's up to the device/app. So there is nothing preventing you from using the full capacity for a Manufacturer Specific data.

note: AD Type formats are defined in the Core Specification Supplement.



来源:https://stackoverflow.com/questions/33535404/whats-the-maximum-length-of-a-ble-manufacturer-specific-data-ad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!