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

Warn user that too large data can make QLowEnergyAdvertisingData::setManufacturerData fail in error

    XMLWordPrintable

Details

    • Linux/X11, Linux/Yocto
    • 6b011b61f (dev), 2803507ee (6.9), 1a93b93bf (6.8), 3d68c2d05 (tqtc/lts-6.5)
    • Foundation Sprint 125

    Description

      It is currently only observed on Boot2Qt device Raspberry Pi 4. I don't have other Boot2Qt devices that have Bluetooth. Also, it is not reproducible on desktop Linux. It IS also a problem on desktop Linux. See the update: I made a mistake that I use default UUIDs on RPi4 but default UUIDs on desktop. Custom UUID is 16-byte long but default one is 2 byte. So I can't say if it is a RPi4 HW issue, or a more generic issue of Boot2Qt. I can now safely say that the size problem is generic.

      But anyway, add this line to Bluetooth Low Energy Heart Rate Server example (https://doc.qt.io/qt-6/qtbluetooth-heartrate-server-example.html):

      advertisingData.setManufacturerData(0x0000, "test");
      

      and deploy it to RPi4 (I don't know if other Boot2Qt devices will reproduce the issue or not). The example immediately shuts itself down due to

      qt.bluetooth.bluez: Advertisement registration failed QDBusError("org.bluez.Error.Failed", "Failed to register advertisement")
      qt.bluetooth.bluez: An advertising error occurred
      

      But if you instead change the manufacturer data a little, like:

      advertisingData.setManufacturerData(0x0000, "aaa");
      

      Just reduce the string length from 4 to 3 and error is gone. Although 4 letters are not that large as far as I see, it somehow seems like that there is a threshold of size of 4 letters.

      Update: sorry I made a mistake. I was using custom UUIDs generated by Windows uuidgen instead of the default HeartRate and HeartRateMeasurement. Under such setup, a manufacturer data of 4 letters fails. But if I am using the default UUIDs, then manufacturer data can be larger. Specifically, this fails:

      advertisingData.setManufacturerData(0x0000, "test01234567891234");
      

      and this works:

      advertisingData.setManufacturerData(0x0000, "test0123456789123");
      

      Back to the custom UUIDs, I can make larger manufacturer data work by reducing size of other data, e.g. comment out

      advertisingData.setIncludePowerLevel(true);
      

      Therefore, I am almost sure that it is a size issue.

      Attachments

        For Gerrit Dashboard: QTBUG-133534
        # Subject Branch Project Status CR V

        Activity

          People

            vuokko Juha Vuolle
            luqiaochen Luqiao Chen
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: