Hi Daniel, On Thu, Oct 1, 2020 at 4:07 PM Daniel Winkler <danielwinkler@xxxxxxxxxx> wrote: > > To help our advertising clients understand the device capabilities, this > patch adds a SupportedCapabilities dbus endpoint for the advertising > manager. The primary reason behind this is to provide the valid LE tx > power range the controller supports (populated if controller supports > BT5), so a client can know the valid power range before requesting a tx > power for their advertisement. > > I also thought it would be useful to indicate the max advertising data > length and scan response length in this endpoint, since some clients > will find it useful to set their advertising data (currently > experimental feature) or scan response data (possible future feature) > directly. > > This patch has been tested on Hatch (BT5 support) and Kukui (No BT5 > support) chromebooks to verify that the dbus endpoint contains the > correct data. > > Reviewed-by: Sonny Sasaka <sonnysasaka@xxxxxxxxxxxx> > Reviewed-by: Alain Michaud <alainm@xxxxxxxxxxxx> > --- > > Changes in v4: None > Changes in v3: None > Changes in v2: None > > src/advertising.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/src/advertising.c b/src/advertising.c > index 41d0658c8..f76831594 100644 > --- a/src/advertising.c > +++ b/src/advertising.c > @@ -1619,12 +1619,46 @@ static gboolean get_supported_secondary(const GDBusPropertyTable *property, > return TRUE; > } > > +static gboolean get_supported_cap(const GDBusPropertyTable *property, > + DBusMessageIter *iter, void *data) > +{ > + struct btd_adv_manager *manager = data; > + DBusMessageIter dict; > + int16_t min_tx_power = manager->min_tx_power; > + int16_t max_tx_power = manager->max_tx_power; > + > + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, > + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING > + DBUS_TYPE_STRING_AS_STRING > + DBUS_TYPE_VARIANT_AS_STRING > + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, > + &dict); > + > + if (min_tx_power != ADV_TX_POWER_NO_PREFERENCE) > + dict_append_entry(&dict, "MinTxPower", DBUS_TYPE_INT16, > + &min_tx_power); > + > + if (max_tx_power != ADV_TX_POWER_NO_PREFERENCE) > + dict_append_entry(&dict, "MaxTxPower", DBUS_TYPE_INT16, > + &max_tx_power); > + > + dict_append_entry(&dict, "MaxAdvLen", DBUS_TYPE_BYTE, > + &manager->max_adv_len); > + dict_append_entry(&dict, "MaxScnRspLen", DBUS_TYPE_BYTE, > + &manager->max_scan_rsp_len); > + > + dbus_message_iter_close_container(iter, &dict); > + > + return TRUE; > +} > + > static const GDBusPropertyTable properties[] = { > { "ActiveInstances", "y", get_active_instances, NULL, NULL }, > { "SupportedInstances", "y", get_instances, NULL, NULL }, > { "SupportedIncludes", "as", get_supported_includes, NULL, NULL }, > { "SupportedSecondaryChannels", "as", get_supported_secondary, NULL, > secondary_exits }, > + { "SupportedCapabilities", "a{sv}", get_supported_cap, NULL, NULL}, Lets mark this as experimental for now. > { } > }; > > -- > 2.28.0.709.gb0816b6eb0-goog > -- Luiz Augusto von Dentz