On domingo, 25 de setembro de 2016 12:47:23 PDT Dirk Hohndel wrote:
> So we now have a few reports that this isn’t working anymore…
> I can reproduce things here but have no clue how to fix it.
> 
> First I get this error
> 
> QObject::connect: Cannot queue arguments of type 'QBluetoothServiceInfo'
> (Make sure 'QBluetoothServiceInfo' is registered using qRegisterMetaType().)

I remember seeing this elsewhere. It might be a Qt bug.

> which appears to be caused by this code in qtserialbluetooth:
> 
> #elif defined(Q_OS_ANDROID) || (QT_VERSION >= 0x050500 && defined(Q_OS_MAC))
> // Try to connect to the device using the uuid of the Serial Port Profile
> service QBluetoothAddress remoteDeviceAddress(devaddr);
>       serial_port->socket->connectToService(remoteDeviceAddress,
> QBluetoothUuid(QBluetoothUuid::SerialPort)); 
>       timer.start(msec);
>       loop.exec();

There's no QBluetoothServiceInfo in there. The only reference in the source 
code is

     serial_port->socket = new 
QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);

I don't remember the Bluetooth code implementation anymore (even though I 
mentored the student who wrote it). Is the code in qtserialbluetooth.cpp 
running in an auxiliary thread, started by libdc?

I've attached a blind attempt at fixing this. I have no idea if it helps in any 
way. It may make things even worse.

Can you run with QT_FATAL_WARNINGS=1 and then give me the backtrace of that 
QObject::connect warning? (this requires that Qt print no other warnings 
before this one) My guess is that this is the emission of the 
QBluetoothServiceDiscoveryAgent::serviceDiscovered signal starting at 
QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
>From 8634a0299afa65440b714d0831206c780a31a35a Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macie...@intel.com>
Date: Mon, 26 Sep 2016 14:59:55 -0700
Subject: [PATCH 1/1] Register the QtBluetooth metatypes for Qt

Blind attempt. It looks like we're using a thread, which makes the Qt
cross-thread signal delivery fail.

Signed-off-by: Thiago Macieira <thi...@macieira.org>
---
 core/qtserialbluetooth.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/core/qtserialbluetooth.cpp b/core/qtserialbluetooth.cpp
index 1b227cf..893be8a 100644
--- a/core/qtserialbluetooth.cpp
+++ b/core/qtserialbluetooth.cpp
@@ -89,6 +89,11 @@ static dc_status_t qt_serial_open(void **userdata, const char* devaddr)
 
 	qDebug() << "Succesfully connected to device";
 #else
+	// Register metatypes for Qt
+	qRegisterMetaType<QBluetoothServiceInfo>();
+	qRegisterMetaType<QBluetoothServiceInfo::Sequence>();
+	qRegisterMetaType<QBluetoothServiceInfo::Alternative>();
+
 	// Create a RFCOMM socket
 	serial_port->socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
 
-- 
2.10.0

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to