All of lore.kernel.org
 help / color / mirror / Atom feed
* How to receive notifications after calling StartNotify
@ 2021-02-21 17:09 Mihai Emilian
  2021-02-21 23:47 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Mihai Emilian @ 2021-02-21 17:09 UTC (permalink / raw)
  To: linux-bluetooth

Dear linux-bluetooth community,

I am writing a bluetooth client in C which receives notifications from
a bluetooth device (server). I am able to call StartNotify() from the
bluez api and the Notifying property changes to true. However, I am
not sure how I should listen for the notifications, or where.

There are several questions:
a) How do I provide a callback function to this?
b) async or sync method call? Does it matter?
c) Do I need the main loop to do this and why?

Here's my source code https://pastebin.com/KEGTatsL

Is there an example? I tried looking at the different files such as
client in bluez kernel source and gatttool source, but I couldn't
figure this out.

Many thanks,
Regards,
Mihai

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to receive notifications after calling StartNotify
  2021-02-21 17:09 How to receive notifications after calling StartNotify Mihai Emilian
@ 2021-02-21 23:47 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2021-02-21 23:47 UTC (permalink / raw)
  To: Mihai Emilian; +Cc: linux-bluetooth

Hi Mihai,

On Sun, Feb 21, 2021 at 9:13 AM Mihai Emilian <be.mihai22@gmail.com> wrote:
>
> Dear linux-bluetooth community,
>
> I am writing a bluetooth client in C which receives notifications from
> a bluetooth device (server). I am able to call StartNotify() from the
> bluez api and the Notifying property changes to true. However, I am
> not sure how I should listen for the notifications, or where.
>
> There are several questions:
> a) How do I provide a callback function to this?
> b) async or sync method call? Does it matter?
> c) Do I need the main loop to do this and why?

You will need to subscribe for signals, e.g. using g_signal_connect:

https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gio/GDBusProxy.html

Signals are async so typically that would be handled by a mainloop.

> Here's my source code https://pastebin.com/KEGTatsL
>
> Is there an example? I tried looking at the different files such as
> client in bluez kernel source and gatttool source, but I couldn't
> figure this out.
>
> Many thanks,
> Regards,
> Mihai



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-21 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-21 17:09 How to receive notifications after calling StartNotify Mihai Emilian
2021-02-21 23:47 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.