mirror of https://github.com/labapart/gattlib
Merge pull request #32 from mweal-ed/get_uuid_from_handle
get_uuid_from_handle returns wrong uuid #30 fixpull/33/head
commit
8e159b683d
|
@ -52,7 +52,7 @@ static void events_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
|
||||||
gatt_connection_t *conn = user_data;
|
gatt_connection_t *conn = user_data;
|
||||||
uint8_t opdu[ATT_MAX_MTU];
|
uint8_t opdu[ATT_MAX_MTU];
|
||||||
uint16_t handle, olen = 0;
|
uint16_t handle, olen = 0;
|
||||||
uuid_t uuid;
|
uuid_t uuid = {};
|
||||||
|
|
||||||
#if BLUEZ_VERSION_MAJOR == 4
|
#if BLUEZ_VERSION_MAJOR == 4
|
||||||
handle = att_get_u16(&pdu[1]);
|
handle = att_get_u16(&pdu[1]);
|
||||||
|
@ -448,12 +448,6 @@ int get_uuid_from_handle(gatt_connection_t* connection, uint16_t handle, uuid_t*
|
||||||
memcpy(uuid, &conn_context->characteristics[i].uuid, sizeof(uuid_t));
|
memcpy(uuid, &conn_context->characteristics[i].uuid, sizeof(uuid_t));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gattlib_uuid_cmp(&conn_context->characteristics[i].uuid, uuid) == 0) {
|
|
||||||
handle = conn_context->characteristics[i].value_handle;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue