Scroll to navigation

bluetoothctl-advertise(1) Linux System Administration bluetoothctl-advertise(1)

Name

bluetoothctl-advertise - Advertise Submenu

SYNOPSIS

bluetoothctl [--options] [advertise.commands]

This submenu configures LE advertising data and parameters using the org.bluez.LEAdvertisement(5) and org.bluez.LEAdvertisingManager(5) interfaces.

Advertise Options Commands

uuids

Set/Get advertise uuids.

> uuids [uuid1 uuid2 ...]
org.bluez.LEAdvertisement(5) property ServiceUUIDs
[uuid1 uuid2 ...]
List of UUIDs to advertise (default: none)
> uuids

> uuids 0x1234

> uuids 0x12345678

> uuids 90f95193-35de-4306-a6e9-699328f15059

> uuids 0x180F 0x1801

> uuids 0x180A 0x180F 0x1812

> uuids 0x1800

> uuids 0x181A

> uuids 0x183B

> uuids 0x180F 12345678-1234-5678-9abc-123456789abc


solicit

Set/Get advertise solicit uuids.

> solicit [uuid1 uuid2 ...]
org.bluez.LEAdvertisement(5) property SolicitUUIDs
[uuid1 uuid2 ...]
List of UUIDs to advertise (default: none)
> solicit

> solicit 0x1800

> solicit 0x180A

> solicit 0x181C

> solicit 0x180F 0x1801

> solicit 0x180A 0x181A 0x183B


service

Set/Get advertise service data.

> service [uuid] [data=xx xx ...]
org.bluez.LEAdvertisement(5) property ServiceData
[uuid]
Service UUID
[data=xx xx ...]
Service data
> service

> service 0x180F 64

> service 0x180F 32

> service 0x180F 00

> service 0x181A 20 15 C8 07

> service 0x180A 01 02 03 04

> service 12345678-1234-5678-9abc-123456789abc FF EE DD CC


manufacturer

Set/Get advertise manufacturer data.

Updating is in real time while advertising. This is currently limited to 25 bytes and will return an error message of "Too much data" if that maximum has been exceeded. However, this does not check if the advertising payload length maximum has been exceeded so you may receive an error from bluetoothd that it "Failed to register advertisement" which means you need to reduce your manufacturer data length.

> manufacturer [id] [data=xx xx ...]
org.bluez.LEAdvertisement(5) property ManufacturerData
[id]
Manufacturer ID (default: 0x004C for Apple Inc.)
[data=xx xx ...]
Manufacturer data
> manufacturer

> manufacturer 0x004C 01 02 03 04

> manufacturer 0x004C FF FE FD FC FB FA F9 F8

> manufacturer 0x0006 10 11 12 13

> manufacturer 0x0075 AA BB CC DD EE

> manufacturer 0x00E0 01 23 45 67 89 AB CD EF

> manufacturer 0xFFFF DE AD BE EF


data

Set/Get advertise data.

This allows you to advertise data with a given type. You cannot use a registered data type value {1} with this command. For LE the advertising shows up in the primary advertisements.

If you set only the type of the data without any data (data 0x0c) this will cause a parse error when turning advertise on.

You can modify the advertising data while it is advertising.

To get the currently set data use the command data without any arguments.

> data [type] [data=xx xx ...]
org.bluez.LEAdvertisement(5) property Data
[type]
Advertising data type
[data=xx xx ...]
Advertising data (default: none)
> data

> data 0x0C 01 0x0F 13

> data 0x09 48 65 6C 6C 6F

> data 0x08 54 65 73 74

> data 0x01 06

> data 0x19 41 03

> data 0x0A 04

> data 0x0A FC

> data 0x24 17 2F 2F 67 6F 6F 67 6C 65 2E 63 6F 6D

> data 0x16 0F 18 64


sr-uuids

Set/Get scan response uuids.

> sr-uuids [uuid1 uuid2 ...]
[uuid1 uuid2 ...]
List of UUIDs to advertise in scan response
> sr-uuids

> sr-uuids 0x1800

> sr-uuids 0x180A 0x180F

> sr-uuids 12345678-1234-5678-9abc-123456789abc


sr-solicit

Set/Get scan response solicit uuids.

> sr-solicit [uuid1 uuid2 ...]
[uuid1 uuid2 ...]
List of UUIDs to advertise in scan response
> sr-solicit

> sr-solicit 0x1801

> sr-solicit 0x180A 0x181A


sr-service

Set/Get scan response service data.

> sr-service [uuid] [data=xx xx ...]
[uuid]
Service UUID
[data=xx xx ...]
Service data
> sr-service

> sr-service 0x180F 80

> sr-service 0x181A 22 18 C0 05

> sr-service 0x180A 48 65 6C 6C 6F


sr-manufacturer

Set/Get scan response manufacturer data.

> sr-manufacturer [id] [data=xx xx ...]
[id]
Manufacturer ID (default: 0x004C for Apple Inc.)
[data=xx xx ...]
Manufacturer data
> sr-manufacturer

> sr-manufacturer 0x004C 05 06 07 08

> sr-manufacturer 0x0006 20 21 22 23

> sr-manufacturer 0xFFFF CA FE BA BE


sr-data

Set/Get scan response data.

> sr-data [type] [data=xx xx ...]
[type]
Scan Response data type
[data=xx xx ...]
Scan Response data
> sr-data

> sr-data 0x09 53 63 61 6E 52 65 73 70

> sr-data 0x0A 08

> sr-data 0x16 0F 18 32


discoverable

Set/Get advertise discoverable.

For LE discoverable on will set the LE General Discoverable Mode flag to true in the primary advertisement if on.

