Skip to content
Permalink
Browse files

Bluetooth: GATT: Rename BT_GATT_DB to BT_GATT_DYNAMIC_DB

This should be clearer about the intent of the option.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information...
Vudentz authored and jhedberg committed Apr 25, 2019
1 parent 45e1ce8 commit bd007141fdbec2fb19b035e57eb030efdcc03778
@@ -37,7 +37,7 @@ config BT_ATT_TX_MAX
amount the calls will block until an existing queued PDU gets
sent.

config BT_GATT_DB
config BT_GATT_DYNAMIC_DB
bool "GATT dynamic database support"
default n
help
@@ -46,7 +46,7 @@ config BT_GATT_DB
config BT_GATT_CACHING
bool "GATT Caching support"
default y
depends on BT_GATT_DB
depends on BT_GATT_DYNAMIC_DB
select TINYCRYPT
select TINYCRYPT_AES
select TINYCRYPT_AES_CMAC
@@ -17,13 +17,13 @@

#include <settings/settings.h>

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
#include <tinycrypt/constants.h>
#include <tinycrypt/utils.h>
#include <tinycrypt/aes.h>
#include <tinycrypt/cmac_mode.h>
#include <tinycrypt/ccm_mode.h>
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

#include <bluetooth/hci.h>
#include <bluetooth/bluetooth.h>
@@ -183,7 +183,7 @@ BT_GATT_SERVICE_DEFINE(_2_gap_svc,
#endif
);

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
static struct bt_gatt_ccc_cfg sc_ccc_cfg[BT_GATT_CCC_MAX] = {};

static void sc_ccc_cfg_changed(const struct bt_gatt_attr *attr,
@@ -489,11 +489,11 @@ static void remove_cf_cfg(struct bt_conn *conn)
}
}
#endif /* CONFIG_BT_GATT_CACHING */
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

BT_GATT_SERVICE_DEFINE(_1_gatt_svc,
BT_GATT_PRIMARY_SERVICE(BT_UUID_GATT),
#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
/* Bluetooth 5.0, Vol3 Part G:
* The Service Changed characteristic Attribute Handle on the server
* shall not change if the server has a trusted relationship with any
@@ -511,10 +511,10 @@ BT_GATT_SERVICE_DEFINE(_1_gatt_svc,
BT_GATT_CHRC_READ, BT_GATT_PERM_READ,
db_hash_read, NULL, NULL),
#endif /* CONFIG_BT_GATT_CACHING */
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
);

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
static int gatt_register(struct bt_gatt_service *svc)
{
struct bt_gatt_service *last;
@@ -632,7 +632,7 @@ static void sc_process(struct k_work *work)

atomic_set_bit(sc->flags, SC_INDICATE_PENDING);
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

#if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)
static struct gatt_ccc_store {
@@ -699,20 +699,20 @@ void bt_gatt_init(void)
last_static_handle += svc->attr_count;
}

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
#if defined(CONFIG_BT_GATT_CACHING)
k_delayed_work_init(&db_hash_work, db_hash_process);
db_hash_gen(false);
#endif /* COFNIG_BT_GATT_CACHING */

k_delayed_work_init(&gatt_sc.work, sc_process);
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
#if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)
k_delayed_work_init(&gatt_ccc_store.work, ccc_delayed_store);
#endif
}

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
static bool update_range(u16_t *start, u16_t *end, u16_t new_start,
u16_t new_end)
{
@@ -825,7 +825,7 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc)

return 0;
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
void *buf, u16_t buf_len, u16_t offset,
@@ -1364,7 +1364,7 @@ static int gatt_indicate(struct bt_conn *conn, u16_t handle,
return gatt_send(conn, buf, gatt_indicate_rsp, params, NULL);
}

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
struct sc_data {
u16_t start;
u16_t end;
@@ -1397,7 +1397,7 @@ static void sc_save(struct bt_gatt_ccc_cfg *cfg,
BT_DBG("peer %s start 0x%04x end 0x%04x", bt_addr_le_str(&cfg->peer),
stored->start, stored->end);
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

static u8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)
{
@@ -1435,11 +1435,11 @@ static u8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)

conn = bt_conn_lookup_addr_le(cfg->id, &cfg->peer);
if (!conn) {
#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
if (ccc->cfg == sc_ccc_cfg) {
sc_save(cfg, data->params);
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
continue;
}

@@ -1546,7 +1546,7 @@ u16_t bt_gatt_get_mtu(struct bt_conn *conn)
return bt_att_get_mtu(conn);
}

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
static void sc_restore(struct bt_gatt_ccc_cfg *cfg)
{
struct sc_data *data = (struct sc_data *)cfg->data;
@@ -1563,7 +1563,7 @@ static void sc_restore(struct bt_gatt_ccc_cfg *cfg)
/* Reset config data */
(void)memset(cfg->data, 0, sizeof(cfg->data));
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

static u8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)
{
@@ -1586,11 +1586,11 @@ static u8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)

if (ccc->cfg[i].value) {
gatt_ccc_changed(attr, ccc);
#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
if (ccc->cfg == sc_ccc_cfg) {
sc_restore(&ccc->cfg[i]);
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
return BT_GATT_ITER_CONTINUE;
}
}
@@ -37,7 +37,7 @@ if BT_CONN
# Virtual option enabled whenever any Proxy protocol is needed
config BT_MESH_PROXY
bool
select BT_GATT_DB
select BT_GATT_DYNAMIC_DB

config BT_MESH_PB_GATT
bool "Provisioning support using GATT (PB-GATT)"
@@ -603,7 +603,7 @@ static int cmd_show_db(const struct shell *shell, size_t argc, char *argv[])
return 0;
}

#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
/* Custom Service Variables */
static struct bt_uuid_128 vnd_uuid = BT_UUID_INIT_128(
0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12,
@@ -873,7 +873,7 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[])

return err;
}
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */

static u8_t get_cb(const struct bt_gatt_attr *attr, void *user_data)
{
@@ -1004,7 +1004,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(gatt_cmds,
SHELL_CMD_ARG(get, NULL, "<handle>", cmd_get, 2, 0),
SHELL_CMD_ARG(set, NULL, "<handle> [data...]", cmd_set, 2, 255),
SHELL_CMD_ARG(show-db, NULL, "[uuid]", cmd_show_db, 1, 1),
#if defined(CONFIG_BT_GATT_DB)
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
SHELL_CMD_ARG(metrics, NULL,
"register vendr char and measure rx <value: on, off>",
cmd_metrics, 2, 0),
@@ -1018,7 +1018,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(gatt_cmds,
SHELL_CMD_ARG(unregister, NULL,
"unregister pre-predefined test service",
cmd_unregister_test_svc, 1, 0),
#endif /* CONFIG_BT_GATT_DB */
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
SHELL_SUBCMD_SET_END
);

@@ -13,7 +13,7 @@ config MCUMGR_SMP_BT
select MCUMGR
select BT
select BT_PERIPHERAL
select BT_GATT_DB
select BT_GATT_DYNAMIC_DB
help
Enables handling of SMP commands received over Bluetooth.

@@ -20,7 +20,7 @@ CONFIG_BT_DEVICE_NAME="test shell"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_L2CAP_TX_BUF_COUNT=4
CONFIG_BT_ID_MAX=2
CONFIG_BT_GATT_DB=y
CONFIG_BT_GATT_DYNAMIC_DB=y

CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y

0 comments on commit bd00714

Please sign in to comment.
You can’t perform that action at this time.