Bluetooth LE non-connectable advertising specification

更新时间:
复制 MD 格式

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.

advertising

Broadcast data format

The AD Type for Alibaba-specific manufacturer data must be 0xFF. The advertising data must be stored in little-endian format.

CategoryFieldBytesValueDescription
Flagslength10x2Flags length
AD Type1 0x1Flags Type
Flags10x2Flags Value
Manufacturer Specific DataLength1Actual lengthManufacturer Specific Data Length
AD Type1Fixed value of 0xFFManufacturer Specific Data Type
Company ID2Fixed value of 0x01A8Company Identifiers. 0x01A8 is the company code for Alibaba.
VID and Subtype10x95The value is 0x95.
  • Bits 0 to 3: Alibaba Bluetooth specification version number. The current version is 5.
  • Bits 4 to 7: Subtype. The Bluetooth Beacon type is used, which is 0b1001.
PayloadVariableActual message contentNone

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.
    FieldBytesDescription
    FMSK1FMSK indicates the device capabilities.
    ProductID2Issued by the platform. Each product model has a unique ID.
    MAC address6Issued by the platform. Each device has a unique address.
    Random3Random data.
    Data0 to NEntity data.
    CRC1CRC for signature verification.
  • FMSK indicates the device capabilities. The bits are defined as follows.
    Bit orderDescription
    0Specifies whether the broadcast is interactive. Valid values: 0 (non-interactive) and 1 (interactive).
    1 to 2Bluetooth advertising specification version. The current version is 0b00.
    3 to 7Reserved 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.