Re: [RFC v1 03/16] manager: Extend FindAdapter with "default" pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mikel,

On Thu, Nov 15, 2012 at 5:09 PM, Mikel Astiz <mikel.astiz.oss@xxxxxxxxx> wrote:
> From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>
>
> Extend the supported values in the given pattern in order to return the
> default adapter if "default" is given.
> ---
>  doc/manager-api.txt | 1 +
>  src/manager.c       | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/doc/manager-api.txt b/doc/manager-api.txt
> index 8497141..b0d534d 100644
> --- a/doc/manager-api.txt
> +++ b/doc/manager-api.txt
> @@ -27,6 +27,7 @@ Object path   /
>                         patterns are "hci0" or "00:11:22:33:44:55". Other
>                         supported values are:
>                                 "any"
> +                               "default"
>
>                         Possible errors: org.bluez.Error.InvalidArguments
>                                          org.bluez.Error.NoSuchAdapter
> diff --git a/src/manager.c b/src/manager.c
> index 3088dd9..79d049b 100644
> --- a/src/manager.c
> +++ b/src/manager.c
> @@ -110,7 +110,9 @@ static DBusMessage *find_adapter(DBusConnection *conn,
>         } else if (!strncmp(pattern, "hci", 3) && strlen(pattern) >= 4) {
>                 dev_id = atoi(pattern + 3);
>                 adapter = manager_find_adapter_by_id(dev_id);
> -       } else {
> +       } else if (!strcmp(pattern, "default"))
> +               adapter = manager_find_adapter_by_id(default_adapter_id);
> +       else {
>                 bdaddr_t bdaddr;
>                 str2ba(pattern, &bdaddr);
>                 adapter = manager_find_adapter(&bdaddr);
> --
> 1.7.11.7

Hmm, I though we would have a property e.g. DefaultAdapter because
with ObjectManager you also get the properties so once you do
GetManagedObjects you discover what is the default one. It could also
be a property of the Adapter interface e.g. boolean Default but if it
changes we actually have to emit 2 signals so it would no be an atomic
operation as it should be.


--
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux