[pulseaudio-discuss] [RFCv0 10/21] bluetooth: List HandsfreeAudioCard objects from oFono

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu May 29 03:16:32 PDT 2014


On Tue, 2014-02-04 at 19:03 -0300, jprvita at gmail.com wrote:
> +static void hf_audio_agent_get_cards_reply(DBusPendingCall *pending, void *userdata) {
> +    DBusMessage *r;
> +    pa_dbus_pending *p;
> +    hf_audio_agent_data *hfdata;
> +    DBusMessageIter i, array_i, struct_i, props_i;
> +    char c;
> +
> +    pa_assert_se(p = userdata);
> +    pa_assert_se(hfdata = p->context_data);
> +    pa_assert_se(r = dbus_pending_call_steal_reply(pending));
> +
> +    if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) {
> +        pa_log_error("Failed to get a list of handsfree audio cards from ofono: %s: %s",
> +                     dbus_message_get_error_name(r), pa_dbus_get_error_message(r));
> +        goto finish;
> +    }
> +
> +    dbus_message_iter_init(r, &i);
> +    if ((c = dbus_message_iter_get_arg_type(&i)) != DBUS_TYPE_ARRAY) {
> +        pa_log_error("Invalid arguments in GetCards() reply: expected \'a\', received \'%c\'", c);

Instead of checking every argument separately, it's simpler to just
check the message signature.

-- 
Tanu



More information about the pulseaudio-discuss mailing list