Re: [PATCH v1] shared/gatt: Use iterator based discovery result structure.

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

 



Hi Arman,

> This patch changes the GATT specific linked list structure in gatt-helpers to
> bt_gatt_result and bt_gatt_iter. bt_gatt_result internally stores a linked list
> of ATT response PDUs, which get decoded on-demand by the iterator functions.
> Each iterator function operates on a specific ATT response PDU.
> ---
> src/shared/gatt-helpers.c | 574 +++++++++++++++++++++++-----------------------
> src/shared/gatt-helpers.h |  21 +-
> 2 files changed, 306 insertions(+), 289 deletions(-)

patch has been applied.

<snip>

> -struct bt_gatt_list;
> +struct bt_gatt_result;
> 
> -struct bt_gatt_list *bt_gatt_list_get_next(struct bt_gatt_list *l);
> -void *bt_gatt_list_get_data(struct bt_gatt_list *l);
> +struct bt_gatt_iter {
> +	struct bt_gatt_result *result;
> +	uint16_t pos;
> +};
> +
> +bool bt_gatt_iter_init(struct bt_gatt_iter *iter, struct bt_gatt_result *result);
> +bool bt_gatt_iter_next_service(struct bt_gatt_iter *iter,
> +					struct bt_gatt_service *service);

One option here is to not bother with the interim struct bt_gatt_service. Especially since I think we will need that actually for an higher abstraction at some point.

	bool bt_gatt_iter_next_service(struct bt_gatt_iter *iter,
					uint16_t *start_handle,
					uint16_t *end_handle,
					uint8_t *uuid[16]);

> +bool bt_gatt_iter_next_characteristic(struct bt_gatt_iter *iter,
> +				struct bt_gatt_characteristic *characteristic);
> +bool bt_gatt_iter_next_descriptor(struct bt_gatt_iter *iter,
> +					struct bt_gatt_descriptor *descriptor);
> 
> typedef void (*bt_gatt_destroy_func_t)(void *user_data);
> 
> typedef void (*bt_gatt_result_callback_t)(bool success, uint8_t att_ecode,
> 							void *user_data);
> -typedef void (*bt_gatt_discovery_callback_t)(bool success, uint8_t att_ecode,
> -						struct bt_gatt_list *results,
> +typedef void (*bt_gatt_discovery_callback_t)(bool success, uint8_t att_code,
> +						struct bt_gatt_result *result,
> 						void *user_data);

It might be a good idea to shrink this to results + user_data. We could retrieve the ATT error code and general success status from bt_gatt_result pointer we give the callback function.

Regards

Marcel

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