BLE on iOS

Alex Blasche alexander.blasche at qt.io
Tue Jul 18 04:09:28 PDT 2017


Hi Dirk,

> -----Original Message-----
> From: Dirk Hohndel [mailto:dirk at hohndel.org]

> Nor sure if you are the right person for this on iOS - but if not, maybe you can
> point me to the right person.

Timur (in cc) is the Apple master for QtBluetooth.

> When compiling Subsurface-mobile for iOS with BT_SUPPORT enabled, we don't
> appear to get a valid QBluetoothLocalDevice at all. Asking for isValid() returns
> false, asking for allDevices() returns an empty list.
> I tried powerOn() but as expected that doesn't work, either.

QBluetoothLocalDevice is not possible on iOS. Apple does not expose this information to app developers. The classes implementation is a dummy only. The same is true for QBluetoothServer, QBluetoothSocket, QBluetoothServiceDiscoveryAgent. Only the straight path to QLowEnergyController (BTLE use cases) are supported. That means that only the following class chain works:

QBluetoothDeviceDiscoveryAgent -> QBluetoothDeviceInfo -> QLowEnergyController 

Also note, that iOS does not expose Bluetooth addresses. The platform generates uuid's as id's for devices.

> While this is all about foreground activity, I even entered the Info.plist key for
> bluetooth-central.
> 
> So right now I am stuck before I even get to do anything - I cannot see the BLE
> device.
> 
> (and yes, of course, Bluetooth is turned on in the settings of the iPad I was
> testing this with)

The only way to deal with those eventualities is to check the various errors in QBDeviceDiscoveryAgent and QLEController. 

--
Alex



More information about the subsurface mailing list