blatann.gatt package

blatann.gatt.logger = <Logger blatann.gatt (INFO)>

The default MTU size that’s used when a connection is established

blatann.gatt.MTU_SIZE_DEFAULT = 23

The minimum allowed MTU size

blatann.gatt.MTU_SIZE_MINIMUM = 23

The ideal MTU size to use when using the maximum link-layer Data Length Extension setting (251)

blatann.gatt.DLE_OVERHEAD = 4

Status codes that can be returned during GATT Operations (reads, writes, etc.)

blatann.gatt.GattStatusCode

The two notification types (notification, indication) used when a characteristic is notified from a peripheral

class blatann.gatt.ServiceType(value)

Bases: IntEnum

An enumeration.

PRIMARY = 1
SECONDARY = 2
class blatann.gatt.SubscriptionState(value)

Bases: IntEnum

Defines the different subscription states/types for a characteristic

NOT_SUBSCRIBED = 0
NOTIFY = 1
INDICATION = 2
classmethod to_buffer(value)

Converts to a little-endian uint16 buffer to be written over BLE

classmethod from_buffer(buf)

Converts from a little-endian uint16 buffer received over BLE to the subscription state

class blatann.gatt.CharacteristicProperties(read=True, write=False, notify=False, indicate=False, broadcast=False, write_no_response=False, signed_write=False)

Bases: object

class blatann.gatt.Attribute(uuid, handle, value=b'', string_encoding='utf8')

Bases: object

Represents a single attribute which lives inside a Characteristic (both remote and local)

property uuid: Uuid

The attribute’s UUID

property handle: int

The attribute’s handle

property value: bytes

Gets the current value of the attribute

property string_encoding: str

The default method for encoding strings into bytes when a string is provided as a value

class blatann.gatt.Characteristic(ble_device, peer, uuid, properties, attributes=None, default_string_encoding='utf8')

Bases: object

Abstract class that represents a BLE characteristic (both remote and local).

class blatann.gatt.Service(ble_device, peer, uuid, service_type, start_handle=0, end_handle=0)

Bases: object

Abstract class that represents a BLE Service (both remote and local)

class blatann.gatt.GattDatabase(ble_device, peer)

Bases: object

Abstract class that represents a BLE Database (both remote and local)

class blatann.gatt.PresentationFormat(fmt, exponent, unit, namespace=0, description=0)

Bases: BleCompoundDataType

data_stream_types = [<class 'blatann.services.ble_data_types.Uint8'>, <class 'blatann.services.ble_data_types.Int8'>, <class 'blatann.services.ble_data_types.Uint16'>, <class 'blatann.services.ble_data_types.Uint8'>, <class 'blatann.services.ble_data_types.Uint16'>]
encode()
Return type

BleDataStream

classmethod decode(stream)
Returns

The values decoded from the stream

Return type

tuple

static try_get_enum(value, enum_type)

Submodules