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

CoreBluetooth, add options/API to pass specific scanning options.

    XMLWordPrintable

Details

    • iOS/tvOS/watchOS

    Description

      CBCentralManager, -scanForPeripheralsWithServices:options: has the last parameter 'options', which is a dictionary to pass 'named' values. There are at the moment two options: CBCentralManagerScanOptionAllowDuplicatesKey and CBCentralManagerScanOptionSolicitedServiceUUIDsKey. The first one is a number/boolean, saying if duplicate filtering should be disallowed. Not passing this option (as it is in our code now) means " the central coalesces multiple discoveries of the same peripheral into a single discovery event." Also, Apple's docs have a warning:

      Important
      Disabling this filtering can have an adverse effect on battery life; use it only if necessary.

      Arguably, by default Qt has a scan timeout, and for iOS it's 20 s. (so even if duplicates discovered and reported again, the scan finishes relatively soon, no problem for a battery life). Also, it was reported that with duplicates disabled, RSSI never properly found for a particular device. For 5.15 we introduce a workaround - an environment variable which allows to pass this scan option, if set: QT_BLUETOOTH_SCAN_ENABLE_DUPLICATES (with a positive integer as value enabling duplicates). For 6.x it probably makes sense to have a better API, especially if other platforms (Android, BlueZ on linux) have similar abilities.

      Attachments

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

        Activity

          People

            tpochep Timur Pocheptsov
            tpochep Timur Pocheptsov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes