Bluetooth: GATT: Use check_perm to check CCC permission

This moves check_perm code under GAT and make use of it to check if CCC
write permission can be attended by the connection security level or if
it needs to be increased.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-09-17 16:50:51 +03:00 committed by Johan Hedberg
commit 4f3892c0eb
5 changed files with 92 additions and 61 deletions

View file

@ -1085,6 +1085,16 @@ int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec)
return err;
}
bt_security_t bt_conn_get_security(struct bt_conn *conn)
{
return conn->sec_level;
}
#else
bt_security_t bt_conn_get_security(struct bt_conn *conn)
{
return BT_SECURITY_L1;
}
#endif /* CONFIG_BT_SMP */
void bt_conn_cb_register(struct bt_conn_cb *cb)