Is your enhancement proposal related to a problem? Please describe.
The UART over Bluetooth LE (NUS) currently fragments TX data in chunks of 20-bytes per Bluetooth notification. This is done since the maximum payload we can put through a single packet, assuming minimum ATT MTU size (MTU - 3). This, however, represents a throughput bottleneck and limits its usability (Simple but limited).
Describe the solution you'd like
Split data in chunks of the maximum possible payload-per-packet (min_current_mtu - 3), where the min_current_mtu is the minimum MTU of all the peers currently connected.
e.g:
chunk_size = get_max_payload_packet_size();
len = ring_buf_get_claim(dev_data->uart.tx_ringbuf, &data, chunk_size);
if (len > 0) {
err = bt_nus_inst_send(NULL, dev_data->bt.inst, data, len);
if (err) {
LOG_ERR("Failed to send data over BT: %d", err);
}
}
Describe alternatives you've considered
No additional alternatives.
Additional context
To achieve so, uart_bt.c needs to have run-time awareness of all connected peers and their MTU size at all times.
Is your enhancement proposal related to a problem? Please describe. The UART over Bluetooth LE (NUS) currently fragments TX data in chunks of 20-bytes per Bluetooth notification. This is done since the maximum payload we can put through a single packet, assuming minimum ATT MTU size (MTU - 3). This, however, represents a throughput bottleneck and limits its usability (Simple but limited).
Describe the solution you'd like Split data in chunks of the maximum possible payload-per-packet (min_current_mtu - 3), where the
min_current_mtu
is the minimum MTU of all the peers currently connected. e.g:Describe alternatives you've considered No additional alternatives.
Additional context To achieve so,
uart_bt.c
needs to have run-time awareness of all connected peers and their MTU size at all times.