Re: [PATCH BlueZ] ManufacturerData field added to ScanResponse

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

 



Hi Thorsten,

On Fri, Apr 3, 2020 at 12:42 AM Klein, Thorsten (BSH)
<kleinkastel@xxxxxxxxxxxxxx> wrote:
>
> From: "Schachschal, Maximilian (BSH)" <maximilian.schachschal@xxxxxxxx>
>
> Keys are the Manufacturer ID to associate with the data.
> ---
>  doc/advertising-api.txt |  6 ++++++
>  src/advertising.c       | 25 +++++++++++++++++++------
>  2 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/doc/advertising-api.txt b/doc/advertising-api.txt
> index b0565ea..14ccae2 100644
> --- a/doc/advertising-api.txt
> +++ b/doc/advertising-api.txt
> @@ -51,6 +51,12 @@ Properties   string Type
>                         the Advertising Data.  Keys are the Manufacturer ID
>                         to associate with the data.
>
> +               dict ManufacturerDataScanResponse [Experimental]
> +
> +                       Manufactuer Data fields to include in
> +                       the Scan Response.  Keys are the Manufacturer ID
> +                       to associate with the data.
> +

Don't really like to do this, beside it seems to be optional to enter
either on AD or on SRD so the scanner is really at fault here if it
only able to parse the data if placed on SRD, that said we could have
some logic that detects if manufacturer don't fit on the AD push it to
SRD if that has more space if the advertisement is discoverable.

>                 array{string} SolicitUUIDs
>
>                         Array of UUIDs to include in "Service Solicitation"
> diff --git a/src/advertising.c b/src/advertising.c
> index 45ff19f..0e1a3f1 100644
> --- a/src/advertising.c
> +++ b/src/advertising.c
> @@ -328,12 +328,12 @@ fail:
>  }
>
>  static bool parse_manufacturer_data(DBusMessageIter *iter,
> -                                       struct btd_adv_client *client)
> +                                       struct btd_ad *ad)
>  {
>         DBusMessageIter entries;
>
>         if (!iter) {
> -               bt_ad_clear_manufacturer_data(client->data);
> +               bt_ad_clear_manufacturer_data(ad);
>                 return true;
>         }
>
> @@ -342,7 +342,7 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,
>
>         dbus_message_iter_recurse(iter, &entries);
>
> -       bt_ad_clear_manufacturer_data(client->data);
> +       bt_ad_clear_manufacturer_data(ad);
>
>         while (dbus_message_iter_get_arg_type(&entries)
>                                                 == DBUS_TYPE_DICT_ENTRY) {
> @@ -373,7 +373,7 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,
>
>                 DBG("Adding ManufacturerData for %04x", manuf_id);
>
> -               if (!bt_ad_add_manufacturer_data(client->data, manuf_id,
> +               if (!bt_ad_add_manufacturer_data(ad, manuf_id,
>                                                         manuf_data, len))
>                         goto fail;
>
> @@ -383,10 +383,22 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,
>         return true;
>
>  fail:
> -       bt_ad_clear_manufacturer_data(client->data);
> +       bt_ad_clear_manufacturer_data(ad);
>         return false;
>  }
>
> +static bool parse_manufacturer_data_adv(DBusMessageIter *iter,
> +                                       struct btd_adv_client *client)
> +{
> +       return parse_manufacturer_data(iter, client->data);
> +}
> +
> +static bool parse_manufacturer_data_scan(DBusMessageIter *iter,
> +                                       struct btd_adv_client *client)
> +{
> +       return parse_manufacturer_data(iter, client->scan);
> +}
> +
>  static bool parse_service_data(DBusMessageIter *iter,
>                                         struct btd_adv_client *client)
>  {
> @@ -941,7 +953,8 @@ static struct adv_parser {
>         { "Type", parse_type },
>         { "ServiceUUIDs", parse_service_uuids },
>         { "SolicitUUIDs", parse_solicit_uuids },
> -       { "ManufacturerData", parse_manufacturer_data },
> +       { "ManufacturerData", parse_manufacturer_data_adv },
> +       { "ManufacturerDataScanResponse", parse_manufacturer_data_scan },
>         { "ServiceData", parse_service_data },
>         { "Includes", parse_includes },
>         { "LocalName", parse_local_name },
> --
> 2.7.4
>


-- 
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