QT 5.5: QLowEnergyControllerPrivate::connectToDevice(): Not implemented



  • Hi,

    After buying a Raspberry Pi 2 and using debian wheezy I finally got the blue tooth modules compiled. However I am facing a new problem while using the QLowEnergyController.

    After searching for blue tooth LE devices using the QBluetoothDeviceDiscoveryAgent class I am trying to connect using the energycontroller the following error occurs : QLowEnergyControllerPrivate::connectToDevice(): Not implemented.

    The code I'm using:

    void Quart::addDevice(const QBluetoothDeviceInfo &device)
    {
        if(device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration){
            qDebug() << "Found new device:" << device.name() << '(' << device.address().toString() << ')';
    
            QLowEnergyController *control = new QLowEnergyController(device, this);
            connect(control, SIGNAL(serviceDiscovered(QBluetoothUuid)),
                    this, SLOT(serviceDiscovered(QBluetoothUuid)));
            connect(control, SIGNAL(discoveryFinished()),
                    this, SLOT(serviceScanDone()));
            connect(control, SIGNAL(error(QLowEnergyController::Error)),
                    this, SLOT(controllerError(QLowEnergyController::Error)));
            connect(control, SIGNAL(connected()),
                    this, SLOT(deviceConnected()));
            connect(control, SIGNAL(disconnected()),
                    this, SLOT(deviceDisconnected()));
    
            control->setRemoteAddressType(QLowEnergyController::RandomAddress);
            control->connectToDevice();
        }
    }
    

    Looking in the source code of qt(5.5) I found 2 files: QLowEnergyController.cpp which contains the correct code(I think) and QLowEnergyController_p.cpp which contains nothing but some code to pass units tests and:

    qWarning() << "QLowEnergyControllerPrivate::connectToDevice(): Not implemented";
    setError(QLowEnergyController::UnknownError);
    

    Could it some how be using the wrong files? I'm am totally lost from this point.


  • Lifetime Qt Champion

    Hi,

    Since you are running linux on the Raspberry Pi 2, you are probably running Bluez on it. If so, you should take a look at qlowerenergycontroller_bluez.cpp

    Hope it helps



  • It is correct that I am using Bluez(5.3.7). I look at the qlowerenergycontroller_bluez.cpp file and it seems that it is the one I need. But when I look at the makefile file I can only see references to qlowerenergycontroller_p.cpp.
    qlowerenergycontroller_bluez.cpp is not mentioned once.

    I also looked at the output of my make file and there I saw an error saying my bluez version is to low to support low energy. Assuming Qt is using pkg-config I ran pkg-config --modversion bluez which gave me version 4.99 while I have installed 5.37. Could that be my problem? To fix this I placed the bluez.pc file in to /usr/lib/pkgconfig and put it in the PKG_CONFIG_PATH variable.

    When I run pkg-config --moversion bluez I gives me 5.37. I am going to recompile everything and will let you know if this solved anything.



  • This was indeed the problem. After setting the correct pkg-config for the bluez package and recompiling qt's source I can send and receive messages with the blue tooth modules.


  • Lifetime Qt Champion

    Great !

    Thanks for sharing the solution :)


Log in to reply
 

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