ekkes BT LE example APP

June 29, 2017 — 4 Comments

Bluetooth LE for mobile Business APPs

As you know I’m developing mobile business apps for Enterprises and SMBs. There are many use-cases where Bluetooth LE (BTLE) devices can help to streamline the workflow. Last years I already have done some BT LE powered APPs on BlackBerry 10.

In the meantime BlackBerry devices are running Android and most of my enterprise customers are moving from BB10 to Android, some to iOS, some both.

Thanks to QtQuickControls2 I found my way into Android and iOS development using Qt.

After some weeks of exploring and developing I’m happy what can be done with Qt for BT LE APPs on Android and iOS. A big thx to all the Qt developers !

There are also some Bluetooth LE Example APPs avilable: http://doc.qt.io/qt-5/qtbluetooth-index.html#examples

What was missed ? A real-life APP built with QtQuickControls2.

To help others and to be able to demo features to customers I decided to develop a BTLE example APP and to make it open source at Github.

The good thing to have this app: it’s now easier for me to test the features inside a special APP instead inside more complex mobile business APPs I’m normaly working on 😉

ekkes BTLE example

  • finds BT LE devices nearby
  • lets you explore Services and Characteristics and try out Read, Write, Notify
  • covers all errors and signals to get a robust APP. if you run into an issue please let me know
  • for known Device Types (Addimat Lock, NFC Reader, HeartRate Monitor)
    • remembers last used device address to auto-connect after restart APP
    • allows to connect to more then one BT LE Devices: per ex. get Notifications from Lock and NFC Reader at the same time
    • provides settings for Battery Level and more
    • enables mapping of users / persons to Lock Key or NFC Tag
    • manages detailed states: connect / all needed services + characteristics available / disconnect
    • easy re-connect

I’ll divide this article into 2 parts:

  1. documentation and screenshots HowTo USE the APP
  2. analyzing APP project structure and src and HowTo port BT functionality into your own app

The 2nd part will take some time, because I’m heavy loaded with customer projects.

Meet ekke at Conferences

I’ll speak about more complex mobile business APPs at Qt World Summit 2017 in Berlin

You are from Germany ? Don’t miss my talk at W-JAX: Bluetooth LE in mobile Business Apps

Thx John and Martin

Before starting with the first part I have to thank John Murray and Martin Woolley. John and Martin helped me to master first steps into Bluetooth and NFC on BlackBerry 10 / Cascades (Qt 4.8).

Download from the Stores

Run on Android 4.3 or greater for Phones and Tablets from Google Play Store:


Run on iOS 8.2 or greater for iPhone or iPads from Apple App Store:


Run on Amazon Fire OS from Amazon App Store:


Here‘s the link to german Amazon App Store:

ekkes BTLE example APP

This APP uses same customized QtQuickControls2 as my other demo APPs, also same Images and follows same project rules.


Besides the Drawer Navigation there’s a Bottom Navigation Bar for easy access to the most important parts of the APP.

Here’s the Drawer:

  • wondering about the gray area where normaly it’s only dimmed so you can see what’s behind ? This is because of workarounding a Qt 5.9 Bug.

