Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
Raspberry Pi 3
Arch Linux
BlueZ 5.40
Description
Hi there,
I use a Raspberry Pi 3 as peripheral and have a characteristic which users can be notified with.
Everything works quite well but when I call
service->writeCharacteristic(characteristic, value);
too often (about 370 packets à 20 bytes in several seconds), the QLowEnergyController emits NetworkErrors, does not send any packets anymore to the central device and switches to UnconnectedState.
With activated logging, here's what I can see:
....
qt.bluetooth.bluez: sending notification/indication: "1b0300000000b95774d391746573744465760000000000"
qt.bluetooth.bluez: sending notification/indication: "1b03000000000062746c65737070000000746b6e000000"
qt.bluetooth.bluez: Cannot write L2CP packet: "1b03000000000062746c65737070000000746b6e000000" "Network Error"
qt.bluetooth.bluez: Network IO error while talking to LE device
(now the controller state changes to UnconnectedState and emits NetworkError messages)
qt.bluetooth.bluez: HCI event triggered, type: 13
This last HCI event repeats until the central device closes the connection.
From what I know, the number of packets per time depends on the connection interval and the number of packets that a device can send within a connection interval. This is confirmed by my observation that everything's fine if I wait 50ms after each packet.
The behavior I expect is either that if the stack can't keep the pace, I get an error, can wait a bit and then retry it. Though it would be better if writeCharacteristic would just block until the stack is available again.
Attachments
Issue Links
- resulted in
-
QTBUG-54837 Add signal to detect success of notification being sent by peripheral mode
- Reported