blatann.examples.centeral_uart_service module¶
This example implements Nordic’s custom UART service and demonstrates how to configure the MTU size. It is configured to use an MTU size based on the Data Length Extensions feature of BLE for maximum throughput. This is compatible with the peripheral_uart_service example.
This is a simple example which just echos back any data that the client sends to it.
- blatann.examples.centeral_uart_service.on_connect(peer, event_args)¶
Event callback for when a central device connects to us
- Parameters
peer (blatann.peer.Client) – The peer that connected to us
event_args – None
- blatann.examples.centeral_uart_service.on_disconnect(peer, event_args)¶
Event callback for when the client disconnects from us (or when we disconnect from the client)
- Parameters
peer (blatann.peer.Client) – The peer that disconnected
event_args (blatann.event_args.DisconnectionEventArgs) – The event args
- blatann.examples.centeral_uart_service.on_mtu_size_update(peer, event_args)¶
Callback for when the peer’s MTU size has been updated/negotiated
- Parameters
peer (blatann.peer.Client) – The peer the MTU was updated on
- blatann.examples.centeral_uart_service.on_data_rx(service, data)¶
Called whenever data is received on the RX line of the Nordic UART Service
- Parameters
service (nordic_uart.service.NordicUartClient) – the service the data was received from
data (bytes) – The data that was received
- blatann.examples.centeral_uart_service.main(serial_port)¶