Level 10

Broadcaster

The level 10 file for creating beacons This requires BlueZ to have the experimental flag set

class bluezero.broadcaster.Beacon(adapter_addr=None)

Create a non-connectable Bluetooth instance advertising information

add_manufacturer_data(manufacturer, data)

Add manufacturer information to be used in beacon message :param manufacturer: Use numbers from Bluetooth SIG https://www.bluetooth.com/specifications/assigned-numbers/16-bit-UUIDs-for-Members :param data: Data to be sent (Limit of ??)

add_service_data(service, data)

Add service and service data to be used in beacon message :param service: Valid service UUID :param data: Data to be sent (Limit of ??)

include_tx_power(show_power=None)

Use to include TX power in advertisement. This is different to the TX power in specific beacon format (e.g. Eddystone) :param show_power: boolean value :return:

start_beacon()

Start beacon advertising

Central

Classes that represent the GATT features of a remote device.

class bluezero.central.Central(device_addr, adapter_addr=None)

Create a BLE instance taking the Central role.

add_characteristic(srv_uuid, chrc_uuid)

Specify a characteristic of interest on the remote device by using the GATT Service UUID and Characteristic UUID :param srv_uuid: 128 bit UUID :param chrc_uuid: 128 bit UUID :return:

connect(profile=None)

Initiate a connection to the remote device and load GATT database once resolved

Parameters:profile – (optional) profile to use for the connection.
connected

Indicate whether the remote device is currently connected.

disconnect()

Disconnect from the remote device.

load_gatt()

Once the remote device has been connected to and the GATT database has been resolved then it needs to be loaded. :return:

Observer

bluezero.observer.scan_eddystone(on_data=None)

Provide a callback for ‘on_data’. The callback will be run whenever an Eddystone packet is detected.

Parameters:on_data – A function to be called on Eddystone packet
Returns:None

Peripheral

Classes required to create a Bluetooth Peripheral.

Current classes include:

  • Application – Root class
  • Service – Bluetooth Service
  • Characteristic – Bluetooth Characteristic
  • Descriptor – Bluetooth Descriptor
  • Advertisement – Bluetooth Advertisement

This requires BlueZ to have the experimental flag to be enabled

bluezero.peripheral.register_ad_cb()

Advertisement registration callback.

bluezero.peripheral.register_ad_error_cb(error)

Advertisement registration error callback.

bluezero.peripheral.register_service_cb()

Service registration callback.

bluezero.peripheral.register_service_error_cb(error)

Service registration error callback.