Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54475

BLE: Too many notifications lead to disconnect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.7.1
    • 5.7.0
    • None
    • Raspberry Pi 3
      Arch Linux
      BlueZ 5.40

      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ablasche Alex Blasche
            max82 Max Wahler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes