Scanning-Bluetooth

One thing I am tired of hearing about, is that people think Qt is only for developing rich GUI applications.

If you think Qt is only about building a UI, it’s not — there are plenty of Qt libraries for internationalization, strings, threads, XML, and JSON parsing, databases, sockets, Bluetooth, sensors, NFC, event management, and more. It is even possible to develop command-line tools and consoles for servers.

Lets consider a use case to prove that Qt is beyond UX. Suppose you would like to build a bluetooth connectivity module on your embedded product which can scan and connect to other bluetooth devices. What does Qt offer? Lets see the details below.

This article guides you to build a Qt application to scan bluetooth devices in range by making use of e-con Systems™’ eSOMiMX6 based development kit Ankaa.

Over the years, Bluetooth has become a popular technology allowing electronic devices to communicate wirelessly. It is basically a method for data communication that uses short-range radio links to replace cables between computers and their connected units.

Qt provides its own API to use Bluetooth and enables connectivity between Bluetooth enabled devices which enables basic Bluetooth operations like scanning for devices and connecting them.

The Bluetooth API provides connectivity between Bluetooth enabled devices. This is typically used for scanning the device ,pairing with device , transferring the data between the devices.

QML uses a model, BluetoothDiscoveryModel which has the details of all scanned devices. This provides a model of connectable devices. This model is filled based on the enumeration set to discoverymode property. Here as we are interested to scan devices we use BluetoothDiscoveryModel.DeviceDiscovery.

This model has following roles:

  • name – The devices name and address

  • deviceName – The name of the device

  • remoteAddress – The address of the discovered device.

Using these three roles we can get the name and address of the device.

The demo video shows that our eSOMiMX6 device scans for remote devices within the bluetooth range and displays list of devices with name and its address using Qt bluetooth module.

We strongly support Qt on our embedded platforms.

Are you looking to quickly develop an application using Qt? Then, the e-con Systems™ eSOMiMX6 based Ankaa kit might be a good solution for you.

Please visit our developer website to download various articles and supporting sample programs on Qt.

For further assistance and queries please get in touch with sales@e-consystems.com