linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: Arik Nemtsov <arik@wizery.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 8/8] proximity: reporter: implement D-Bus API
Date: Wed, 14 Mar 2012 09:19:34 -0400	[thread overview]
Message-ID: <CAJdJm_PKA2eCSHDin6WLj4xTCONuURYfMkyBAeu=T1Sd74vBwQ@mail.gmail.com> (raw)
In-Reply-To: <1331215032-27695-9-git-send-email-arik@wizery.com>

Hi Arik,

On Thu, Mar 8, 2012 at 9:57 AM, Arik Nemtsov <arik@wizery.com> wrote:
>  int reporter_init(struct btd_adapter *adapter)
>  {
> +       struct reporter_adapter *radapter;
> +       DBusConnection *conn;
> +
>        if (!main_opts.attrib_server) {
>                DBG("Attribute server is disabled");
>                return -1;
>        }
>
> -       connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
> -       if (connection == NULL)
> -               return -EIO;
> -       DBG("Proximity Reporter for adapter %p", adapter);
> +       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
> +       if (!conn)
> +               return -1;
>
> -       register_link_loss(adapter, connection);
> +       radapter = g_new0(struct reporter_adapter, 1);
> +       radapter->adapter = adapter;
> +       radapter->conn = conn;
> +
> +       register_link_loss(adapter, radapter->conn);
>        register_tx_power(adapter);
> -       register_imm_alert(adapter, connection);
> +       register_imm_alert(adapter, radapter->conn);
> +
> +       /*
> +        * Register watches for getting device change events. We watch
> +        * for existing, new and removed devices.
> +        */
> +       radapter->watch_added = g_dbus_add_signal_watch(radapter->conn,
> +                                       BLUEZ_SERVICE, NULL, ADAPTER_INTERFACE,
> +                                       "DeviceAdded", handle_device_change,
> +                                       radapter, NULL);
> +
> +       radapter->watch_created = g_dbus_add_signal_watch(radapter->conn,
> +                                       BLUEZ_SERVICE, NULL, ADAPTER_INTERFACE,
> +                                       "DeviceCreated", handle_device_change,
> +                                       radapter, NULL);
> +
> +       radapter->watch_removed = g_dbus_add_signal_watch(radapter->conn,
> +                                       BLUEZ_SERVICE, NULL, ADAPTER_INTERFACE,
> +                                       "DeviceRemoved", handle_device_change,
> +                                       radapter, NULL);

Again, setting a watcher for BlueZ own signals is strange. Why can't
you use a device driver like other plugins?

> +
> +       reporter_adapters = g_slist_prepend(reporter_adapters, radapter);
> +       DBG("Proximity Reporter for adapter %p", adapter);
>
>        return 0;
>  }

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

  reply	other threads:[~2012-03-14 13:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 13:57 [PATCH 0/8] Implement ProximityReporter profiles Arik Nemtsov
2012-03-08 13:57 ` [PATCH 1/8] att: add remote btd_device to ATT read/write callbacks Arik Nemtsov
2012-03-08 13:57 ` [PATCH 2/8] adapter: add API to find an existing device by D-Bus path Arik Nemtsov
2012-03-08 13:57 ` [PATCH 3/8] adapter: add DeviceAdded signal when existing device is added Arik Nemtsov
2012-03-08 13:57 ` [PATCH 4/8] proximity: reporter: save global D-Bus connection Arik Nemtsov
2012-03-08 13:57 ` [PATCH 5/8] proximity: reporter: move definitions to .h and add util function Arik Nemtsov
2012-03-08 13:57 ` [PATCH 6/8] proximity: link loss: implement link loss server Arik Nemtsov
2012-03-14 13:09   ` Anderson Lizardo
2012-03-14 20:54     ` Arik Nemtsov
2012-03-08 13:57 ` [PATCH 7/8] proximity: immediate alert: implement immediate alert server Arik Nemtsov
2012-03-08 13:57 ` [PATCH 8/8] proximity: reporter: implement D-Bus API Arik Nemtsov
2012-03-14 13:19   ` Anderson Lizardo [this message]
2012-03-14 20:56     ` Arik Nemtsov

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='CAJdJm_PKA2eCSHDin6WLj4xTCONuURYfMkyBAeu=T1Sd74vBwQ@mail.gmail.com' \
    --to=anderson.lizardo@openbossa.org \
    --cc=arik@wizery.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).