Bluetooth: GATT: Use UUID of attribute to check for a characteristic
Update check in the bt_gatt_attr_value_handle API function to use the UUID of the function, in case the attribute has been declared with a different read handler, or the attribute is a temporary object where the read attribute has not been set. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
da5ea438c7
commit
24f62eeea1
2 changed files with 4 additions and 3 deletions
|
@ -403,7 +403,9 @@ uint16_t bt_gatt_attr_get_handle(const struct bt_gatt_attr *attr);
|
|||
|
||||
/** @brief Get the handle of the characteristic value descriptor.
|
||||
*
|
||||
* @param attr A Characteristic Attribute
|
||||
* @param attr A Characteristic Attribute.
|
||||
*
|
||||
* @note The user_data of the attribute must of type @ref bt_gatt_chrc.
|
||||
*
|
||||
* @return the handle of the corresponding Characteristic Value. The value will
|
||||
* be zero (the invalid handle) if @p attr was not a characteristic
|
||||
|
|
|
@ -1363,8 +1363,7 @@ uint16_t bt_gatt_attr_value_handle(const struct bt_gatt_attr *attr)
|
|||
{
|
||||
uint16_t handle = 0;
|
||||
|
||||
if ((attr != NULL)
|
||||
&& (attr->read == bt_gatt_attr_read_chrc)) {
|
||||
if (attr != NULL && bt_uuid_cmp(attr->uuid, BT_UUID_GATT_CHRC) == 0) {
|
||||
struct bt_gatt_chrc *chrc = attr->user_data;
|
||||
|
||||
handle = chrc->value_handle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue