Open Source Telephony
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: ofono@ofono.org
Subject: Re: [PATCH 07/13] dundee: Listen to devices property changes
Date: Mon, 11 Mar 2013 18:17:52 +0100	[thread overview]
Message-ID: <513E11C0.40304@monom.org> (raw)
In-Reply-To: <1362425590-26075-8-git-send-email-paulo.borges@openbossa.org>

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

Hi Paulo,

On 03/04/2013 08:33 PM, Paulo Borges wrote:
> When a bluetooth device property change and this property is Alias
> or UUIDs, we need to refresh our representation of this device.
> ---
>   dundee/bluez5.c |   26 +++++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/dundee/bluez5.c b/dundee/bluez5.c
> index 8d8e656..623201f 100644
> --- a/dundee/bluez5.c
> +++ b/dundee/bluez5.c
> @@ -169,11 +169,35 @@ static void property_changed(GDBusProxy *proxy, const char *name,
>   {
>   	const char *path = g_dbus_proxy_get_path(proxy);
>   	const char *interface = g_dbus_proxy_get_interface(proxy);
> +	const char *alias;
> +	struct bluetooth_device *bt_device;
> +	gboolean uuid;
>
>   	if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface) == FALSE)
>   		return;
>
> -	DBG("%s %s.%s", path, interface, name);
> +	bt_device = g_hash_table_lookup(registered_devices, path);
> +
> +	if (g_str_equal(name, "Alias") == TRUE) {
> +		if (bt_device == NULL)
> +			return;
> +
> +		dbus_message_iter_get_basic(iter, &alias);
> +
> +		DBG("%s alias changed: %s", path, alias);
> +
> +		bt_device->name = g_strdup(alias);
> +	} else if (g_str_equal(name, "UUIDs") == TRUE) {
> +		DBG("%s uuids changed", path);
> +
> +		uuid = has_dun_uuid(iter);
> +
> +		if (bt_device != NULL && uuid == FALSE)
> +			bluetooth_device_unregister(path);
> +
> +		else if (bt_device == NULL && uuid == TRUE)
> +			bluetooth_device_register(proxy);
> +	}

I find this a bit hard to read. What about

	if (uuid)
		if (bt_device != NULL)
			bluetooth_device_unregister(path);
	else
		if (bt_device == NULL)
			bluetooth_device_regster(path);

? I am not sure if Denis or Marcel approves this :)

