All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Mihai Emilian <be.mihai22@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: How to receive notifications after calling StartNotify
Date: Sun, 21 Feb 2021 15:47:02 -0800	[thread overview]
Message-ID: <CABBYNZ+qMec0KbGx4Gfjb5yygXYzxz5WESReo3FS3_WNuqw1UA@mail.gmail.com> (raw)
In-Reply-To: <CAP_L5iP4vuasHk6qF4KYrPUwE33n3NVzwA28E559bykM9+GnOw@mail.gmail.com>

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

      reply	other threads:[~2021-02-21 23:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-21 17:09 How to receive notifications after calling StartNotify Mihai Emilian
2021-02-21 23:47 ` Luiz Augusto von Dentz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABBYNZ+qMec0KbGx4Gfjb5yygXYzxz5WESReo3FS3_WNuqw1UA@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=be.mihai22@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.