Please nominate your Qt Champions for 2021!

Bluetooth Low Energy Characteristic Indications (not Notifications)

  • Can anybody explain how Bluetooth Low Energy Indications (QLowEnergyCharacteristic::Indicate) are supposed to work please?
    There is very little documentation on them so I assume they work very similair to BTLE Notifications. Is that correct?

    The Heart Listener example has this code where notifications are enabled:
    const QLowEnergyDescriptor m_notificationDesc = characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
    if (m_notificationDesc.isValid()) m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0100"));

    So is it a matter of setting the bit flags differently?

    And can I assume indiciations are delivered through characteristicChanged?
    connect(m_service, SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray))

    I would be very thankful for a small example or verification of my assumptions.

  • A bit of a late response, but...

    Assuming the GATT server on the other end has a characteristic that allows for Indicate, then the only thing that needs to change is the value that you write to the descriptor. Set Bit 1 of the CCC to enable indicates by writing "0200" instead of "0100" (the descriptor is little-endian according to the BLE documentation for the Client Characteristic Configuration descriptor).

    As far as I know, indications are delivered with the characteristicChanged signal just like notifications.

  • a little bit late but for anybody searching. Indication is different than notification in that there is a confirmation that data sent from peripherical (hardware measuring device as heart rate) to the central device (same as your phone app) reached. Notification does not offer this confirmation. It is something like udp (no confiramtion available) and http (confirmation available)