5.3.2.2 Set Advertisement Data (IA/IS/NA/NS)

Format:

IA,<hex8>,<Hex>

IS,<hex8>,<Hex>

NA,<hex8>,<Hex>

NS,<hex8>,<Hex>

Commands IA, IS and NA, NS set the legacy advertisement payload and scan the response payload format, respectively. The second letter in the commands indicates the type of information to be changed. The letter A indicates changes to advertisement and letter S for scan response. The legacy advertisement is considered the first advertisement set in the A command. Thus, using this set advertisement data command means it is possible to set advertisement data of the first advertisement mentioned in A command.

All advertisement and scan responses are composed of one or more Advertisement (AD) structures. Each AD structure has one byte of length, one byte of AD type (see the following table) and AD data. The set of commands either appends an AD structure or removes all AD structures, depending on the first parameter. The total bytes in the advertisement payload contributed by one or more AD structures, which includes the one byte of length, one byte of AD type and AD data, must be less than or equal to 31 bytes.

Commands starting with letter I make the changes immediately effective without a reboot. The changes are saved into PDS only if other procedures require permanent configuration changes. This command is suitable to broadcast dynamic data in the AD structure. On the other hand, commands starting with letter N make permanent changes saved into PDS. They also make the changes immediately effective without a reboot.

The first parameter is the AD type. Bluetooth Special Interest Group (SIG) defines AD types in the assigned number list. If the AD type is set to letter Z, all AD structures are cleared. The following table lists the commonly used AD types. For more details on the assigned number list, refer to the Bluetooth Core Specification.

The second parameter is the AD data. AD data have various lengths and follow the format defined in the Bluetooth SIG supplement to the Bluetooth Core Specification.

The user can issue the command in sequence to append one or more AD structures, but the user needs to ensure that the total advertisement payload is less than or equal to 31 bytes. If the total advertisement payload is larger than 31 bytes, the command response is Err.

Table 5-6. List of AD Types

AD Type (HEX)

Description

01

Flags

02

Incomplete list of 16-bit UUIDs

03

Complete list of 16-bit UUIDs

04

Incomplete list of 32-bit UUIDs

05

Complete list of 32-bit UUIDs

06

Incomplete list of 128-bit UUIDs

07

Complete list of 128-bit UUIDs

08

Shortened local name

09

Complete local name

0A

TX power level

0D

Class of device

0E

Simple pairing hash

0F

Simple pairing randomizer

10

TK value

11

Security OOB flag

12

Slave connection interval range

14

List of 16-bit service UUIDs

15

List of 128-bit service UUIDs

16

Service data

FF

Manufacture specific data

Example:IA,Z// Reconnect to the second stored device
IA,01,05// Adds an AD Structure with Flag AD type
IA,09,313233// Appends an AD Structure with Name AD type. ASCII data of “123” is used for AD data for local name. Issuing another command in sequence appends another AD Structure.
Response:AOK// Success
Err// Syntax error or invalid parameter
Note: It is recommended to include the Flags AD data type in the advertisement data for connection-oriented applications. This ensures the Android devices connect as expected. The PDS stores the parameters of NA and NS commands. The parameters are effective immediately after restarting the advertising and scan without a reboot.