This topic describes the Bluetooth Low Energy (LE) advertising specification for non-connectable devices that only broadcast data.
Broadcast specification
The Bluetooth advertising packet format conforms to the Bluetooth 4.0 specification. A packet consists of multiple AD Structures. Each AD Structure contains a Length, an AD Type, and AD Data, as shown in the following figure. For more information, see the Bluetooth 4.2 Core Specification, Volume 3, Part C, Chapter 11.

Broadcast data format
The AD Type for Alibaba-specific manufacturer data must be 0xFF. The advertising data must be stored in little-endian format.
| Category | Field | Bytes | Value | Description |
| Flags | length | 1 | 0x2 | Flags length |
| AD Type | 1 | 0x1 | Flags Type | |
| Flags | 1 | 0x2 | Flags Value | |
| Manufacturer Specific Data | Length | 1 | Actual length | Manufacturer Specific Data Length |
| AD Type | 1 | Fixed value of 0xFF | Manufacturer Specific Data Type | |
| Company ID | 2 | Fixed value of 0x01A8 | Company Identifiers. 0x01A8 is the company code for Alibaba. | |
| VID and Subtype | 1 | 0x95 | The value is 0x95.
| |
| Payload | Variable | Actual message content | None |
Data transmission specification
- Non-connectable advertising uses standard BLE advertising. Data is transmitted in a single packet. Packet fragmentation is not supported.
- The packet payload consists of the following fields.
Field Bytes Description FMSK 1 FMSK indicates the device capabilities. ProductID 2 Issued by the platform. Each product model has a unique ID. MAC address 6 Issued by the platform. Each device has a unique address. Random 3 Random data. Data 0 to N Entity data. CRC 1 CRC for signature verification. - FMSK indicates the device capabilities. The bits are defined as follows.
Bit order Description 0 Specifies whether the broadcast is interactive. Valid values: 0 (non-interactive) and 1 (interactive). 1 to 2 Bluetooth advertising specification version. The current version is 0b00. 3 to 7 Reserved for future use. Set all to 0. - Random and Digest are used to represent the device identity.
- Random is a 3-byte field of random data. This data must be generated using a true random algorithm. For example, you can use ADC sampling values as a random seed.
- The trituple, also known as the device certificate, is pre-flashed into the device. It consists of the ProductKey, DeviceName, and DeviceSecret. To ensure security, the DeviceSecret is not transmitted over the air or to a mobile phone.
- Data is defined as
Data = ali_encrypt(DeviceSecret, Random). This is manufacturer-specific data. The `ali_encrypt` algorithm is designed for low-power Bluetooth devices and is provided by the platform.Note The `ali_encrypt` algorithm is provided by the platform. Contact business development to obtain it if needed. - Calculate
CRC=CRC16(Secret, Data)and use the low-order byte.
Data payload description
- To use a custom data format, you can configure a script in the cloud to transform the data.
- In certain scenarios, if the manufacturer-specific data is empty, you can fill it with a constant.
- The ASCII string constant "BIND" is an identifier for device binding. A device typically does not generate data immediately after it is powered on. In this case, use this constant to fill the data field.
Broadcast messaging specifications
- After a device is manually powered on, it must continuously broadcast advertising packets for 2 minutes. Because the custom data is empty at this time, fill the data field with the constant BIND.
- After the device is successfully bound and the user opens the control panel, the app must scan for the device's advertising packets in real time. (For example, Tmall Genie speakers scan continuously in real time).
- The following conventions apply to the device advertising frequency: For devices with a low reporting frequency, such as body fat scales, a single valid data payload must be broadcast continuously for 5 seconds. When the same data is broadcast in multiple packets within this 5-second period, the Random value must remain unchanged.
该文章对您有帮助吗?