Skip to content

Commit

Permalink
Bluetooth: GATT: Rename BT_GATT_DB to BT_GATT_DYNAMIC_DB
Browse files Browse the repository at this point in the history
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 May 2, 2019
1 parent 45e1ce8 commit bd00714
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/host/Kconfig.gatt
Expand Up @@ -37,7 +37,7 @@ config BT_ATT_TX_MAX
amount the calls will block until an existing queued PDU gets amount the calls will block until an existing queued PDU gets
sent. sent.


config BT_GATT_DB config BT_GATT_DYNAMIC_DB
bool "GATT dynamic database support" bool "GATT dynamic database support"
default n default n
help help
Expand All @@ -46,7 +46,7 @@ config BT_GATT_DB
config BT_GATT_CACHING config BT_GATT_CACHING
bool "GATT Caching support" bool "GATT Caching support"
default y default y
depends on BT_GATT_DB depends on BT_GATT_DYNAMIC_DB
select TINYCRYPT select TINYCRYPT
select TINYCRYPT_AES select TINYCRYPT_AES
select TINYCRYPT_AES_CMAC select TINYCRYPT_AES_CMAC
Expand Down
40 changes: 20 additions & 20 deletions subsys/bluetooth/host/gatt.c
Expand Up @@ -17,13 +17,13 @@


#include <settings/settings.h> #include <settings/settings.h>


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


