The Basic Bluew API¶
This document covers the basic one-time API calls you can make with bluew.
Main Interface¶
The following 11 functions are accessible directly from bluew.
-
bluew.
connect
(mac: str, *args, **kwargs) → None[source]¶ Connect to a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
disconnect
(mac: str, *args, **kwargs) → None[source]¶ Disconnect from a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
trust
(mac: str, *args, **kwargs) → None[source]¶ Trust a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
distrust
(mac: str, *args, **kwargs) → None[source]¶ Distrust a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
pair
(mac: str, *args, **kwargs) → None[source]¶ Pair with a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
remove
(mac: str, *args, **kwargs) → None[source]¶ Remove a bluetooth device. :param mac: MAC address of bluetooth device.
-
bluew.
controllers
(*args, **kwargs) → List[bluew.controller.Controller][source]¶ Get list of available controllers.
-
bluew.
info
(mac: str, *args, **kwargs) → bluew.device.Device[source]¶ Get device info. :param mac: MAC address of bluetooth device.
Exceptions¶
-
exception
bluew.errors.
BluewError
(reason, long_reason='', name='', version='')[source]¶ For those times when the Engine blows.
-
exception
bluew.errors.
DeviceNotAvailable
(*args, **kwargs)[source]¶ This error is raised by when the bluetooth devices specified is not found.
-
exception
bluew.errors.
PairError
(*args, **kwargs)[source]¶ This error is raised when a pairing error that can’t be handled is raised.
-
exception
bluew.errors.
ReadWriteNotifyError
(*args, **kwargs)[source]¶ This error is raised when a read/write fail that can’t be handled happens.
-
exception
bluew.errors.
InvalidArgumentsError
(*args, **kwargs)[source]¶ This error is rasied when arguemnts passed are.. well.. invalid.
-
exception
bluew.errors.
NoControllerAvailable
(*args, **kwargs)[source]¶ This error is raised when no bluetooth controllers are found.
Bluew Connection¶
-
class
bluew.
Connection
(mac, *args, **kwargs)[source]¶ A Bluew Connection
Provides a persistent connection with one device.
Basic Usage:
>>> import bluew >>> mac = 'xx:xx:xx:xx:xx' >>> device = bluew.Connection(mac) >>> device.info()
-
chrcs
¶ Get available BLE characteristics of a device.
-
services
¶ Get available BLE services of a device.
-