expliot.core.protocols.radio.ble

Support for BLE.

Package Contents

Classes

Ble

A wrapper around simple BLE operations.

BleScanner

A wrapper around bluepy Scanner class.

BlePeripheral

A wrapper around bluepy Peripheral class.

BleNotifyDelegate

Delegate class for reading notification data as required by Bluepy

Attributes

DEFAULT_NOTIFY_TIMEOUT

expliot.core.protocols.radio.ble.DEFAULT_NOTIFY_TIMEOUT = 10
class expliot.core.protocols.radio.ble.Ble

A wrapper around simple BLE operations.

ADTYPE_NAME = 9
static scan(iface=0, tout=10)

Scan for BLE devices.

class expliot.core.protocols.radio.ble.BleScanner

Bases: bluepy.btle.Scanner

A wrapper around bluepy Scanner class.

class expliot.core.protocols.radio.ble.BlePeripheral

Bases: bluepy.btle.Peripheral

A wrapper around bluepy Peripheral class.

enable_notify(delegate, handle, write_response=False)

Enables notification for a specific characteristic on a Peripheral. It’s a Wrapper on Peripheral class methods for setting Delegate and writing to the characteristic(handle + 1) the value “x01" to enable the notification as per the BLE spec.

Args:

delegate (DefaultDelegate): Overriden DefaultDelegate Object handle (int): The handle of the characteristic for notification write_response (bool): True, if sending write command and False if

sending only write request (for which there is no response from the peripheral). Default is False.

class expliot.core.protocols.radio.ble.BleNotifyDelegate(callback)

Bases: bluepy.btle.DefaultDelegate

Delegate class for reading notification data as required by Bluepy

count()

Count of the no. of times handleNotification() is called.

Args:

None

Returns:

(int) Returns the count

handleNotification(cHandle, data)

Callback method as defined by Bluepy.

Args:
cHandle(integer): handle for the characteristic - this can be

used to distinguish between notifications from multiple sources on the same peripheral.

data(bytes): The characteristic data received.

Returns:

Nothing