org.bluez.Adapter(5)

πŸ¦‹ org.bluez.Adapter(5) β€” BlueZ D-Bus Adapter API documentation πŸ¦‹

okay so bestie, welcome to the org.bluez.Adapter(5) page from the Linux System Administration corner of the manual ✨ this one is literally all about the BlueZ D-Bus Adapter API, and it’s giving very much β€œmain character adapter energy.” no cap, there are a lot of methods and properties here, so let’s get into it πŸ’…

✨ Name ✨

org.bluez.Adapter β€” BlueZ D-Bus Adapter API documentation πŸ’–

🌸 Interface 🌸

okay so the D-Bus interface setup is right here, and it’s very specific β€” do not lose the details, bestie 🫢

✨ Methods ✨

πŸŽ€ void StartDiscovery() πŸŽ€

Starts a device discovery session. This may include starting an inquiry and/or scanning procedures and remote device name resolving. It’s giving β€œgo find the devices” energy πŸ”₯

Use StopDiscovery to release the sessions acquired.

This process will start creating Device objects as new devices are discovered.

During discovery, the RSSI delta-threshold is imposed.

Each client can request a single device discovery session per adapter. periodt.

Possible errors:

  • org.bluez.Error.NotReady
  • org.bluez.Error.Failed
  • org.bluez.Error.InProgress

Examples:

bluetoothctl
       > scan <on/off/bredr/le>

πŸŽ€ void StopDiscovery() πŸŽ€

Stops the device discovery session started by StartDiscovery.

Note that a discovery procedure is shared between all discovery sessions, thus calling StopDiscovery will only release a single session, and discovery will stop when all sessions from all clients have finished. lowkey important πŸ’€

Possible errors:

  • org.bluez.Error.NotReady
  • org.bluez.Error.Failed
  • org.bluez.Error.NotAuthorized

πŸŽ€ void RemoveDevice(object device) πŸŽ€

Removes the remote device object at the given path, including cached information such as bonding information. yes, it’s deleting the whole vibe 😭

Possible errors:

  • org.bluez.Error.InvalidArguments
  • org.bluez.Error.Failed

Examples:

bluetoothctl
       > remove <dev>

πŸŽ€ void SetDiscoveryFilter(dict filter) πŸŽ€

Sets the device discovery filter for the caller. When this method is called with no filter parameter, the filter is removed.

Possible filter values:

  • array{string} UUIDs β€” Filter by service UUIDs, empty means match any UUID. When a remote device is found that advertises any UUID from UUIDs, it will be reported if:
    • Pathloss and RSSI are both empty.
    • only Pathloss param is set, device advertise TX power, and computed pathloss is less than Pathloss param.
    • only RSSI param is set, and received RSSI is higher than RSSI param.
  • int16 RSSI β€” RSSI threshold value. PropertiesChanged signals will be emitted for already existing Device objects, with updated RSSI value. If one or more discovery filters have been set, the RSSI delta-threshold, that is imposed by StartDiscovery by default, will not be applied. iykyk πŸ‘‘
  • uint16 Pathloss β€” Pathloss threshold value. PropertiesChanged signals will be emitted for already existing Device objects, with updated Pathloss value.
  • string Transport (Default "auto") β€” Transport parameter determines the type of scan. Possible values:
    • "auto" β€” Interleaved scan, use LE, BREDR, or both, depending on what's currently enabled.
    • "bredr" β€” BR/EDR inquiry only.
    • "le" β€” LE scan only.
  • bool DuplicateData (Default false) β€” Disables duplicate detection of advertisement data. When enabled, PropertiesChanged signals will be generated for either ManufacturerData and ServiceData every time they are discovered.
  • bool Discoverable (Default false) β€” Make adapter discoverable while discovering. If the adapter is already discoverable, setting this filter won't do anything.
  • string Pattern (Default none) β€” Discover devices where the pattern matches either the prefix of the address or device name, which is a convenient way to limited the number of device objects created during a discovery. When set, disregards device discoverable flags.