#include <bluetooth/hci.h> #include <bluetooth/hci.h>
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
Expand Down Expand Up @@ -183,7 +183,7 @@ BT_GATT_SERVICE_DEFINE(_2_gap_svc,
#endif #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 struct bt_gatt_ccc_cfg sc_ccc_cfg[BT_GATT_CCC_MAX] = {};


static void sc_ccc_cfg_changed(const struct bt_gatt_attr *attr, static void sc_ccc_cfg_changed(const struct bt_gatt_attr *attr,
Expand Down Expand Up @@ -489,11 +489,11 @@ static void remove_cf_cfg(struct bt_conn *conn)
} }
} }
#endif /* CONFIG_BT_GATT_CACHING */ #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_SERVICE_DEFINE(_1_gatt_svc,
BT_GATT_PRIMARY_SERVICE(BT_UUID_GATT), 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: /* Bluetooth 5.0, Vol3 Part G:
* The Service Changed characteristic Attribute Handle on the server * The Service Changed characteristic Attribute Handle on the server
* shall not change if the server has a trusted relationship with any * shall not change if the server has a trusted relationship with any
Expand All @@ -511,10 +511,10 @@ BT_GATT_SERVICE_DEFINE(_1_gatt_svc,
BT_GATT_CHRC_READ, BT_GATT_PERM_READ, BT_GATT_CHRC_READ, BT_GATT_PERM_READ,
db_hash_read, NULL, NULL), db_hash_read, NULL, NULL),
#endif /* CONFIG_BT_GATT_CACHING */ #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) static int gatt_register(struct bt_gatt_service *svc)
{ {
struct bt_gatt_service *last; struct bt_gatt_service *last;
Expand Down Expand Up @@ -632,7 +632,7 @@ static void sc_process(struct k_work *work)


atomic_set_bit(sc->flags, SC_INDICATE_PENDING); 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) #if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)
static struct gatt_ccc_store { static struct gatt_ccc_store {
Expand Down Expand Up @@ -699,20 +699,20 @@ void bt_gatt_init(void)
last_static_handle += svc->attr_count; 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) #if defined(CONFIG_BT_GATT_CACHING)
k_delayed_work_init(&db_hash_work, db_hash_process); k_delayed_work_init(&db_hash_work, db_hash_process);
db_hash_gen(false); db_hash_gen(false);
#endif /* COFNIG_BT_GATT_CACHING */ #endif /* COFNIG_BT_GATT_CACHING */


k_delayed_work_init(&gatt_sc.work, sc_process); 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) #if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)
k_delayed_work_init(&gatt_ccc_store.work, ccc_delayed_store); k_delayed_work_init(&gatt_ccc_store.work, ccc_delayed_store);
#endif #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, static bool update_range(u16_t *start, u16_t *end, u16_t new_start,
u16_t new_end) u16_t new_end)
{ {
Expand Down Expand Up @@ -825,7 +825,7 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc)


return 0; 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, 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, void *buf, u16_t buf_len, u16_t offset,
Expand Down Expand Up @@ -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); 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 { struct sc_data {
u16_t start; u16_t start;
u16_t end; u16_t end;
Expand Down Expand Up @@ -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), BT_DBG("peer %s start 0x%04x end 0x%04x", bt_addr_le_str(&cfg->peer),
stored->start, stored->end); 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) static u8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)
{ {
Expand Down Expand Up @@ -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); conn = bt_conn_lookup_addr_le(cfg->id, &cfg->peer);
if (!conn) { if (!conn) {
#if defined(CONFIG_BT_GATT_DB) #if defined(CONFIG_BT_GATT_DYNAMIC_DB)
if (ccc->cfg == sc_ccc_cfg) { if (ccc->cfg == sc_ccc_cfg) {
sc_save(cfg, data->params); sc_save(cfg, data->params);
} }
#endif /* CONFIG_BT_GATT_DB */ #endif /* CONFIG_BT_GATT_DYNAMIC_DB */
continue; continue;
} }


Expand Down Expand Up @@ -1546,7 +1546,7 @@ u16_t bt_gatt_get_mtu(struct bt_conn *conn)
return bt_att_get_mtu(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) static void sc_restore(struct bt_gatt_ccc_cfg *cfg)
{ {
struct sc_data *data = (struct sc_data *)cfg->data; struct sc_data *data = (struct sc_data *)cfg->data;
Expand All @@ -1563,7 +1563,7 @@ static void sc_restore(struct bt_gatt_ccc_cfg *cfg)
/* Reset config data */ /* Reset config data */
(void)memset(cfg->data, 0, sizeof(cfg->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) static u8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)
{ {
Expand All @@ -1586,11 +1586,11 @@ static u8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)


if (ccc->cfg[i].value) { if (ccc->cfg[i].value) {
gatt_ccc_changed(attr, ccc); gatt_ccc_changed(attr, ccc);
#if defined(CONFIG_BT_GATT_DB) #if defined(CONFIG_BT_GATT_DYNAMIC_DB)
if (ccc->cfg == sc_ccc_cfg) { if (ccc->cfg == sc_ccc_cfg) {
sc_restore(&ccc->cfg[i]); sc_restore(&ccc->cfg[i]);
} }
#endif /* CONFIG_BT_GATT_DB */ #endif /* CONFIG_BT_GATT_DYNAMIC_DB */
return BT_GATT_ITER_CONTINUE; return BT_GATT_ITER_CONTINUE;
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/mesh/Kconfig
Expand Up @@ -37,7 +37,7 @@ if BT_CONN
# Virtual option enabled whenever any Proxy protocol is needed # Virtual option enabled whenever any Proxy protocol is needed
config BT_MESH_PROXY config BT_MESH_PROXY
bool bool
select BT_GATT_DB select BT_GATT_DYNAMIC_DB


config BT_MESH_PB_GATT config BT_MESH_PB_GATT
bool "Provisioning support using GATT (PB-GATT)" bool "Provisioning support using GATT (PB-GATT)"
Expand Down
8 changes: 4 additions & 4 deletions subsys/bluetooth/shell/gatt.c
Expand Up @@ -603,7 +603,7 @@ static int cmd_show_db(const struct shell *shell, size_t argc, char *argv[])
return 0; return 0;
} }


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


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


Expand Down
2 changes: 1 addition & 1 deletion subsys/mgmt/Kconfig
Expand Up @@ -13,7 +13,7 @@ config MCUMGR_SMP_BT
select MCUMGR select MCUMGR
select BT select BT
select BT_PERIPHERAL select BT_PERIPHERAL
select BT_GATT_DB select BT_GATT_DYNAMIC_DB
help help
Enables handling of SMP commands received over Bluetooth. Enables handling of SMP commands received over Bluetooth.


Expand Down
2 changes: 1 addition & 1 deletion tests/bluetooth/shell/prj.conf
Expand Up @@ -20,7 +20,7 @@ CONFIG_BT_DEVICE_NAME="test shell"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_L2CAP_TX_BUF_COUNT=4 CONFIG_BT_L2CAP_TX_BUF_COUNT=4
CONFIG_BT_ID_MAX=2 CONFIG_BT_ID_MAX=2
CONFIG_BT_GATT_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y


CONFIG_BT_SETTINGS=y CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y CONFIG_FLASH=y
Expand Down

0 comments on commit bd00714

Please sign in to comment.