bluez_peripheral.adapter module¶
- class bluez_peripheral.adapter.Adapter(proxy)[source]¶
Bases:
objectA bluetooth adapter. Represents an org.bluez.Adapter1 instance.
- Parameters:
proxy (ProxyObject)
- async discover_devices(duration=10.0)[source]¶
Asynchronously search for other bluetooth devices.
- Parameters:
duration (float) – The number of seconds to perform the discovery scan. Defaults to 10.0 seconds.
- Return type:
- get_adapter_interface()[source]¶
Returns the org.bluez.Adapter associated with this adapter.
- Return type:
- get_advertising_manager()[source]¶
Returns the org.bluez.LEAdvertisingManager1 interface associated with this adapter.
- Return type:
- async classmethod get_all(bus)[source]¶
Get a list of available Bluetooth adapters.
- Parameters:
bus (MessageBus) – The message bus used to query bluez.
- Returns:
A list of available bluetooth adapters.
- Return type:
- async get_discovering()[source]¶
Returns true if the adapter is discovering. False otherwise.
- Return type:
- async classmethod get_first(bus)[source]¶
Gets the first adapter listed by bluez.
- Parameters:
bus (MessageBus) – The bus to use for adapter discovery.
- Raises:
ValueError – Raised when no bluetooth adapters are available.
- Returns:
The resulting adapter.
- Return type:
- get_gatt_manager()[source]¶
Returns the org.bluez.GattManager1 interface associated with this adapter.
- Return type:
- async get_supported_advertising_includes()[source]¶
Returns a flag set of the advertising includes supported by this adapter.
- Return type:
- async set_alias(val)[source]¶
Set the user friendly name for this device. Changing the device hostname directly is preferred. Writing an empty string will result in the alias resetting to the device hostname.
- Parameters:
val (str)
- Return type:
None
- async set_discoverable(val)[source]¶
Switch an adapter to discoverable or non-discoverable to either make it visible or hide it.
- Parameters:
val (bool)
- Return type:
None
- async set_discoverable_timeout(val)[source]¶
Set the discoverable timeout in seconds. A value of zero means that the timeout is disabled and it will stay in discoverable mode forever.
- Parameters:
val (int)
- Return type:
None
- async set_pairable(val)[source]¶
Switch an adapter to pairable or non-pairable.
- Parameters:
val (bool)
- Return type:
None
- async set_pairable_timeout(val)[source]¶
Set the pairable timeout in seconds. A value of zero means that the timeout is disabled and it will stay in pairable mode forever.
- Parameters:
val (int)
- Return type:
None
- class bluez_peripheral.adapter.Device(proxy)[source]¶
Bases:
objectA bluetooth device discovered by an adapter. Represents an org.bluez.Device1 instance.
- Parameters:
proxy (ProxyObject)
- async get_name()[source]¶
Returns the display name of this device (use alias instead to get the display name).
- Return type:
- async get_paired()[source]¶
Returns true if the parent adapter is paired with this device. False otherwise.
- Return type: