Bluetooth: ATT: Check mask instead of specific permission
This enables simpler permissions as it is not longer needed to include BT_GATT_PERM_READ or BT_GATT_PERM_WRITE. Change-Id: I0c749b75bedb125bda8ea451474c82eec13d3c38 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
eea10dd425
commit
7834061d12
1 changed files with 4 additions and 2 deletions
|
@ -532,11 +532,13 @@ static bool uuid_create(struct bt_uuid *uuid, struct net_buf *buf)
|
|||
static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
uint8_t mask)
|
||||
{
|
||||
if ((mask & BT_GATT_PERM_READ) && !(attr->perm & BT_GATT_PERM_READ)) {
|
||||
if ((mask & BT_GATT_PERM_READ) &&
|
||||
!(attr->perm & BT_GATT_PERM_READ_MASK)) {
|
||||
return BT_ATT_ERR_READ_NOT_PERMITTED;
|
||||
}
|
||||
|
||||
if ((mask & BT_GATT_PERM_WRITE) && !(attr->perm & BT_GATT_PERM_WRITE)) {
|
||||
if ((mask & BT_GATT_PERM_WRITE) &&
|
||||
!(attr->perm & BT_GATT_PERM_WRITE_MASK)) {
|
||||
return BT_ATT_ERR_WRITE_NOT_PERMITTED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue