[Interest] Qml Bluetooth Connection
alexander.blasche at qt.io
Tue Jul 24 14:11:31 CEST 2018
> -----Original Message-----
> From: Interest <interest-bounces+alexander.blasche=qt.io at qt-project.org> On
> I'm trying to A2DP/HFP connection via bluetooth in qml. I can list available
> devices and find their addresses but I can't make the connection.
Making a A2DP/HFP connection in QML is not very useful as you cannot handle binary data in QML. Sending strings to the socket from QML is almost never what your remote device/service expects (unless you have a chat server). I strongly recommend doing this in C++.
> In Qt official page it says you can use "BluetoothSocket" to make connection but
> in my scan there is no service found.
Please try the qml_chat example together with tests/bttestui. The qml_chat should be started after the bttestui app was started and the device put in discovery mode and the server was started (SListenPort/SListenUuid). qml_chat uses the BluetoothSocket QML type.
> Above my "BluetoothDiscoveryModel" when I make
> "discoveryMode: BluetoothDiscoveryModel.DeviceDiscovery" I can list all
> But when I make "discoveryMode:
> BluetoothDiscoveryModel.FullServiceDiscovery" there is no result.
Using the above example/test setup above I was just able to create a connection between Android (running bttestui) and Linux/Bluez5 (running qml_chat)
P.S. I recommend enabling logging via
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
In your main().
More information about the Interest