Message ID | 20240820103918.24246-6-vlad.pruteanu@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add support for setting bcode on bcast sink | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
Hi Vlad, On Tue, Aug 20, 2024 at 6:43 AM Vlad Pruteanu <vlad.pruteanu@nxp.com> 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@holtmann.org> > - * 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 >
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@holtmann.org> - * 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); + 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 },