Note: The pattern matching is ignored if there are other client that don't set any pattern, as it work as a logical OR. Also, setting empty string "" pattern will match any device found. 🫢
  • bool AutoConnect (Default false) β€” Connect to discovered devices automatically if a Pattern has been set and it matches the device address or name and it is connectable.

When discovery filter is set, Device objects will be created as new devices with matching criteria are discovered regardless of they are connectable or discoverable, which enables listening to non-connectable and non-discoverable devices.

When multiple clients call SetDiscoveryFilter, their filters are internally merged, and notifications about new devices are sent to all clients. Therefore, each client must check that device updates actually match its filter. no cap, do the vibe check 😌

When SetDiscoveryFilter is called multiple times by the same client, last filter passed will be active for given client.

SetDiscoveryFilter can be called before StartDiscovery. It is useful when client will create first discovery session, to ensure that proper scan will be started right after call to StartDiscovery.

Possible errors:

  • org.bluez.Error.NotReady
  • org.bluez.Error.NotSupported
  • org.bluez.Error.Failed

Examples:

bluetoothctl
       [scan] > uuids [all/uuid1 uuid2 ...]

bluetoothctl
       [scan] > rssi [rssi]

bluetoothctl
       [scan] > pathloss [pathloss]

bluetoothctl
       [scan] > transport [auto/bredr/le]

bluetoothctl
       [scan] > duplicate-data [on/off]

bluetoothctl
       [scan] > discoverable [on/off]

bluetoothctl
       [scan] > pattern [value]

bluetoothctl
       [scan] > clear [filter]

πŸŽ€ array{string} GetDiscoveryFilters() πŸŽ€

Returns available filters that can be given to SetDiscoveryFilter.

Possible errors: None ✨

πŸŽ€ object ConnectDevice(dict properties) [experimental] πŸŽ€

Connects to device without need of performing General Discovery.

Connection mechanism is similar to Connect method on org.bluez.Device1(5) interface, with exception that this method returns success when physical connection is established and you can specify bearer to connect with parameter.

After this method returns, services discovery will continue and any supported profile will be connected. There is no need for calling Connect on Device1 after this call. If connection was successful, this method returns object path to created device object or device that already exist.

Possible properties values:

  • string Address (Mandatory) β€” The Bluetooth device address of the remote device.
  • string AddressType (Default "BR/EDR") β€” The Bluetooth device Address Type. This is address type that should be used for initial connection. Possible values:
    • "public" β€” Public address
    • "random" β€” Random address

Possible errors:

  • org.bluez.Error.InvalidArguments
  • org.bluez.Error.AlreadyExists
  • org.bluez.Error.NotSupported
  • org.bluez.Error.NotReady
  • org.bluez.Error.Failed

πŸ’– Properties πŸ’–

string Address [readonly]

The Bluetooth device address. simple, iconic, address-coded πŸ’…

string AddressType [readonly]

The Bluetooth Address Type. For dual-mode and BR/EDR only adapter this defaults to "public". Single mode LE adapters may have either value. With privacy enabled this contains type of Identity Address and not type of address used for connection.

Possible values:

  • "public" β€” Public address.
  • "random" β€” Random address.

string Name [readonly]

The Bluetooth system name (pretty hostname).

This property is either a static system default or controlled by an external daemon providing access to the pretty hostname configuration.

string Alias [readwrite]

The Bluetooth friendly name. This value can be changed.

In case no alias is set, it will return the system provided name. Setting an empty string as alias will convert it back to the system provided name.

When resetting the alias with an empty string, the property will default back to system name.

On a well configured system, this property never needs to be changed since it defaults to the system name and provides the pretty hostname.

Only if the local name needs to be different from the pretty hostname, this property should be used as last resort. fr fr, it’s the final boss option 😭

Examples:

bluetoothctl
       > system-alias <name>

bluetoothctl
       > reset-alias

uint32 Class [readonly]

The Bluetooth class of device.

This property represents the value that is either automatically configured by DMI/ACPI information or provided as static configuration.