cheers,
daniel


  reply	other threads:[~2013-03-11 17:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 19:33 [PATCH 00/13] Add support for BlueZ 5 Profile1 API to dundee Paulo Borges
2013-03-04 19:33 ` [PATCH 01/13] dundee: Rename dundee BlueZ 4 support Paulo Borges
2013-03-04 19:33 ` [PATCH 02/13] dundee: Start BlueZ 5 support Paulo Borges
2013-03-11 17:01   ` Daniel Wagner
2013-03-04 19:33 ` [PATCH 03/13] bluez5: Add DUN_UUID Paulo Borges
2013-03-04 19:33 ` [PATCH 04/13] dundee: Initial GDBusClient for BlueZ 5 Paulo Borges
2013-03-11 17:08   ` Daniel Wagner
2013-03-04 19:33 ` [PATCH 05/13] dundee: Add mechanism to store bluetooth devices Paulo Borges
2013-03-04 19:33 ` [PATCH 06/13] dundee: Add tracking of " Paulo Borges
2013-03-04 19:33 ` [PATCH 07/13] dundee: Listen to devices property changes Paulo Borges
2013-03-11 17:17   ` Daniel Wagner [this message]
2013-03-12  9:56     ` Daniel Wagner
2013-03-04 19:33 ` [PATCH 08/13] dundee: Add dundee device driver skeleton Paulo Borges
2013-03-04 19:33 ` [PATCH 09/13] dundee: Register/unregister dundee device Paulo Borges
2013-03-04 19:37 ` [PATCH 10/13] dundee: Add BlueZ Profile handler Paulo Borges
2013-03-04 19:38 ` [PATCH 11/13] dundee: Add support for driver connect Paulo Borges
2013-03-04 19:38 ` [PATCH 12/13] dundee: Add dundee disconnect function Paulo Borges
2013-03-04 19:39 ` [PATCH 13/13] dundee: Handle Profile connect and disconnect Paulo Borges
2013-03-11 17:23 ` [PATCH 00/13] Add support for BlueZ 5 Profile1 API to dundee Daniel Wagner
2013-03-11 20:41   ` Paulo Borges
2013-03-14 13:32 ` [PATCH v2 " Paulo Borges
2013-03-14 13:32   ` [PATCH v2 01/13] dundee: Rename dundee BlueZ 4 support Paulo Borges
2013-03-14 13:32   ` [PATCH v2 02/13] dundee: Start BlueZ 5 support Paulo Borges
2013-03-14 13:32   ` [PATCH v2 03/13] bluez5: Add DUN_UUID Paulo Borges
2013-03-14 13:32   ` [PATCH v2 04/13] dundee: Initial GDBusClient for BlueZ 5 Paulo Borges
2013-03-14 13:32   ` [PATCH v2 05/13] dundee: Add mechanism to store bluetooth devices Paulo Borges
2013-03-14 13:32   ` [PATCH v2 06/13] dundee: Add tracking of " Paulo Borges
2013-03-14 13:32   ` [PATCH v2 07/13] dundee: Listen to devices property changes Paulo Borges
2013-03-19 21:10     ` Daniel Wagner
2013-03-14 13:32   ` [PATCH v2 08/13] dundee: Add dundee device driver skeleton Paulo Borges
2013-03-14 13:32   ` [PATCH v2 09/13] dundee: Register/unregister dundee device Paulo Borges
2013-03-14 13:32   ` [PATCH v2 10/13] dundee: Add BlueZ Profile handler Paulo Borges
2013-03-14 13:32   ` [PATCH v2 11/13] dundee: Add support for driver connect Paulo Borges
2013-03-18  8:38     ` Daniel Wagner
2013-03-14 13:32   ` [PATCH v2 12/13] dundee: Add dundee disconnect function Paulo Borges
2013-03-14 13:32   ` [PATCH v2 13/13] dundee: Handle Profile connect and disconnect Paulo Borges
2013-03-18  9:55   ` [PATCH v2 00/13] Add support for BlueZ 5 Profile1 API to dundee Daniel Wagner
2013-03-19 17:11     ` Vinicius Costa Gomes
2013-03-20 22:26 ` [PATCH v3 " Paulo Borges
2013-03-20 22:26   ` [PATCH v3 01/13] dundee: Rename dundee BlueZ 4 support Paulo Borges
2013-03-20 22:26   ` [PATCH v3 02/13] dundee: Start BlueZ 5 support Paulo Borges
2013-03-20 22:26   ` [PATCH v3 03/13] bluez5: Add DUN_UUID Paulo Borges
2013-03-20 22:26   ` [PATCH v3 04/13] dundee: Initial GDBusClient for BlueZ 5 Paulo Borges
2013-03-20 22:26   ` [PATCH v3 05/13] dundee: Add mechanism to store bluetooth devices Paulo Borges
2013-03-20 22:26   ` [PATCH v3 06/13] dundee: Add tracking of " Paulo Borges
2013-03-20 22:26   ` [PATCH v3 07/13] dundee: Listen to devices property changes Paulo Borges
2013-03-20 22:26   ` [PATCH v3 08/13] dundee: Add dundee device driver skeleton Paulo Borges
2013-03-20 22:26   ` [PATCH v3 09/13] dundee: Register/unregister dundee device Paulo Borges
2013-03-20 22:26   ` [PATCH v3 10/13] dundee: Add BlueZ Profile handler Paulo Borges
2013-03-20 22:26   ` [PATCH v3 11/13] dundee: Add support for driver connect Paulo Borges
2013-03-20 22:26   ` [PATCH v3 12/13] dundee: Add dundee disconnect function Paulo Borges
2013-03-20 22:26   ` [PATCH v3 13/13] dundee: Handle Profile connect and disconnect Paulo Borges
2013-03-24 12:31   ` [PATCH v3 00/13] Add support for BlueZ 5 Profile1 API to dundee Daniel Wagner
2013-03-25 14:43     ` Paulo Borges
2013-04-02 13:12       ` Daniel Wagner

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=513E11C0.40304@monom.org \
    --to=wagi@monom.org \
    --cc=ofono@ofono.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