blatann.examples.central module

This example demonstrates implementing a central BLE connection in a procedural manner. Each bluetooth operation performed is done sequentially in a linear fashion, and the main context blocks until each operation completes before moving on to the rest of the program

This is designed to work alongside the peripheral example running on a separate nordic chip

blatann.examples.central.on_counting_char_notification(characteristic, event_args)

Callback for when a notification is received from the peripheral’s counting characteristic. The peripheral will periodically notify a monotonically increasing, 4-byte integer. This callback unpacks the value and logs it out

Parameters
blatann.examples.central.on_passkey_entry(peer, passkey_event_args)

Callback for when the user is requested to enter a passkey to resume the pairing process. Requests the user to enter the passkey and resolves the event with the passkey entered

Parameters
blatann.examples.central.on_peripheral_security_request(peer, event_args)

Handler for peripheral-initiated security requests. This is useful in the case that the application wants to override the default response to peripheral-initiated security requests based on parameters, the peer, etc.

For example, to reject new pairing requests but allow already-bonded devices to enable encryption, one could use the event_args.is_bonded_device flag to accept or reject the request.

This handler is optional. If not provided the SecurityParameters.reject_pairing_requests parameter will determine the action to take.

Parameters
blatann.examples.central.main(serial_port)