开发者

Does Qt support the windows bluetooth API?

Can anyone tell me whether or not Qt supports the windows Bluetooth API? If so could you please share some开发者_高级运维 information on how to use it?


The answer to this question has changed a bit since the last response was given. Qt version 5.2 implemented a Bluetooth API for Linux/BlueZ and BlackBerry devices. Qt 5.3 includes Bluetooth support for Android. Linux devices can connect with RFCOMM or L2CAP protocols. Android and Blackberry only have RFCOMM.

Bluetooth on Windows is still not supported, but that fact is hard to find. Currently, if you create a QBluetoothSocket on Windows and tell it to connect to an address, it fails silently even though there is a built-in error-reporting mechanism. If you use the QBluetoothLocalDevice interface to retrieve devices, you get back an empty list. Although the class documentations don't mention the fact, the Bluetooth Overview clarifies that

Currently the API is supported on Android, BlackBerry 10 and Linux (Bluez 4.x).


Starting from Qt 5.11, Qt documentation says:

Despite there not being a Win32 port yet, the WinRT backend is automatically used if the win32 target platform supports the required WinRT APIs. Minimal requirement is Windows 10 version 1507 with slightly improved service discovery since Windows 10 version 1607. Therefore Windows 7 and 8.x targets are excluded.

Bluetooth Chat Example tested successfully using following setup:

Qt 5.11.1

Win10

Qt Kit MSVC2017 64 bit.


As January 2020 documentation, Qt 5.14 officially supports "Classic Bluetooth" for win32 builds.

However, it doesn't seem complete, here mentions a restriction about finding devices:

...it is only possible to find devices that have been previously paired through Windows Settings

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