[pulseaudio-discuss] [RFC v2 10/15] bluetooth: Parse media transport's properties
João Paulo Rechi Vita
jprvita at gmail.com
Wed Apr 17 10:01:55 PDT 2013
On Tue, Apr 16, 2013 at 10:40 AM, Mikel Astiz <mikel.astiz.oss at gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
>
> Consider the media transport when a PropertiesChanged signal is
> received.
>
I'm not a native english-speaker, but this sentence seems a little
lost in the text to me. IMO just removing it makes the whole commit
message more concise and clear.
> Note that the transport might have an owner other than BlueZ, and thus
> the property changes would be emitted from arbitrary senders. For
> performance reasons, the installed match considers the interface name
> where the property has changed.
>
> It could be possible to install and remove the D-Bus matches dynamically
> when a new owner is registered/unregistered, but filtering based on the
> interface name seems good enough already.
> ---
> src/modules/bluetooth/bluetooth-util.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
> index 7e5604d..006f8cc 100644
> --- a/src/modules/bluetooth/bluetooth-util.c
> +++ b/src/modules/bluetooth/bluetooth-util.c
> @@ -1122,6 +1122,24 @@ static int transport_parse_property(pa_bluetooth_transport *t, DBusMessageIter *
> return 0;
> }
>
> +static int parse_transport_properties(pa_bluetooth_transport *t, DBusMessageIter *i) {
> + DBusMessageIter element_i;
> +
> + dbus_message_iter_recurse(i, &element_i);
> +
> + while (dbus_message_iter_get_arg_type(&element_i) == DBUS_TYPE_DICT_ENTRY) {
> + DBusMessageIter dict_i;
> +
> + dbus_message_iter_recurse(&element_i, &dict_i);
> +
> + transport_parse_property(t, &dict_i);
> +
> + dbus_message_iter_next(&element_i);
> + }
> +
> + return 0;
> +}
> +
> static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) {
> DBusError err;
> pa_bluetooth_discovery *y;
> @@ -1339,6 +1357,13 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
> return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* Device not being tracked */
>
> parse_device_properties(d, &arg_i, true);
> + } else if (pa_streq(interface, "org.bluez.MediaTransport1")) {
> + pa_bluetooth_transport *t;
> +
> + if (!(t = pa_hashmap_get(y->transports, dbus_message_get_path(m))))
> + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
> +
> + parse_transport_properties(t, &arg_i);
> }
>
> return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
> @@ -2034,6 +2059,8 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
> "type='signal',sender='org.bluez',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesRemoved'",
> "type='signal',sender='org.bluez',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
> ",arg0='org.bluez.Device1'",
> + "type='signal',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
> + ",arg0='org.bluez.MediaTransport1'",
> NULL) < 0) {
> pa_log("Failed to add D-Bus matches: %s", err.message);
> goto fail;
> --
> 1.8.1.4
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
--
João Paulo Rechi Vita
http://about.me/jprvita
More information about the pulseaudio-discuss
mailing list