Discussion:
[Interest] Multiple Qt Bluetooth Low Energy servers on one device using Qt?
Erik Botö
2018-11-01 07:11:55 UTC
Permalink
I want to expose multiple BLE services from one device using Qt (on linux),
but don't know how to do it if it's even possible.

In my specific case I want my device to be both a heart rate service (HRS)
and a cycling power service (CPS).

My testing code is very similar to the heart rate server example from Qt's
documentation,
http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and I've
tried the following two approaches:

1. Using two QLowEnergyControllers from one application
2. Using one QLowEnergyController, but adding two different services
using bleController->addService().

However it doesn't seems like either one is working properly.

Can this be done, and if so, what is the correct way?
Christian Kandeler
2018-11-01 09:56:57 UTC
Permalink
On Thu, 1 Nov 2018 08:11:55 +0100
Post by Erik Botö
I want to expose multiple BLE services from one device using Qt (on linux),
but don't know how to do it if it's even possible.
In my specific case I want my device to be both a heart rate service (HRS)
and a cycling power service (CPS).
My testing code is very similar to the heart rate server example from Qt's
documentation,
http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and I've
1. Using two QLowEnergyControllers from one application
AFAIK, a QLowEnergyController instance represents a device, so I don't think this is possible (unless you address two distinct BLE devices).
Post by Erik Botö
2. Using one QLowEnergyController, but adding two different services
using bleController->addService().
That should work.
Post by Erik Botö
However it doesn't seems like either one is working properly.
You'll have to be more specific than that.


Christian
Erik Botö
2018-11-01 15:45:22 UTC
Permalink
Post by Christian Kandeler
On Thu, 1 Nov 2018 08:11:55 +0100
Post by Erik Botö
I want to expose multiple BLE services from one device using Qt (on
linux),
Post by Erik Botö
but don't know how to do it if it's even possible.
In my specific case I want my device to be both a heart rate service
(HRS)
Post by Erik Botö
and a cycling power service (CPS).
My testing code is very similar to the heart rate server example from
Qt's
Post by Erik Botö
documentation,
http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and
I've
Post by Erik Botö
1. Using two QLowEnergyControllers from one application
AFAIK, a QLowEnergyController instance represents a device, so I don't
think this is possible (unless you address two distinct BLE devices).
Post by Erik Botö
2. Using one QLowEnergyController, but adding two different services
using bleController->addService().
That should work.
Post by Erik Botö
However it doesn't seems like either one is working properly.
You'll have to be more specific than that.
So I figured I might as well turn it in to a minimalistic example to show
the problem, and of course it turns out it works. The "fun" thing is that I
actually played around with this a year ago but never got it working, even
when trying a minimal example. But that code is long gone, but obviously it
had a bug in it since I only got updates for one of the services back then.

Thanks for pointing out it should work, which made me have another go at it.

Cheers,
Erik
Post by Christian Kandeler
Christian
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Loading...