BLE Advertising Overview
A BLE peripheral device can advertise to allow detection and connection by BLE central devices.
Advertising is governed by the Bluetooth GAP (Generic Access Profile) specification. Peripheral devices advertise to a Central device. Typically Peripheral devices have limited resources and use low power, while Central devices are more powerful and provide an interface for human interaction.
For GAP documentation, see https://www.bluetooth.org:
- Bluetooth Core Standard version 4, Vol 3, Part C, particularly sections 8 and 11
- Core Specification Supplement, Part A
- Bluetooth Company Identifiers
The Bluetooth GAP specification limits advertising data to two packets:
- Advertising Data payload
- Scan Response payload
For details of the format see BLE Advertising Data Format below.
BLE Advertising with BGX
The BGX supports:
- advertising in high or low mode. See adv.
- advertising service ID and name
- turning off advertising. See adv.
By default, a BGX device advertises the BGX Streaming Service ID and the default module name. See UUID and Name for details.
Advertising Commands and Variables
Commands supporting BLE advertising are:
- adv - advertise in high mode or low mode, or turn advertising off
Variables supporting BLE advertising are:
Advertising mode and settings:
- sy d n --- device name
BLE Advertising Data Format
The peripheral device transmits an advertising packet 31 octets in length. The central device scans and receives the advertising packet. The central can then request additional information. In response the peripheral sends a scan response packet, 31 octets in length.
The advertising packet and the scan response packet have the same general format.
The BLE advertising packet and scan response packet both consist of one or more structures of the form:
|1 octet||1 octet||Length - 1 octets|
Length specifies the length of the data, not including the
The data consists of an octet specifying the data type, followed by the data
Length = Content_length + Type_length = Content_length + 1
Unused octets are set to
The diagram below shows the general structure of the advertising packet and the scan response packet.
Source: Bluetooth Core standard v4, Vol 3, Part C - Generic Access Profile, Section 11, Advertising and Scan Response Data Format
BLE Advertising Format Examples
In the example tables, the top row shows the octets in the advertising packet or scan response packet, with data in hexadecimal notation. The Least Significant Byte (LSB) is on the left. Unless otherwise noted, data is sent in little-endian order. Some proprietary formats package the data in big-endian order.
The bottom line shows the interpretation, with numbers in decimal notation. Configurable parts of the advertising packet are emphasized.
UUID and Name
This is the default advertising mode for a BGX device, and the only advertising mode currently supported.
|Length: 2||Type: Flags||Flags||Length: 17||Type: UUID||UUID: 16 octets||Length: 9||Type: Name||Name: 8 octets|
UUID and name are determined as follows:
|None||BGX Streaming Service ID|
- see Xpress Streaming Service
|name||sy d n||BGX-####||#### stands for the last 4 digits of the BD_ADDR|
- see bl a. Example:
Note: According to the BLE specification, the Service UUID appears in the advertising response as a hex number in little-endian order, with LSB first.
In the advertising packet, LSB at left:
The name is a string of ASCII character codes, and appears in the advertisement
in the same order as the string. For example, the name BGX-F603 appears as
The entire advertisement, using the BGX Streaming Service ID and example name above, with LSB at left, appears as:
Note: The maximum length of the name field in the BGX advertising packet is 8 characters. If the name of an advertising BGX (sy d n) exceeds 8 characters in length, it will be shortened in the advertising packet to its first 8 characters.
For example, the name:
will appear in the advertising packet as: