Shared

Tools

Utility functions for python-bluezero.

bluezero.tools.bytes_to_xyz(bytes)

Split 6 byte long in integers representing x, y & z :param bytes: :return:

bluezero.tools.int_to_uint16(value_in)

Convert integer to Unsigned 16 bit little endian integer :param value_in: Integer < 65535 (0xFFFF) :return:

bluezero.tools.int_to_uint32(value_in)

Convert integer to unsigned 32-bit (little endian) :param value_in: :return:

bluezero.tools.sint16_to_int(bytes)

Convert a signed 16-bit integer to integer :param bytes: :return:

bluezero.tools.url_to_advert(url, frame_type, tx_power)

Encode as specified https://github.com/google/eddystone/blob/master/eddystone-url/README.md :param url: :return:

Constants

Global constants file for the python-bluezero project.

This file is a single location for the different object paths that are used as constants around the python-bluezero library.

Example:
from bluezero import constants
my_function(constants.CONST_1, constants.CONST_2)
bluezero.constants.ADAPTER_INTERFACE = 'org.bluez.Adapter1'

BlueZ DBus adapter interface

bluezero.constants.BLUEZ_SERVICE_NAME = 'org.bluez'

BlueZ DBus Service Name

bluezero.constants.DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'

The DBus Object Manager interface

bluezero.constants.DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties'

DBus Properties interface

bluezero.constants.DEVICE_INTERFACE = 'org.bluez.Device1'

BlueZ DBus device Interface

bluezero.constants.GATT_CHRC_IFACE = 'org.bluez.GattCharacteristic1'

BlueZ DBus GATT Characteristic Interface

bluezero.constants.GATT_DESC_IFACE = 'org.bluez.GattDescriptor1'

BlueZ DBus GATT Descriptor Interface

bluezero.constants.GATT_MANAGER_IFACE = 'org.bluez.GattManager1'

BlueZ DBus GATT manager Interface

bluezero.constants.GATT_PROFILE_IFACE = 'org.bluez.GattProfile1'

BlueZ DBus GATT Profile Interface

bluezero.constants.GATT_SERVICE_IFACE = 'org.bluez.GattService1'

BlueZ DBus GATT Service Interface

bluezero.constants.LE_ADVERTISEMENT_IFACE = 'org.bluez.LEAdvertisement1'

BlueZ DBus Advertisement Interface

bluezero.constants.LE_ADVERTISING_MANAGER_IFACE = 'org.bluez.LEAdvertisingManager1'

BlueZ DBus Advertising Manager Interface

DBus Tools

Utility functions for DBus use within Bluezero.

bluezero.dbus_tools.bluez_experimental_mode()

Return True if the BlueZ daemon service is in experimental mode :return: True if experimental enabled

bluezero.dbus_tools.bluez_version()

get the version of the BlueZ daemon being used on the system :return: String of BlueZ version

bluezero.dbus_tools.get_dbus_iface(iface, dbus_obj)

Return the DBus interface object for given interface and DBus object :param iface: :param dbus_obj: :return:

bluezero.dbus_tools.get_dbus_obj(dbus_path)

Get the the DBus object for the given path :param dbus_path: :return:

bluezero.dbus_tools.get_dbus_path(adapter=None, device=None, service=None, characteristic=None, descriptor=None)

Return a DBus path for the given properties :param adapter: Adapter address :param device: Device address :param service: GATT Service UUID :param characteristic: GATT Characteristic UUID :param descriptor: GATT Descriptor UUID :return: DBus path

bluezero.dbus_tools.get_iface(adapter=None, device=None, service=None, characteristic=None, descriptor=None)

For the given list of properties return the deepest interface :param adapter: Adapter address :param device: Device address :param service: GATT Service UUID :param characteristic: GATT Characteristic UUID :param descriptor: GATT Descriptor UUID :return: DBus Interface

bluezero.dbus_tools.get_managed_objects()

Return the objects currently managed by the DBus Object Manager.

bluezero.dbus_tools.get_methods(adapter=None, device=None, service=None, characteristic=None, descriptor=None)

Get methods available for the specified :param adapter: Adapter Address :param device: Device Address :param service: GATT Service UUID :param characteristic: GATT Characteristic UUID :param descriptor: GATT Descriptor UUID :return: Object of the DBus methods available

bluezero.dbus_tools.get_profile_path(adapter, device, profile)

Return a DBus path for the given properties :param adapter: Adapter address :param device: Device address :param profile: :return:

bluezero.dbus_tools.get_props(adapter=None, device=None, service=None, characteristic=None, descriptor=None)

Get properties for the specified object :param adapter: Adapter Address :param device: Device Address :param service: GATT Service UUID :param characteristic: GATT Characteristic UUID :param descriptor: GATT Descriptor UUID :return: Object of the DBus properties available

bluezero.dbus_tools.interfaces_added(path, interfaces)

Callback for when an interface is added :param path: :param interfaces: :return:

bluezero.dbus_tools.properties_changed(interface, changed, invalidated, path)

Callback for when properties are changed :param interface: :param changed: :param invalidated: :param path: :return:

Async Tools