2019-03-17 07:51:41

by Ordit Gross

[permalink] [raw]
Subject: supporting both btgatt-client and btgatt-server in application

hi all,
We have an application that should support both btgatt-client and
btgatt-server (connecting to different devices for different
workflows), using bluez.

1. Should I create a single mainloop that will be used by both or
should I create two different mainloop_run? (thought of have porting
the mainloop code to c++ and change it to be class element)

2. Regarding the btgatt-client, how can I initiate a disconnect? (I
looked in the btgatt-client.c test application and did not see an
initiation of disconnect).

thanks in advance! (hope I sent the message to right mailing list.. )


2019-03-17 08:33:26

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: supporting both btgatt-client and btgatt-server in application

Hi Ordit,
On Sun, Mar 17, 2019 at 9:54 AM Ordit Gross <[email protected]> wrote:
>
> hi all,
> We have an application that should support both btgatt-client and
> btgatt-server (connecting to different devices for different
> workflows), using bluez.
>
> 1. Should I create a single mainloop that will be used by both or
> should I create two different mainloop_run? (thought of have porting
> the mainloop code to c++ and change it to be class element)
>
> 2. Regarding the btgatt-client, how can I initiate a disconnect? (I
> looked in the btgatt-client.c test application and did not see an
> initiation of disconnect).
>
> thanks in advance! (hope I sent the message to right mailing list.. )

Take a look at bluetoothctl, it can actually act as both Client and
Server at the same time with just a single mainloop, you can check how
to disconnect using disconnect command.


--
Luiz Augusto von Dentz