blatann.event_args module

class blatann.event_args.GattOperationCompleteReason(value)

Bases: Enum

The reason why a GATT operation completed

SUCCESS = 0
QUEUE_CLEARED = 1
CLIENT_DISCONNECTED = 2
SERVER_DISCONNECTED = 3
CLIENT_UNSUBSCRIBED = 4
FAILED = 5
TIMED_OUT = 6
class blatann.event_args.EventArgs

Bases: object

Base Event Arguments class

class blatann.event_args.DisconnectionEventArgs(reason)

Bases: EventArgs

Event arguments sent when a peer disconnects

class blatann.event_args.MtuSizeUpdatedEventArgs(previous_mtu_size, current_mtu_size)

Bases: EventArgs

Event arguments for when the effective MTU size on a connection is updated

class blatann.event_args.DataLengthUpdatedEventArgs(tx_bytes, rx_bytes, tx_time_us, rx_time_us)

Bases: EventArgs

Event arguments for when the Data Length of the link layer has been changed

class blatann.event_args.PhyUpdatedEventArgs(status, phy_channel)

Bases: EventArgs

Event arguments for when the phy channel is updated

class blatann.event_args.ConnectionParametersUpdatedEventArgs(active_connection_params)

Bases: EventArgs

Event arguments for when connection parameters between peers are updated

class blatann.event_args.SecurityProcess(value)

Bases: Enum

An enumeration.

ENCRYPTION = 0
PAIRING = 1
BONDING = 1
class blatann.event_args.PairingCompleteEventArgs(status, security_level, security_process)

Bases: EventArgs

Event arguments when pairing completes, whether it failed or was successful

class blatann.event_args.SecurityLevelChangedEventArgs(security_level)

Bases: EventArgs

class blatann.event_args.PasskeyEntryEventArgs(key_type, resolve)

Bases: EventArgs

Event arguments when a passkey needs to be entered by the user

resolve(passkey=None)

Submits the passkey entered by the user to the peer

Parameters

passkey (Union[str, int, None]) – The passkey entered by the user. If the key type is passcode, should be a 6-digit string or integer. Use None or an empty string to cancel.

class blatann.event_args.PasskeyDisplayEventArgs(passkey, match_request, match_confirm_callback)

Bases: EventArgs

Event arguments when a passkey needs to be displayed to the user. If match_request is set, the user must confirm that the passkeys match on both devices then send back the confirmation

match_confirm(keys_match)

If key matching was requested, this function responds with whether or not the keys matched correctly :type keys_match: :param keys_match: True if the keys matched, False if not

class blatann.event_args.PeripheralSecurityRequestEventArgs(bond, mitm, lesc, keypress, is_bonded_device, resolver)

Bases: EventArgs

Event arguments for when a peripheral requests security to be enabled on the connection. The application must choose how to handle the request: accept, reject, or force re-pairing (if device is bonded).

class Response(value)

Bases: Enum

An enumeration.

accept = 1
reject = 2
force_repair = 3
accept()

Accepts the security request. If device is already bonded will initiate encryption, otherwise will start the pairing process

reject()

Rejects the security request

force_repair()

Accepts the security request and initiates the pairing process, even if the device is already bonded

class blatann.event_args.PairingRejectedReason(value)

Bases: Enum

Reason why pairing was rejected

non_bonded_central_request = 1
non_bonded_peripheral_request = 2
bonded_peripheral_request = 3
bonded_device_repairing = 4
user_rejected = 5
class blatann.event_args.PairingRejectedEventArgs(reason)

Bases: EventArgs

Event arguments for when a pairing request was rejected locally

class blatann.event_args.WriteEventArgs(value)

Bases: EventArgs

Event arguments for when a client has written to a characteristic on the local database

class blatann.event_args.DecodedWriteEventArgs(value, raw_value)

Bases: EventArgs, Generic[TDecodedValue]

Event arguments for when a client has written to a characteristic on the local database and the value has been decoded into a data type

class blatann.event_args.SubscriptionStateChangeEventArgs(subscription_state)

Bases: EventArgs

Event arguments for when a client’s subscription state has changed

class blatann.event_args.NotificationCompleteEventArgs(notification_id, data, reason)

Bases: EventArgs

Event arguments for when a notification has been sent to the client from the notification queue

Reason

alias of GattOperationCompleteReason

class blatann.event_args.ReadCompleteEventArgs(read_id, value, status, reason)

Bases: EventArgs

Event arguments for when a read has completed of a peripheral’s characteristic

class blatann.event_args.WriteCompleteEventArgs(write_id, value, status, reason)

Bases: EventArgs

Event arguments for when a write has completed on a peripheral’s characteristic

class blatann.event_args.SubscriptionWriteCompleteEventArgs(write_id, value, status, reason)

Bases: EventArgs

Event arguments for when changing the subscription state of a characteristic completes

class blatann.event_args.NotificationReceivedEventArgs(value, is_indication)

Bases: EventArgs

Event Arguments for when a notification or indication is received from the peripheral

class blatann.event_args.DatabaseDiscoveryCompleteEventArgs(status)

Bases: EventArgs

Event Arguments for when database discovery completes

class blatann.event_args.DecodedReadCompleteEventArgs(read_id, value, status, reason, decoded_stream=None)

Bases: ReadCompleteEventArgs, Generic[TDecodedValue]

Event Arguments for when a read on a peripheral’s characteristic completes and the data stream returned is decoded. If unable to decode the value, the bytes read are still returned

static from_notification_complete_event_args(noti_complete_event_args, decoded_stream=None)
static from_read_complete_event_args(read_complete_event_args, decoded_stream=None)