Bluetooth: GATT: Disable dynamic database by default
This makes BT_GATT_DB default to n which reduces the ram required for many samples. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
c42707c2d3
commit
2c4e5d5f16
|
@ -353,7 +353,7 @@ config BT_ATT_TX_MAX
|
|||
|
||||
config BT_GATT_DB
|
||||
bool "GATT dynamic database support"
|
||||
default y
|
||||
default n
|
||||
help
|
||||
This option enables registering/unregistering services at runtime.
|
||||
|
||||
|
|
|
@ -779,11 +779,9 @@ static void db_changed(void)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_DB */
|
||||
|
||||
int bt_gatt_service_register(struct bt_gatt_service *svc)
|
||||
{
|
||||
#if defined(CONFIG_BT_GATT_DB)
|
||||
int err;
|
||||
|
||||
__ASSERT(svc, "invalid parameters\n");
|
||||
|
@ -808,16 +806,12 @@ int bt_gatt_service_register(struct bt_gatt_service *svc)
|
|||
svc->attrs[svc->attr_count - 1].handle);
|
||||
|
||||
db_changed();
|
||||
#else
|
||||
__ASSERT(false, "not supported\n");
|
||||
#endif /* CONFIG_BT_GATT_DB */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_gatt_service_unregister(struct bt_gatt_service *svc)
|
||||
{
|
||||
#if defined(CONFIG_BT_GATT_DB)
|
||||
__ASSERT(svc, "invalid parameters\n");
|
||||
|
||||
if (!sys_slist_find_and_remove(&db, &svc->node)) {
|
||||
|
@ -828,11 +822,10 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc)
|
|||
svc->attrs[svc->attr_count - 1].handle);
|
||||
|
||||
db_changed();
|
||||
#else
|
||||
__ASSERT(false, "not supported\n");
|
||||
#endif /* CONFIG_BT_GATT_DB */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_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,
|
||||
|
|
|
@ -37,6 +37,7 @@ if BT_CONN
|
|||
# Virtual option enabled whenever any Proxy protocol is needed
|
||||
config BT_MESH_PROXY
|
||||
bool
|
||||
select BT_GATT_DB
|
||||
|
||||
config BT_MESH_PB_GATT
|
||||
bool "Provisioning support using GATT (PB-GATT)"
|
||||
|
|
|
@ -603,6 +603,7 @@ static int cmd_show_db(const struct shell *shell, size_t argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_DB)
|
||||
/* Custom Service Variables */
|
||||
static struct bt_uuid_128 vnd_uuid = BT_UUID_INIT_128(
|
||||
0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12,
|
||||
|
@ -872,6 +873,7 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[])
|
|||
|
||||
return err;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_DB */
|
||||
|
||||
static u8_t get_cb(const struct bt_gatt_attr *attr, void *user_data)
|
||||
{
|
||||
|
@ -999,18 +1001,24 @@ SHELL_STATIC_SUBCMD_SET_CREATE(gatt_cmds,
|
|||
cmd_write_without_rsp, 3, 2),
|
||||
SHELL_CMD_ARG(unsubscribe, NULL, HELP_NONE, cmd_unsubscribe, 1, 0),
|
||||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
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)
|
||||
SHELL_CMD_ARG(metrics, NULL,
|
||||
"register vendr char and measure rx <value: on, off>",
|
||||
cmd_metrics, 2, 0),
|
||||
SHELL_CMD_ARG(register, NULL,
|
||||
"register pre-predefined test service",
|
||||
cmd_register_test_svc, 1, 0),
|
||||
SHELL_CMD_ARG(show-db, NULL, "[uuid]", cmd_show_db, 1, 1),
|
||||
SHELL_CMD_ARG(unregister, NULL,
|
||||
"unregister pre-predefined test service",
|
||||
cmd_unregister_test_svc, 1, 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(unregister, NULL,
|
||||
"unregister pre-predefined test service",
|
||||
cmd_unregister_test_svc, 1, 0),
|
||||
#endif /* CONFIG_BT_GATT_DB */
|
||||
SHELL_SUBCMD_SET_END
|
||||
);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ config MCUMGR_SMP_BT
|
|||
select MCUMGR
|
||||
select BT
|
||||
select BT_PERIPHERAL
|
||||
select BT_GATT_DB
|
||||
help
|
||||
Enables handling of SMP commands received over Bluetooth.
|
||||
|
||||
|
|
|
@ -20,6 +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_SETTINGS=y
|
||||
CONFIG_FLASH=y
|
||||
|
|
Loading…
Reference in a new issue