BLE on iOS

Dirk Hohndel dirk at hohndel.org
Tue Jul 18 06:34:50 PDT 2017


Hi Alex, Timur,

> On Jul 18, 2017, at 4:09 AM, Alex Blasche <alexander.blasche at qt.io> wrote:
>> 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.

Excellent. So we can bug him for both iOS and Mac? :-)

>> 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 

I don't want to sound like a downer... but I must have missed that explanation in the documentation. It would be kinda neat if the classes had a little warning that said "this doesn't work on iOS - implementation is a dummy". Looking at http://doc.qt.io/qt-5/qbluetoothlocaldevice.html I can't find any indication that I wouldn't be able to start with this...

Let's start a new #ifdef'ed path with the class chain you suggest.

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

That's one of the things that puzzle me. It says the same about macOS in the documentation, yet we do get Bluetooth addresses on macOS - just not 100% reliably.

Anyway, I'll worry about macOS next, right now I'd love to see some sign of life on iOS...

Thanks for the help - I can virtually assure you that I'll be back with more questions. I assume that the documentation is maintained in git somewhere as well. As I work through this, should I try to propose changes to the docs? Where would I start to create pull requests for that?

/D


More information about the subsurface mailing list