Re: [PATCH BlueZ 17/17] core: gatt: Don't export claimed services

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

 



Hi Arman,

On Fri, Dec 19, 2014 at 7:36 PM, Arman Uguray <armansito@xxxxxxxxxxxx> wrote:
> GattService1 objects for services which are claimed by an internal
> profile are no longer exported. This is to prevent conflicts that
> may arise between internal plugins and external applications that
> wish to access the same GATT service.
>
> This is at least until there is a better system for managing external
> claims on GATT services and all remote profiles have been switched to
> shared/gatt, which prevents some of the conflicts that may arise from
> writes to CCC descriptors.

I was thinking that we could use gatt_db_service_set_active if it
succeed on probing but for that to work we might have to add
gatt_db_service_get_active or make gatt_db_foreach_service ignore
services not active.

> ---
>  src/gatt-client.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/src/gatt-client.c b/src/gatt-client.c
> index 16a3b3b..4f44516 100644
> --- a/src/gatt-client.c
> +++ b/src/gatt-client.c
> @@ -1772,11 +1772,36 @@ static gboolean set_chrcs_ready(gpointer user_data)
>         return FALSE;
>  }
>
> +static bool is_service_claimed(struct btd_device *dev,
> +                                               struct gatt_db_attribute *attr)
> +{
> +       uint16_t start, end;
> +       bt_uuid_t uuid;
> +       char uuid_str[MAX_LEN_UUID_STR];
> +
> +       if (!gatt_db_attribute_get_service_data(attr, &start, &end, NULL,
> +                                                                       &uuid))
> +               return false;
> +
> +       bt_uuid_to_string(&uuid, uuid_str, sizeof(uuid_str));
> +
> +       return !!btd_device_get_gatt_service(dev, uuid_str, start, end);
> +}
> +
>  static void export_service(struct gatt_db_attribute *attr, void *user_data)
>  {
>         struct btd_gatt_client *client = user_data;
>         struct service *service;
>
> +       /*
> +        * Check if a profile claimed this service and don't export it
> +        * otherwise.
> +        */
> +       if (is_service_claimed(client->device, attr)) {
> +               DBG("GATT service already claimed by an internal profile");
> +               return;
> +       }
> +
>         service = service_create(attr, client);
>         if (!service)
>                 return;
> --
> 2.2.0.rc0.207.ga3a616c
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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