This feature can be changed during advertising, but will only trigger LE General Discoverable Mode even if you had previously selected discoverable-timeout this will be ignored.

Entering the command by itself will show the status of the setting

> discoverable [on/off]
org.bluez.LEAdvertisement(5) property Discoverable
[on/off]
Enable/Disable LE General Discoverable Mode
> discoverable

> discoverable on

> discoverable off


discoverable-timeout

Set/Get advertise discoverable timeout.

Using this feature in LE will cause the LE Limited Discoverable Mode flag to be set in the primary advertisement and The LE General Discoverable Mode flag will not be set.

The LE Limited Discoverable Mode flag will automatically turn off after [seconds] discoverable [on] must be set to use this feature.

Entering the command by itself will show the current value set.

> discoverable-timeout [seconds]
org.bluez.LEAdvertisement(5) property DiscoverableTimeout
[seconds]
Timeout duration in seconds for LE Limited Discoverable Mode
> discoverable-timeout

> discoverable-timeout 30

> discoverable-timeout 120

> discoverable-timeout 300

> discoverable-timeout 0


tx-power

Show/Enable/Disable TX power to be advertised.

This sets the TX Power Level field in the advertising packet.

The value is in dBm and can be between -127 and 127.

When this feature is turned on the LE device will advertise its transmit power in the primary advertisement.

This feature can be modified while advertising.

Entering the command by itself will show the current value set.

> tx-power [on/off]
org.bluez.LEAdvertisement(5) property Includes
[on/off]
Enable or disable TX power advertisement (optional, shows current if omitted)
> tx-power

> tx-power on

> tx-power off


name

Configure local name to be advertised.

Local name to be used in the advertising report.

If the string is too big to fit into the packet it will be truncated.

It will either advertise as a complete local name or if it has to be truncated then a shortened local name.

> name [on/off/name]
org.bluez.LEAdvertisement(5) property LocalName
[name]
Local name (optional, shows current if omitted)
> name

> name on

> name off

> name "My Device"

> name "Smart Sensor"

> name "BLE-Peripheral-001"

> name "0123456789abcdef0123456789abcdef"

> name "This is a very long device name that will be truncated"

> name "Device™"

> name "Tëst-Dëvicë"


appearance

Configure custom appearance to be advertised.


duration

Set/Get advertise duration.

The Duration parameter configures the length of an Instance.

The value is in seconds.

A value of 0 indicates a default value is chosen for the Duration.

The default is 2 seconds.

If only one advertising Instance has been added, then the Duration value will be ignored.

If multiple advertising Instances have been added, then the Duration value will be used to determine the length of time each Instance is advertised for.

The Duration value is used to calculate the number of advertising events that will be used to advertise each Instance.

The number of advertising events is calculated by dividing the Duration value by the advertising interval.

The advertising interval is determined by the advertising parameters that are set for each Instance. The advertising interval is the maximum of the advertising intervals set for each Instance.

> duration [seconds]
org.bluez.LEAdvertisement(5) property Duration
[seconds]
Duration in seconds (optional, shows current if omitted)
> duration

> duration 0

> duration 1

> duration 5

> duration 10

> duration 30

> duration 60

> duration 300


timeout

Set/Get advertise timeout.

> timeout [seconds]
org.bluez.LEAdvertisement(5) property Timeout
[seconds]
Timeout in seconds (optional, shows current if omitted)
> timeout

> timeout 0

> timeout 30

> timeout 120

> timeout 3600


secondary

Set/Get advertise secondary channel.

> secondary [1M/2M/Coded]
org.bluez.LEAdvertisement(5) property SecondaryChannel
[1M/2M/Coded]
Secondary channel (optional, shows current if omitted)
> secondary

> secondary 1M

> secondary 2M

> secondary Coded


rsi

Show/Enable/Disable RSI to be advertised.

RSI (Resolvable Set Identifier) is used to advertise a resolvable identifier for Coordinated Set Identification.

> rsi [on/off]
[on/off]
Enable or disable RSI advertisement (optional, shows current if omitted)
> rsi

> rsi on

> rsi off


interval

Set/Get advertise interval.

The Interval parameter configures the advertising interval of an Instance.

The value is in milliseconds.

A value of 0 indicates a default value is chosen for the Interval.

The default is 100 milliseconds.

The Interval value is used to calculate the number of advertising events that will be used to advertise each Instance.

The number of advertising events is calculated by dividing the Duration value by the advertising interval.

The advertising interval is determined by the advertising parameters that are set for each Instance.

The advertising interval is the maximum of the advertising intervals set for each Instance.

> interval [min] [max]
[min]
Minimum advertising interval in milliseconds (optional, shows current if omitted)
[max]
Maximum advertising interval in milliseconds (optional, defaults to min value)
> interval

> interval 20

> interval 50 100

> interval 100

> interval 200

> interval 500

> interval 1000

> interval 10240


clear

Clear advertise config.

This will stop advertising if it is currently advertising.

If you want to change the advertise configuration while advertising you must first clear the advertise configuration and then set the new advertise configuration.

> clear [uuids/service/manufacturer/config-name...]
[uuids/service/manufacturer/config-name...]
List of configuration to clear
> clear

> clear uuids

> clear service

> clear manufacturer

> clear name

> clear appearance

> clear tx-power

> clear uuids service

> clear manufacturer name

> clear uuids service manufacturer

> clear discoverable tx-power


RESOURCES

<http://www.bluez.org>

REPORTING BUGS

<linux-bluetooth@vger.kernel.org>

Copyright

Free use of this software is granted under the terms of the GNU Lesser General Public Licenses (LGPL).

November 2022 BlueZ