Re: [PATCH BlueZ 1/4] core/gatt-client: Don't read extended properties

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

 



Hi,

On Fri, Apr 22, 2016 at 2:42 PM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> Extended properties are already read and stored in the database and can be
> retrieved with gatt_db_attribute_get_char_data.
> ---
>  src/gatt-client.c | 55 +++----------------------------------------------------
>  1 file changed, 3 insertions(+), 52 deletions(-)
>
> diff --git a/src/gatt-client.c b/src/gatt-client.c
> index ebb7b35..16a1f6c 100644
> --- a/src/gatt-client.c
> +++ b/src/gatt-client.c
> @@ -71,7 +71,6 @@ struct service {
>         bt_uuid_t uuid;
>         char *path;
>         struct queue *chrcs;
> -       struct queue *pending_ext_props;
>  };
>
>  struct characteristic {
> @@ -1283,7 +1282,8 @@ static struct characteristic *characteristic_create(
>
>         gatt_db_attribute_get_char_data(attr, &chrc->handle,
>                                                         &chrc->value_handle,
> -                                                       &chrc->props, NULL,
> +                                                       &chrc->props,
> +                                                       &chrc->ext_props,
>                                                         &uuid);
>
>         chrc->attr = gatt_db_get_attribute(service->client->db,
> @@ -1398,7 +1398,6 @@ static void service_free(void *data)
>         struct service *service = data;
>
>         queue_destroy(service->chrcs, NULL);  /* List should be empty here */
> -       queue_destroy(service->pending_ext_props, NULL);
>         g_free(service->path);
>         free(service);
>  }
> @@ -1412,7 +1411,6 @@ static struct service *service_create(struct gatt_db_attribute *attr,
>
>         service = new0(struct service, 1);
>         service->chrcs = queue_new();
> -       service->pending_ext_props = queue_new();
>         service->client = client;
>
>         gatt_db_attribute_get_service_data(attr, &service->start_handle,
> @@ -1484,44 +1482,6 @@ static void export_desc(struct gatt_db_attribute *attr, void *user_data)
>         queue_push_tail(charac->descs, desc);
>  }
>
> -static void read_ext_props_cb(bool success, uint8_t att_ecode,
> -                                       const uint8_t *value, uint16_t length,
> -                                       void *user_data)
> -{
> -       struct characteristic *chrc = user_data;
> -       struct service *service = chrc->service;
> -
> -       if (!success) {
> -               error("Failed to obtain extended properties - error: 0x%02x",
> -                                                               att_ecode);
> -               return;
> -       }
> -
> -       if (!value || length != 2) {
> -               error("Malformed extended properties value");
> -               return;
> -       }
> -
> -       chrc->ext_props = get_le16(value);
> -       if (chrc->ext_props)
> -               g_dbus_emit_property_changed(btd_get_dbus_connection(),
> -                                               chrc->path,
> -                                               GATT_CHARACTERISTIC_IFACE,
> -                                               "Flags");
> -
> -       queue_remove(service->pending_ext_props, chrc);
> -}
> -
> -static void read_ext_props(void *data, void *user_data)
> -{
> -       struct characteristic *chrc = data;
> -
> -       bt_gatt_client_read_value(chrc->service->client->gatt,
> -                                                       chrc->ext_props_handle,
> -                                                       read_ext_props_cb,
> -                                                       chrc, NULL);
> -}
> -
>  static bool create_descriptors(struct gatt_db_attribute *attr,
>                                         struct characteristic *charac)
>  {
> @@ -1555,9 +1515,6 @@ static void export_char(struct gatt_db_attribute *attr, void *user_data)
>
>         queue_push_tail(service->chrcs, charac);
>
> -       if (charac->ext_props_handle)
> -               queue_push_tail(service->pending_ext_props, charac);
> -
>         return;
>
>  fail:
> @@ -1574,13 +1531,7 @@ static bool create_characteristics(struct gatt_db_attribute *attr,
>
>         gatt_db_service_foreach_char(attr, export_char, &data);
>
> -       if (data.failed)
> -               return false;
> -
> -       /* Obtain extended properties */
> -       queue_foreach(service->pending_ext_props, read_ext_props, NULL);
> -
> -       return true;
> +       return !data.failed;
>  }
>
>  static void export_service(struct gatt_db_attribute *attr, void *user_data)
> --
> 2.5.5

Applied.


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