Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

BLE notification



  • Hi,
    I want communicate with a BLE device. I haven't problem to send him data but I can't be notified of event on this device. When there are a event on my BLE device, I have the warning :

    qt.bluetooth.bluez: cannot find matching characteristic for notification/indication
    

    I think it's because my device is a bit strange. I have :

    - service_1 
       |_ characteritic_1
       |_ characteritic_2
       |_ characteritic_3
       |_ characteritic_4
       |_ characteritic_5
       |_ characteritic_6
           |_ descriptor_1
    
    void MyApp::startNotifListen()
    {
    
        if(m_controller) {
             QLowEnergyService *service = m_controller->createServiceObject(QBluetoothUuid (UUID_SERVICE_1));
            if(!service) {
                if(DEBUG)   qDebug()<<"service not found!!!";
                return;
            }
            else if(DEBUG)   qDebug()<<"service found!";
             QLowEnergyCharacteristic characteristic = service->characteristic(QBluetoothUuid(UUID_CHARACT_6));
             if(characteristic.isValid()) {
                   QLowEnergyDescriptor descriptor = characteristic.descriptor(QBluetoothUuid(UUID_DESC_1));
                 if(descriptor.isValid()) {
                     service->writeDescriptor(descriptor, QByteArray::fromHex("0100"));
                 } else if(DEBUG)   qDebug()<<"descriptor not found";
             }
            else if(DEBUG)   qDebug()<<"characteristic not found";
        }
    }
    

    I have tested on android and there are no problem. I can enable notification on characteristic { BluetoothGatt.setCharacteristicNotification(BluetoothGattCharacteristic characteristic, boolean enabled) }
    I haven't found similar function on Qt.



  • @helenebro I managed to get to the bottom of the problem (it is due to a firmware bug in these BLE low-cost modules), see my bug report under https://bugreports.qt.io/browse/QTBUG-83363.