Bluetooth issue on Mac

Thiago Macieira thiago at macieira.org
Mon Sep 28 13:45:54 PDT 2015


On Sunday 27 September 2015 15:01:40 Dirk Hohndel wrote:
> When trying to download from a BT dive computer on Mac (I tried this with
> an OSTC Sport and with a Shearwater Petrel 2) I get this strange error
> message:
> 
> QObject::connect: Cannot queue arguments of type 'QBluetoothServiceInfo'
> (Make sure 'QBluetoothServiceInfo' is registered using qRegisterMetaType().)

Hmm... This means we're doing a cross-thread signal delivery and a parameter 
contains QBluetoothServiceInfo. I can't find such a signal in our source code.

Dirk, I need a backtrace of that warning being printed...

> Now when I add an attempt to register the type (i.e., adding
> Q_DECLARE_METATYPE(QBluetoothServiceInfo) in qtserialbluetooth.c) then the
> compile fails with
> 
> /Users/dhohndel/src/subsurface-build/subsurface/qtserialbluetooth.cpp:18:1:
> error: redefinition of 'QMetaTypeId<QBluetoothServiceInfo>'
> Q_DECLARE_METATYPE(QBluetoothServiceInfo)

That means the declaration already exists. It's the registration that is 
missing.

> So it doesn't work if I don't declare the type, but it doesn't work either
> if I DO declare the type.
> 
> Any ideas?

Well, a simple solution is to do exactly what it says: add a
	qRegisterMetaType<QBluetoothServiceInfo>();

somewhere before the object is used for delivery. I don't think we should do 
that, though: there's no signal or slot with QBluetoothServiceInfo in our 
code, so this must be coming straight from QtBluetooth and it means we've 
violated threading requirements somewhere.

The only signal I can find with a QBSI parameter in QtBluetooth's source code 
is QBluetoothServiceDiscoveryAgent::serviceDiscovered with a corresponding 
slot in QBluetoothSocket, a class we're using. QBluetoothSocket starts the 
discovery when we call QBluetoothSocket::connectToService.

But I don't see anything evident that would explain how the signal gets 
emitted from a different thread that the QBluetoothSocket would be running 
on...

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list