Skip to content

module bluerpc.ble_conn

Global Variables

  • PAIRED_LIST_FILE

class BLEConn

Class used to manipulate connections with Bluetooth Low-Energy devices

method __init__

__init__(dev: 'BLEDevice')  None

Constructor

Args:

  • dev: the device provided in the grpc requests, must contains a non null mac address or uuid

method connect

connect()  BLEConnectResponse

Connect

Returns: a BLEConnectResponse (with the mtu if the connect operation succedeed)


method disconnect

disconnect()  StatusMessage

method disconnect_callback

disconnect_callback(client: 'BleakClient')  None

Disconnect callback

Called by bleak when a device is disconnected

Args:

  • client: the bleak client of the disconnected device

method get_device

get_device(dev: 'BLEDevice')  BLEConn

Static method to get a BLEConn instance from a device (mac address or uuid)

Args:

  • dev: the device provided in the grpc requests

Returns: a BLEConn instance


method get_devices

get_devices()  BLEDevicesResponse

List devices infos

The paired devices list is not reliable and is stored on a local file

Returns: a BLEDevicesResponse


method get_list

get_list()  BLEListServicesResponse

List Services/Characteristics/Descriptors of a ble device


method get_props

get_props()  BLEConnectionPropertiesResponse

Connection properties

Currently, getting the rssi of connected devices is not supported by bleak

Returns: BLEConnectionPropertiesResponse


method notif_callback

notif_callback(sender: 'BleakGATTCharacteristic', data: 'bytearray')

Notification callback called by bleak (registered by start_notif)

Adds a BLENotificationResponse with the provided data in the notifs queue

Args:

  • sender: the BleakGATTCharacteristic used to register the notification
  • data: the notification data

method pair

pair()  StatusMessage

Pairing

Currently not supported, waiting for this pr to be merged: https://github.com/hbldh/bleak/pull/1100

Returns: ERROR_CODE_UNSUPPORTED


method pair_code

pair_code(code: 'str')  StatusMessage

Pairing (second step)

Currently not supported, waiting for this pr to be merged: https://github.com/hbldh/bleak/pull/1100

Returns: ERROR_CODE_UNSUPPORTED


method read_characteristic

read_characteristic(service_uuid, uuid)  BLEReadResponse

method read_descriptor

read_descriptor(service_uuid, characteristic_uuid, uuid)  BLEReadResponse

classmethod set_adapter

set_adapter(adapter: 'str')

Set adapter id

Args:

  • adapter: the adapter id

classmethod set_scanner

set_scanner(sc: 'BLEScanner')

Set scanner, used to connect when a scan is also running

Args:

  • sc: the scanner instance

method subscribe

subscribe(service_uuid, uuid)  StatusMessage

method unpair

unpair()  StatusMessage

Unairing

Supported only on Linux and Windows

Returns: ERROR_CODE_OK or ERROR_CODE_UNSUPPORTED on macos


method unsubscribe

unsubscribe(service_uuid, uuid)  StatusMessage

method write_characteristic

write_characteristic(service_uuid, uuid, data, with_response)  StatusMessage

method write_descriptor

write_descriptor(service_uuid, characteristic_uuid, uuid, data)  StatusMessage

This file was automatically generated via lazydocs.