QML Bluetooth Scanner Example
A QML example about locating Bluetooth devices.
This is an example on how to locate Bluetooth devices in QML.
The user has the choice to run three different types of Bluetooth scans. The device retrieves information about the remote device within Bluetooth range. This implies that the remote device can be discovered. The picture below demonstrates the potential result of such a search:
The second and third type of scan dicover the types of services offered by each remote device. A full service discovery can take quite some time to finish. The local device connects to each remote device and performs an SDP enquiry. The results of such an enquiry can be seen below.
In general a service discovery is based on the results of a previously run device enquiry. A minimal service discovery returns the same data set as a full discovery except that the results are retrieved from local cache information and may not always be complete and accurate. The primary reason to perform a minimal discovery are time constraints. A full service discovery can take up to two minutes. Note that not every platform supports a minimal discovery. In such cases the API performs a full discovery.
Running the Example
To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.
Files:
- scanner/Button.qml
- scanner/qmlscanner.cpp
- scanner/scanner.pro
- scanner/scanner.qml
- scanner/scanner.qrc
Images:
See also Qt Bluetooth.
© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.