I would like to add Just Works security to our battery service (BAS). However, I could not find such a setting anywhere, so I looked into it and found that in bas.c
BT_GATT_SERVICE_DEFINE(bas,
BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS),
BT_GATT_CHARACTERISTIC(BT_UUUID_BAS_BATTERY_LEVEL,
BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_READ, read_blvl, NULL,
&battery_level),
BT_GATT_CCC(blvl_ccc_cfg_changed,
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
);
I found that it is defined as I understand that I should change this BT_GATT_PERM_READ to BT_GATT_PERM_READ_ENCRYPT or BT_GATT_PERM_READ_AUTHEN, but I do not know how exactly to make that change.
Also, this bas.c file is automatically added to the project with CONFIG_BT_BAS=y in prj.conf and I could not remove it from the project tree.
Translated with www.DeepL.com/Translator (free version) *sigh*