Qt World Summit: Submit your Presentation

Bluetooth Low Energy BLE Indicate Response

  • Hello,
    does anybody have experience with sending out indications as a BLE peripheral?
    To send out indications, I configure the characteristic accordingly (see below) and issue a write to the charactersistic:

    QLowEnergyService::writeCharacteristic(characteristic, response, QLowEnergyService::WriteMode::WriteWithResponse);

    By that, as opposed to notifications, I should receive a response/confirmation.
    The bluez logging indeed prints out an event, that a response has been received.

    But how do I get the response/confirmation into my Qt application? I registered for all the signals defined in http://doc.qt.io/qt-5/qlowenergyservice.html#signals. First I expected to receive the confirmation signal in the "characteristicWritten" signal, but then I read the note:

    Note: This signal is only emitted for Central Role related use cases.

    As I am a peripheral (and as indications are emitted by peripherals), through what mechanism in the Qt BLE API can I receive an indication response? Or an error?

    The charactersistic is basically setup like this:

    QLowEnergyDescriptorData    clientCharacConfigDescriptor;
    constexpr uint8_t           rawClientCharacData[]  = { 0x02, 0x00 };
    const QByteArray            qRawClientCharacData   = QByteArray::fromRawData(reinterpret_cast<const char*>(rawClientCharacData), sizeof(rawClientCharacData) / sizeof(*rawClientCharacData));
    QLowEnergyCharacteristicData characteristic;
    characteristic.setProperties(QLowEnergyCharacteristic::Write | QLowEnergyCharacteristic::Indicate);

    Maybe related: https://forum.qt.io/topic/65196/bluetooth-low-energy-characteristic-indications-not-notifications

Log in to reply