APP Features and Devices

  • Scanner (discover devices nearby, explore Services and Characteristics
  • HeartRate (HeartRate Monitor)
  • Lock (Waiter Lock with magentic keys)
  • NFC Tag (NFC Reader via BT LE)
  • Help Page
  • About Page

Main goal of this APP is to help other devs with Qt BT LE for mobile. All sources are available at Github.

ekkes BTLE example APP is also my workbench testing new Device Types and HowTo integrate into my apps.

As first I included a HeartRate Monitor, because I could compare what happens from existing Qt BT LE example apps.

Then I added Addimat Lock

Probably you have seen something like this at Restaurants where waiters Log-In / out at Cash Register using magnetic keys.

Some of my customers are using Addimat Lock for Teams sharing an Android Tablet or iPad.

Each key has a unique ID and is mapped to the User. Now switching between users is fast and secure.

Most Locks are only connected via USB or RS232 – so I was happy to find Addimat with Bluetooth LE Custom Services.

Hint: It’s important to use a Custom Service and not connect as a HID (like BT Keyboards) because then under iOS the virtual keyboard disappears.

More Info on Addimat can be found here.

As next I added a NFC Reader

NFC Tags are used per ex. to identify attendees of Conferences / Events / Trainings:

NFC works well on most Android Smartphones with an integrated NFC chip. But when it comes to Tablets even high end Tablets as Goggle Pixel C miss the NFC Chip. iOS devices have a NFC Chip integrated, but Apple blocked acces for developers in the past. Starting with iOS11 developers get partly access to NFC Tags: you can read NDEF Records etc. But in all business APPs I developed last years where NFC was used to identify persons or locations, only the UUID was used.

So for some customers looking for a way to register from a mobile device perhaps an extra NFC Reader conencted via Bluetooth LE is the only solution.

Finally I found a device with some help from CSG:

NFC Reader can be customized and integrated into custom cases.


Android, iOS, Smartphones, Tablets

The APP is running on Android Smartphones and Android Tablets.

Screenshot from Google Pixel C Tablet:

Using NFC Reader you add NFC to high end Google Pixel C Tablet


Screenshot Amazon Fire HD8 Tablet:

ekkes BTLE example also is running on iOS.

Screenshot from iPhone:

and Screenshot from iPad Mini2:

Discover and explore BT LE devices

Hint: Beacons are not supported yet – have to learn HowTo deal with Beacons from Qt.

Selecting first time the Scanner, ekkes BTLE example APP discovers all BT LE devices nearby. While searching for devices there’s a progress view. (see Fire HD 8 screenshot above). Your devices isn’t listed ? Switch it off and on – this helps in most cases. Then hit theblue ‘+‘ Button to discover again and add devices currently not listed. Tap on the red ‘x‘ Button to clear the list and start again.

In the list you get: RSSI, name, MAC Address and current state.

From the list you can Connect or Disconnect devices – tapping on a row will give you a Popup Menu:

First option “Select” is only available for known device types (HeartRate, Lock, NFC Reader).

Tapping on “Select” will select this device as your default device, store MAC address in settings, open the special Page and do a Connect.

“Explore Services” opens a detail Page wit all the Services.

“Connect / Disconnect” does exactly this

Explore Services

Here are all Services found for Addimat Lock:

You get the name and Service UUID. Tap on a row to see the Characteristics of this Service.


Battery Level Characteristics from Addimat Lock:

Battery Level Value can be Read.

Characteristics of Addimat Custom Services:

Custom Characteristics can be Read to get the current Value or you can subscribe for notifications.

Tap on a row to see the details or to interact:

Tap on the red “R” Button to read the current value.

Tap on the red “N” Button to subscribe to the values. There’s a switch if all values should be collected or if you only want to see the last one.

ekkes BTLE example APP displays values as String, HEX or INT. Please take a look at the documentation of your device or Bluetooth GATT service. Sometime values are not human readable and must be analyzed by some business logic.

If a Characteristic has “Write” permissions you’ll see a “W” Button. Tapping on the “W” allows you to enter String or HEX values and to write to the Device:

HeartRate Monitor

Selecting a HR Device a special Page opens:

The header shows you name, MAC address and state and you can Connect, Initialize Services or Disconnect from there.

The “Play” Button subscribes Notifications and you’ll see the HR values:

Addimat Lock Manager

Addimat Manager Page works similar.

Attention: Addimat Lock can work as HID or as BT LE with custom Service. iOS doesn’t know about the custom BT LE Service, so every time you connect to Addimat, iOS tries to connect as HID. There’s an easy way to get rid of this message:

First time enter 307630:

Then open Addimat from Settings – Bluetooth and tap in ‘I’:

Then tap on “Ignore Device”:

Now Addimat is only used as a BT LE Device with custom Services and Characteristics.

Here the Notifications about magnetic keys plugged-in or out are already subscribed (Progress Bar is running):

No User was found for this Addimat Key. In a real-life app you would check the ID against a REST service or a local database.

To simulate this you can add the Mapping between Key ID and User.

Please open ‘Mapping’ from “Settings Menu”:

While the Configure – Popup is open, the values from the keys are still received, but now the APP knows that you’re configuring and you can enter the Name. Do this for all your Keys. (In a real life APP this would be done at Server site and the APP does a Login with Key ID as credentials)

Next time you plug-in the Key, ekkes BTLE example APP “knows” the user:

Select “Settings” from Menu above to see the default device address or to change battery levels:

ekkes BTLE example APP notifies you if the device is disconnected:

NFC Reader

Here’s the NFC Reader Page – Notifications are subscribed to get the NFC Tag IDs:

NFC Reader allows you to “Write” values to the buzzer and LED. Commands Buttons “BUZZER” and “LED” lets you test this.

Here’s the Menu you get from “Buzzer”:

and here’s the Menu you get from “LED”.

ekkes BTLE example APP also uses the LED: if a Tag ID was found, the LED becomes green, if not the LED becomes red.

You can map the NFC Tag IDs same way as for the Addimat magnetic Keys:

Holding the NFC Tag on the NFC Reader, ekkes BTLE example APP welcomes the attendee:


stay tuned for part 2 of the documentation where I’ll explain project structure and source code.

Open Source

All sources are available at GitHub: https://github.com/ekke/ekkesBTLEexample


4 responses to ekkes BT LE example APP


    Hi ekke, thank you for the great bluetooth low energy example.
    When I try to run lupdate then the following message displayed:

    Starte externes Werkzeug “C:\Qt\5.9.1\mingw53_32\bin\lupdate.exe” C:/Users/dev/Desktop/Tests/ekkesBTLEexample-master/bt_le_x.pro
    WARNING: Project ERROR: Cannot run compiler ‘g++’. Maybe you forgot to setup the environment?
    “C:\Qt\5.9.1\mingw53_32\bin\lupdate.exe” beendet

    I’m using Qt 5.9.1 with Qt Creator 4.3.1. Can you help me please?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s