Re: [PATCH BlueZ 5/8] transport: Add set_bcast_qos method

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

 



Hi Vlad,

On Tue, Aug 20, 2024 at 6:43 AM Vlad Pruteanu <vlad.pruteanu@xxxxxxx> wrote:
>
> This adds a set method for the QoS property of bcast transports.
> This is needed so that applications like bluetoothctl are able to
> modify the QoS (for example, for setting the broadcast code).
> ---
>  profiles/audio/transport.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
> index e8915490d..854b30601 100644
> --- a/profiles/audio/transport.c
> +++ b/profiles/audio/transport.c
> @@ -5,7 +5,7 @@
>   *
>   *  Copyright (C) 2006-2007  Nokia Corporation
>   *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@xxxxxxxxxxxx>
> - *  Copyright 2023 NXP
> + *  Copyright 2023-2024 NXP
>   *
>   *
>   */
> @@ -1208,13 +1208,42 @@ static gboolean qos_bcast_exists(const GDBusPropertyTable *property, void *data)
>         return bap->qos.bcast.io_qos.phy != 0x00;
>  }
>
> +static void set_bcast_qos(const GDBusPropertyTable *property,
> +                       DBusMessageIter *dict, GDBusPendingPropertySet id,
> +                       void *data)
> +{
> +       DBusMessageIter array, entry, value;
> +       struct media_transport *transport = data;
> +       struct bap_transport *bap = transport->data;
> +       struct bt_bap_qos *bap_qos = bt_bap_stream_get_qos(bap->stream);
> +       char *key, *str;
> +
> +       dbus_message_iter_recurse(dict, &array);
> +
> +       dbus_message_iter_recurse(&array, &entry);
> +       dbus_message_iter_get_basic(&entry, &key);
> +
> +       dbus_message_iter_next(&entry);
> +       dbus_message_iter_recurse(&entry, &value);
> +
> +       if (!strcasecmp(key, "BCode")) {
> +               dbus_message_iter_get_basic(&value, &str);

Hmm, isn't BCode a byte array? How come we are parsing as a string here?

> +               bap_qos->bcast.bcode = new0(struct iovec, 1);
> +               util_iov_append(bap_qos->bcast.bcode, str, strlen(str));
> +       }
> +
> +       bt_bap_stream_qos(bap->stream, bap_qos, NULL, NULL);
> +
> +       g_dbus_pending_property_success(id);
> +}
> +
>  static const GDBusPropertyTable transport_bap_bc_properties[] = {
>         { "Device", "o", get_device },
>         { "UUID", "s", get_uuid },
>         { "Codec", "y", get_codec },
>         { "Configuration", "ay", get_configuration },
>         { "State", "s", get_state },
> -       { "QoS", "a{sv}", get_bcast_qos, NULL, qos_bcast_exists },
> +       { "QoS", "a{sv}", get_bcast_qos, set_bcast_qos, qos_bcast_exists },
>         { "Endpoint", "o", get_endpoint, NULL, endpoint_exists },
>         { "Location", "u", get_location },
>         { "Metadata", "ay", get_metadata },
> --
> 2.40.1
>


-- 
Luiz Augusto von Dentz





[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