boolean Connectable [readwrite]

Set an adapter to connectable or non-connectable. This is a global setting and should only be used by the settings application. πŸ‘‘

Setting this property to false will set the Discoverable property of the adapter to false as well, which will not be reverted if Connectable is set back to true.

If required, the application will need to manually set Discoverable to true.

Note: This property only affects incoming connections. yes bestie, incoming only 🫢

boolean Powered [readwrite]

Switch an adapter on or off. This will also set the appropriate connectable state of the controller.

The value of this property is not persistent. After restart or unplugging of the adapter it will reset back to false. not persistent, no cap πŸ’€

Examples:

bluetoothctl
       > power <on/off>

string PowerState [readonly, experimental]

The power state of an adapter.

The power state will show whether the adapter is turning off, or turning on, as well as being on or off.

Possible values:

  • "on" β€” Powered on.
  • "off" β€” Powered off
  • "off-enabling" β€” Transitioning from "off" to "on".
  • "on-disabling" β€” Transitioning from "on" to "off".
  • "off-blocked" β€” Blocked by rfkill.

boolean Discoverable [readwrite] (Default: false)

Switch an adapter to discoverable or non-discoverable to either make it visible or hide it. This is a global setting and should only be used by the settings application.

If the DiscoverableTimeout is set to a non-zero value then the system will set this value back to false after the timer expired.

In case the adapter is switched off, setting this value will fail.

When changing the Powered property, the new state of this property will be updated via a PropertiesChanged signal.

Examples:

bluetoothctl
       > discoverable <on/off>

boolean Pairable [readwrite] (Default: true)

Switch an adapter to pairable or non-pairable. This is a global setting and should only be used by the settings application.

Note that this property only affects incoming pairing requests.

Examples:

bluetoothctl
       > pairable <on/off>
  • uint32 PairableTimeout [readwrite] (Default: 0) β€” how long, in seconds, the adapter stays pairable before it gives up and stops being so very approachable. Set it to 0 and the timeout is off β€” it stays pairable forever, like it's never heard of boundaries πŸ’…
  • uint32 DiscoverableTimeout [readwrite] (Default: 180) β€” the same deal but for discoverable mode, in seconds. A value of 0 means no timeout at all, so it stays in discoverable/limited mode forever. Yes, forever forever. Go off, king 🫢

Examples, bestie:

bluetoothctl
       > discoverable-timeout [value]
  • boolean Discovering [readonly] β€” lowkey just a little flag telling you whether a device discovery procedure is active right now. true = we're out here scanning, false = we're chilling πŸ’€
  • array{string} UUIDs [readonly] β€” a whole list of 128-bit UUIDs representing the local services that are available. Think of it as the adapter's little rΓ©sumΓ© ✨
  • string Modalias [readonly, optional] β€” local Device ID info, in modalias format, the one the kernel and udev use. Very behind-the-scenes, very iykyk 🧚
  • array{string} Roles [readonly] β€” the list of roles this adapter can slay. Possible values are:
    • "central" β€” supports the central role.
    • "peripheral" β€” supports the peripheral role.
    • "central-peripheral" β€” supports both roles concurrently. multitasking icon behavior, honestly πŸ‘‘
  • array{string} ExperimentalFeatures [readonly, optional] β€” a list of 128-bit UUIDs representing the experimental features that are currently enabled. science girlie era πŸ§ͺπŸ’–
  • uint16 Manufacturer [readonly] β€” who made the device, as a uint16 company identifier defined by the Core Bluetooth Specification. Names, but make it numeric.
  • byte Version [readonly] β€” the Bluetooth version the device supports, as a core version code defined by the Core Bluetooth Specification. A byte's worth of "how new is u" 🌈

That's the whole adapter page, bestie β€” go forth and pair responsibly πŸŽ€

This lil rewrite comes from the BlueZ docs, dated October 2023, and it's the org.bluez.Adapter(5) page β€” original and iconic as ever. Mwah πŸ’‹

πŸ“¦ where this page comes from