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

BlueZ: when a BLE device powers off while an application is connected, it cannot be discovered again

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.8.0 RC
    • None
    • Arch Linux 64-bit

    Description

      I've been writing an application to read data from a particular BLE bathroom scale.

      https://github.com/ec1oud/qt-ble-weightscale

      It works only the first time: start the application, then step on the scale, which takes readings and powers on the Bluetooth radio. The scale becomes discoverable, the application finds it, then it must write to one characteristic and subscribe for notifications from another. Then it will receive a notification containing the weight and body composition readings. Then a few seconds later, the scale automatically powers off, and the result is

      [    48.600 W] QBluetoothSocketPrivate::_q_readNotify - void QBluetoothSocketPrivate::_q_readNotify() 14 error: -1 "Connection timed out"
      [    48.600 D] WeightScale::setStatus - "controller error \u0001"
      [    48.600 D] WeightScale::setStatus - "disconnected"
      [    48.600 D] WeightScale::setStatus - "scanning for devices"
      

      The application will no longer discover the scale after that. It doesn't seem to make a difference whether I stop discovery after the scale is discovered, then restart it after it is disconnected. It also doesn't help to disconnect explicitly as soon as one reading is taken. But I can restart the application, and then it will work again.

      It may be that I can work around this by destroying and re-creating some object (maybe the QLowEnergyController?) instead of restarting the whole application. But I don't think it should be necessary.

      The same application works fine on macOS Sierra.

      Attachments

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

        Activity

          People

            owolff Oliver Wolff
            srutledg Shawn Rutledge
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes