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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.