Bluetooth: host: Fix gatt indicate when conn is NULL
Fix gatt indicate when conn is NULL and called with characteristic declaration as the attribute argument. In this case the handle was not advanced to the characteristic value. This is inconsistent with the rest of the notify and indicate API Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
82497eca2b
commit
e182d75ef7
1 changed files with 11 additions and 11 deletions
|
@ -1388,17 +1388,6 @@ static int gatt_indicate(struct bt_conn *conn, u16_t handle,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Check if attribute is a characteristic then adjust the handle */
|
||||
if (!bt_uuid_cmp(params->attr->uuid, BT_UUID_GATT_CHRC)) {
|
||||
struct bt_gatt_chrc *chrc = params->attr->user_data;
|
||||
|
||||
if (!(chrc->properties & BT_GATT_CHRC_INDICATE)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
handle++;
|
||||
}
|
||||
|
||||
buf = bt_att_create_pdu(conn, BT_ATT_OP_INDICATE,
|
||||
sizeof(*ind) + params->len);
|
||||
if (!buf) {
|
||||
|
@ -1615,6 +1604,17 @@ int bt_gatt_indicate(struct bt_conn *conn,
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* Check if attribute is a characteristic then adjust the handle */
|
||||
if (!bt_uuid_cmp(params->attr->uuid, BT_UUID_GATT_CHRC)) {
|
||||
struct bt_gatt_chrc *chrc = params->attr->user_data;
|
||||
|
||||
if (!(chrc->properties & BT_GATT_CHRC_INDICATE)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
handle++;
|
||||
}
|
||||
|
||||
if (conn) {
|
||||
return gatt_indicate(conn, handle, params);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue