ABleCharacteristic¶
The ABleCharacteristic similar to the ABleService is a mostly virtual implementation that serves as a mixin class for all of the platform specific implementations of a BLE characteristic. Each backend has their own class definition which inherits this class but note that it is the subclass that will be actually used at runtime and that this class’ role is to provide a base class for the use of those subclasses. See the backend specific implementations for more details on how each backend handles configuring GATT characteristics.
Class Definition¶
- class able.characteristic.ABleCharacteristic(characteristic_uuid, *, value=b'', flags=None, nickname=None, notify_on_write=False, **kwargs)[source]¶
The abstract base class for all of the platform specific implementations of a BLE Characteristic. This class should not be used directly, similarly to the ABleService, the characteristic that will be imported will be specific to which platform ABle is being used on.
- Parameters
characteristic_uuid (
Union[str,UUID]) – the uuid that this characteristic will have, best practice is that it is not the same as the service that will own itvalue (
bytes) – parameter to initialize the characteristic with a default value, defaults to b’0’flags (
List) – list of permissions/flags to initialize the characteristic with, defaults to read, write and notifynickname (
str) – provide a nickname to the characteristic that will show up in logs, defaults to Nonenotify_on_write (
bool) – if True, write from centrals will trigger a notification/indication to all subscribed centrals
- Variables
value (bytes) – the current value of the characteristic, setting this value on all backends will trigger an update to connected centrals.
Tip
Check out the GATT Setup on examples of how to use ABleCharacteristics.
Flags¶
The following flags can be provided during the initialization of the ABleCharacteristic class to specify the type of characteristic and permissions.
- able.characteristic.CharacteristicFlags¶
alias of
able.bluezdbus.characteristic.BlueZCharacteristicFlags