Datasheet
WARNING: This command will override the normal advertising payload and may prevent some services from acting as expected.
To restore the advertising data to the normal default values use the AT+FACTORYRESET command.
For example, to insert the 'Flags' Data Type (Data Type Value 0x01), and set the value to 0x06/0b00000110 (BR/EDR Not Supported and LE
General Discoverable Mode) we would use the following byte array:
02-01-06
0x02 indicates the number of bytes in the entry
0x01 is the 'Data Type Value (http://adafru.it/cYs)' and indicates that this is a 'Flag'
0x06 (0b00000110) is the Flag value, and asserts the following fields (see Core Specification 4.0, Volume 3, Part C, 18.1):
LE General Discoverable Mode (i.e. anyone can discover this device)
BR/EDR Not Supported (i.e. this is a Bluetooth Low Energy only device)
If we also want to include two 16-bit service UUIDs in the advertising data (so that listening devices know that we support these services) we could
append the following data to the byte array:
05-02-0D-18-0A-18
0x05 indicates that the number of bytes in the entry (5)
0x02 is the 'Data Type Value (http://adafru.it/cYs)' and indicates that this is an 'Incomplete List of 16-bit Service Class UUIDs'
0x0D 0x18 is the first 16-bit UUID (which translates to 0x180D, corresponding to the Heart Rate Service (http://adafru.it/ddB)).
0x0A 0x18 is another 16-bit UUID (which translates to 0x180A, corresponding to the Device Information Service (http://adafru.it/ecj)).
Including the service UUIDs is important since some mobile applications will only work with devices that advertise a specific service UUID in the
advertising packet. This is true for most apps from Nordic Semiconductors, for example.
Codebase Revision: 0.3.0
Parameters: The raw byte array that should be inserted into the advertising data section of the advertising packet, being careful to stay within the
space limits defined by the Bluetooth Core Specification.
Response: None
# Advertise as Discoverable and BLE only with 16-bit UUIDs 0x180D and 0x180A
AT+GAPSETADVDATA=02-01-06-05-02-0d-18-0a-18
OK
The results of this command can be seen in the screenshot below, taken from a sniffer analyzing the advertising packets in Wireshark. The
advertising data payload is higlighted in blue in the raw byte array at the bottom of the image, and the packet analysis is in the upper section:
© Adafruit Industries
https://learn.adafruit.com/introducing-the-adafruit-bluefruit-le-uart-
friend
Page 87 of 115