[pulseaudio-discuss] [RFC v1 1/3] bluetooth: Replace deprecated ListAdapters()
Luiz Augusto von Dentz
luiz.dentz at gmail.com
Fri Jul 27 01:43:01 PDT 2012
Hi Mikel,
On Thu, Jul 26, 2012 at 1:36 PM, Mikel Astiz <mikel.astiz.oss at gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
>
> The method ListAdapters() in org.bluez.Manager was deprecated in BlueZ
> 4.61, and is going to be removed in future releases. Instead, a property
> was introduced for this purpose in BlueZ 4.22.
> ---
> src/modules/bluetooth/bluetooth-util.c | 107 ++++++++++++++++----------------
> 1 files changed, 54 insertions(+), 53 deletions(-)
>
> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
> index 778eecb..d3557ab 100644
> --- a/src/modules/bluetooth/bluetooth-util.c
> +++ b/src/modules/bluetooth/bluetooth-util.c
> @@ -75,6 +75,7 @@ struct pa_bluetooth_discovery {
>
> static void get_properties_reply(DBusPendingCall *pending, void *userdata);
> static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func, void *call_data);
> +static void found_adapter(pa_bluetooth_discovery *y, const char *path);
>
> pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value) {
> pa_assert(value);
> @@ -209,6 +210,46 @@ static const char *check_variant_property(DBusMessageIter *i) {
> return key;
> }
>
> +static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i) {
> + const char *key;
> + DBusMessageIter variant_i;
> +
> + pa_assert(y);
> +
> + key = check_variant_property(i);
> + if (key == NULL)
> + return -1;
> +
> + dbus_message_iter_recurse(i, &variant_i);
> +
> + switch (dbus_message_iter_get_arg_type(&variant_i)) {
> +
> + case DBUS_TYPE_ARRAY: {
> +
> + DBusMessageIter ai;
> + dbus_message_iter_recurse(&variant_i, &ai);
> +
> + if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_OBJECT_PATH &&
> + pa_streq(key, "Adapters")) {
I guess it is more efficient if you do pa_streq(key, "Adapters")
before dbus_message_iter_recurse.
--
Luiz Augusto von Dentz
More information about the pulseaudio-discuss
mailing list