mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
minimal api to get uuid for handle
This commit is contained in:
parent
98fbd9a22e
commit
4eaba47858
11
ble/att.c
11
ble/att.c
@ -168,6 +168,7 @@ int att_iterator_match_uuid(att_iterator_t *it, uint8_t *uuid, uint16_t uuid_len
|
|||||||
|
|
||||||
|
|
||||||
int att_find_handle(att_iterator_t *it, uint16_t handle){
|
int att_find_handle(att_iterator_t *it, uint16_t handle){
|
||||||
|
if (handle == 0) return 0;
|
||||||
att_iterator_init(it);
|
att_iterator_init(it);
|
||||||
while (att_iterator_has_next(it)){
|
while (att_iterator_has_next(it)){
|
||||||
att_iterator_fetch_next(it);
|
att_iterator_fetch_next(it);
|
||||||
@ -177,6 +178,16 @@ int att_find_handle(att_iterator_t *it, uint16_t handle){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// experimental client API
|
||||||
|
uint16_t att_uuid_for_handle(uint16_t handle){
|
||||||
|
att_iterator_t it;
|
||||||
|
int ok = att_find_handle(&it, handle);
|
||||||
|
if (!ok) return 0;
|
||||||
|
if (it.flags & ATT_PROPERTY_UUID128) return 0;
|
||||||
|
return READ_BT_16(it.uuid, 0);
|
||||||
|
}
|
||||||
|
// end of client API
|
||||||
|
|
||||||
static void att_update_value_len(att_iterator_t *it){
|
static void att_update_value_len(att_iterator_t *it){
|
||||||
if ((it->flags & ATT_PROPERTY_DYNAMIC) == 0 || !att_read_callback) return;
|
if ((it->flags & ATT_PROPERTY_DYNAMIC) == 0 || !att_read_callback) return;
|
||||||
it->value_len = (*att_read_callback)(it->handle, 0, NULL, 0);
|
it->value_len = (*att_read_callback)(it->handle, 0, NULL, 0);
|
||||||
|
@ -229,6 +229,9 @@ uint16_t att_prepare_handle_value_indication(att_connection_t * att_connection,
|
|||||||
*/
|
*/
|
||||||
void att_clear_transaction_queue();
|
void att_clear_transaction_queue();
|
||||||
|
|
||||||
|
// experimental client API
|
||||||
|
uint16_t att_uuid_for_handle(uint16_t handle);
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user