Solved Bluetooth problem
-
I installed on Linux
sudo apt-get install libbluetooth-dev
Now I add to my *.pro
QT += bluetooth
However while compiling I get
Unknown module(s) in QT ; bluetooth -
Hi,
Did you forget to install the corresponding Qt module ?
And likely the Qt Connectivity development package.
-
@SGaist said in Bluetooth problem:
Hi,
Did you forget to install the corresponding Qt module ?
And likely the Qt Connectivity development package.
I don't think so.
@SGaist said in Bluetooth problem:
Hi,
Did you forget to install the corresponding Qt module ?
And likely the Qt Connectivity development package.
I don't think so
sudo apt-get install qt5-default
sudo apt-get install qtcreator
And my console application works fine so far. Now I want to add bluetooth functionality to control the module on Paspberry Pi. So I installed suggested library - BlueZ
sudo apt-get install libbluetooth-dev
and included
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
and Qt environment sees the libs and the functions (at list the intellisens pops-up it ) .
But when I compile I get errors on the functions - undefined reference to 'hci_get_route'. -
libbluetooth != libqt5bluetooth5
That's the later one you should check and the
qtconnectivity5-dev
package. -
@SGaist said in Bluetooth problem:
libbluetooth != libqt5bluetooth5
That's the later one you should check and the
qtconnectivity5-dev
package.Yes but this is a Qt library. I'm not sure it will be working with Raspberry hardware. That's why I want to port the BlueZ library.
-
@jenya7 said in Bluetooth problem:
Yes but this is a Qt library
Yes, because as it happens with lots of features in Qt framework, the support for feature X (i.e. Bluetooth in your case) come in two parts:
- a Qt library (i.e. Qt Connectivity module)
- the underlying implementation of such feature X for a particular OS (i.e. Blue) where you'll be deploying your Qt app
-
@Pablo-J-Rogina said in Bluetooth problem:
@jenya7 said in Bluetooth problem:
Yes but this is a Qt library
Yes, because as it happens with lots of features in Qt framework, the support for feature X (i.e. Bluetooth in your case) come in two parts:
- a Qt library (i.e. Qt Connectivity module)
- the underlying implementation of such feature X for a particular OS (i.e. Blue) where you'll be deploying your Qt app
So what should I do?
-
That depends on you. If you want to use libbluetooth directly, then go on but do not add
QT += bluetooth
to your pro file as you are not using that Qt module. -
@SGaist said in Bluetooth problem:
That depends on you. If you want to use libbluetooth directly, then go on but do not add
QT += bluetooth
to your pro file as you are not using that Qt module.But I get an error - undefined reference to 'hci_get_route'.
-
If you use libbluetooth, it's your job to check whether your need to update
INCLUDEPATH
to add the location of the libbluetooth headers.It's also your job to add the corresponding link statement to the
LIBS
variable.If libbluetooth-dev provides a .pc file, you can use pkg-config through qmake's integration.
-
@SGaist said in Bluetooth problem:
If you use libbluetooth, it's your job to check whether your need to update
INCLUDEPATH
to add the location of the libbluetooth headers.It's also your job to add the corresponding link statement to the
LIBS
variable.If libbluetooth-dev provides a .pc file, you can use pkg-config through qmake's integration.
That's the problem - how to link. When I used gpiod I added LIBS +=lgpiod and it works good with Qt. In this case can not find the pass to the lib.
-
Did you add
LIBS += -lbluetooth
to your .pro file ? -
@SGaist said in Bluetooth problem:
Did you add
LIBS += -lbluetooth
to your .pro file ?OMG! As simple as that. Thank you so much! :)