Bluetooth: Host: Add a configuration for writable name
In the file gatt.c, GAP service contains the Device Name characteristic. If writable, authentication and authorization may be defined by a higher layer specification.It means that GATT clients can write to device name GAP characteristic without bonding. So we add a configuration for writable name without bonding. Signed-off-by: Jun Huang <huangjun6@xiaomi.com> Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
24784b1452
commit
03eb3778e0
2 changed files with 25 additions and 1 deletions
|
@ -192,6 +192,23 @@ config BT_DEVICE_NAME_GATT_WRITABLE
|
||||||
Enabling this option allows remote GATT clients to write to device
|
Enabling this option allows remote GATT clients to write to device
|
||||||
name GAP characteristic.
|
name GAP characteristic.
|
||||||
|
|
||||||
|
if BT_DEVICE_NAME_GATT_WRITABLE
|
||||||
|
config DEVICE_NAME_GATT_WRITABLE_ENCRYPT
|
||||||
|
bool "Encryption required to write name by remote GATT clients"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enabling this option requires the connection to be encrypted to write
|
||||||
|
to the device name GAP characteristic.
|
||||||
|
|
||||||
|
|
||||||
|
config DEVICE_NAME_GATT_WRITABLE_AUTHEN
|
||||||
|
bool "Authentication required to write name by remote GATT clients"
|
||||||
|
help
|
||||||
|
Enabling this option requires the connection to be encrypted and
|
||||||
|
authenticated to write to the device name GAP characteristic.
|
||||||
|
|
||||||
|
endif #BT_DEVICE_NAME_GATT_WRITABLE
|
||||||
|
|
||||||
if BT_DEBUG
|
if BT_DEBUG
|
||||||
|
|
||||||
config BT_DEBUG_ATT
|
config BT_DEBUG_ATT
|
||||||
|
|
|
@ -175,7 +175,14 @@ BT_GATT_SERVICE_DEFINE(_2_gap_svc,
|
||||||
/* Require pairing for writes to device name */
|
/* Require pairing for writes to device name */
|
||||||
BT_GATT_CHARACTERISTIC(BT_UUID_GAP_DEVICE_NAME,
|
BT_GATT_CHARACTERISTIC(BT_UUID_GAP_DEVICE_NAME,
|
||||||
BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE,
|
BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE,
|
||||||
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT,
|
BT_GATT_PERM_READ |
|
||||||
|
#if defined(CONFIG_DEVICE_NAME_GATT_WRITABLE_AUTHEN)
|
||||||
|
BT_GATT_PERM_WRITE_AUTHEN,
|
||||||
|
#elif defined(CONFIG_DEVICE_NAME_GATT_WRITABLE_ENCRYPT)
|
||||||
|
BT_GATT_PERM_WRITE_ENCRYPT,
|
||||||
|
#else
|
||||||
|
BT_GATT_PERM_WRITE,
|
||||||
|
#endif
|
||||||
read_name, write_name, bt_dev.name),
|
read_name, write_name, bt_dev.name),
|
||||||
#else
|
#else
|
||||||
BT_GATT_CHARACTERISTIC(BT_UUID_GAP_DEVICE_NAME, BT_GATT_CHRC_READ,
|
BT_GATT_CHARACTERISTIC(BT_UUID_GAP_DEVICE_NAME, BT_GATT_CHRC_READ,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue