Hi Scott,

the general process in Qt 6 is as Juha has described.
You need to call QBluetoothLocalDevice::requestPairing() with the desired
pairing mode, and then handle the QBLD::pairingFinished() signal.
Also QBLD::errorOccurred() might report PairingError in case something goes 
wrong.

Last time I checked, pairing worked fine on Windows 11.
The system dialog with PIN confirmation should appear automatically,
you do not need to handle it somehow on the Qt side.

But I must admit that, like everything in Bluetooth, it depends both on your 
local
bluetooth adapter, and the device that you try to connect to.

Feel free to create a bugreport with a more detailed description!

Best regards,
Ivan

________________________________________
From: Interest <interest-boun...@qt-project.org> on behalf of Scott Bloom 
<sc...@towel42.com>
Sent: Thursday, April 10, 2025 7:07 AM
To: Juha Vuolle
Cc: Interest@qt-project.org
Subject: Re: [Interest] QBluetooth connection/pairing issue

Thanks for the hint.. Its close. But not quite there.

In Qt5, there were 2 or 3 call back signals for handling authentication, and 
one slot to be called when finished.

Those are missing in Qt6, and I don’t see anyway to set the pin for an 
authorized connection.

Scott

-----Original Message-----
From: Juha Vuolle <juvuo...@gmail.com>
Sent: Tuesday, April 8, 2025 23:09
To: Scott Bloom <sc...@towel42.com>
Cc: Interest@qt-project.org
Subject: Re: [Interest] QBluetooth connection/pairing issue

Hi,

> It works fine, if I have paired it outside of the app.  How do I pair it 
> inside the app?

QBluetoothLocalDevice might be useful for you, see 
https://doc.qt.io/qt-6/qbluetoothlocaldevice.html#requestPairing


On Wed, 9 Apr 2025 at 05:22, Scott Bloom <sc...@towel42.com> wrote:
>
> I am working on a tool that connects to a BT serial port device on
> windows 11
>
>
>
> I have the scan working, and can select the device, giving me a
> QBluetoothServiceInfo
>
>
>
> I can get the address via QBluetoothServiceInfo::device().address();
>
>
>
> I can save this value to the registry, and reconnect on the startup of the 
> tool.
>
>
>
> However, I can’t figure out for the life of me how to “pair” the device.
>
>
>
> I turned on  all the Bluetooth logging, hoping to see something, via
>
> QLoggingCategory::setFilterRules( QStringLiteral( "qt.bluetooth* =
> true" ) );
>
>
>
> But that didn’t help.
>
>
>
> I construct the socket via
>
> socket = new QBluetoothSocket( QBluetoothServiceInfo::RfcommProtocol);
>
>
>
> I connect to all the socket signals, and never see a request or failure due 
> to not being paired.
>
>
>
> I then use
>
>
>
> Socket->connectToService( address,
> Socket->QBluetoothUuid::ServiceClassUuid::SerialPort )
>
>
>
> It works fine, if I have paired it outside of the app.  How do I pair it 
> inside the app?
>
> TIA,
>
>
> Scott
>
>
>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to