samples: conn_cb replace to const zsector
It is more efficient and saves part of RAM by replacing it with static one dynamically. Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
23a9594944
commit
8e1682d1ea
|
@ -116,9 +116,9 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
start_scan();
|
start_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
|
@ -133,7 +133,5 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
start_scan();
|
start_scan();
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
start_scan();
|
start_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -252,7 +252,5 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
start_scan();
|
start_scan();
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -275,8 +275,6 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = scan_start();
|
err = scan_start();
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -222,7 +222,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
start_scan();
|
start_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -239,8 +239,6 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
iso_chan.ops = &iso_ops;
|
iso_chan.ops = &iso_ops;
|
||||||
iso_chan.qos = &iso_qos;
|
iso_chan.qos = &iso_qos;
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -685,7 +685,6 @@ void main(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
k_work_init_delayable(&idle_work, idle_timeout);
|
k_work_init_delayable(&idle_work, idle_timeout);
|
||||||
|
|
||||||
/* Initialize the Bluetooth Subsystem */
|
/* Initialize the Bluetooth Subsystem */
|
||||||
|
|
|
@ -190,7 +190,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -295,8 +295,6 @@ void main(void)
|
||||||
get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, &txp_get);
|
get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, &txp_get);
|
||||||
printk("-> default TXP = %d\n", txp_get);
|
printk("-> default TXP = %d\n", txp_get);
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
/* Wait for 5 seconds to give a chance users/testers
|
/* Wait for 5 seconds to give a chance users/testers
|
||||||
* to check that default Tx power is indeed the one
|
* to check that default Tx power is indeed the one
|
||||||
* selected in Kconfig.
|
* selected in Kconfig.
|
||||||
|
|
|
@ -248,7 +248,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -339,7 +339,6 @@ void main(void)
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_gatt_cb_register(&gatt_callbacks);
|
bt_gatt_cb_register(&gatt_callbacks);
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
|
|
||||||
vnd_ind_attr = bt_gatt_find_by_uuid(vnd_svc.attrs, vnd_svc.attr_count,
|
vnd_ind_attr = bt_gatt_find_by_uuid(vnd_svc.attrs, vnd_svc.attr_count,
|
||||||
|
|
|
@ -356,7 +356,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -408,8 +408,6 @@ void main(void)
|
||||||
|
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
k_sleep(K_SECONDS(1));
|
k_sleep(K_SECONDS(1));
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -96,8 +96,6 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Advertising failed to start (err %d)\n", err);
|
printk("Advertising failed to start (err %d)\n", err);
|
||||||
|
|
|
@ -360,7 +360,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -429,7 +429,6 @@ void main(void)
|
||||||
|
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
.security_changed = security_changed,
|
.security_changed = security_changed,
|
||||||
|
@ -137,6 +137,5 @@ void main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -115,7 +115,6 @@ void main(void)
|
||||||
|
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
|
|
||||||
/* Implement notification. At the moment there is no suitable way
|
/* Implement notification. At the moment there is no suitable way
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason 0x%02x)\n", reason);
|
printk("Disconnected (reason 0x%02x)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,6 @@ void main(void)
|
||||||
|
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
|
|
||||||
/* Implement indicate. At the moment there is no suitable way
|
/* Implement indicate. At the moment there is no suitable way
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected from %s (reason 0x%02x)\n", addr, reason);
|
printk("Disconnected from %s (reason 0x%02x)\n", addr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -156,8 +156,6 @@ void main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_iso_server_register(&iso_server);
|
err = bt_iso_server_register(&iso_server);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Unable to register ISO server (err %d)\n", err);
|
printk("Unable to register ISO server (err %d)\n", err);
|
||||||
|
|
|
@ -52,9 +52,9 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
printk("Disconnected (reason %u)\n", reason);
|
printk("Disconnected (reason %u)\n", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ots_obj_created(struct bt_ots *ots, struct bt_conn *conn,
|
static int ots_obj_created(struct bt_ots *ots, struct bt_conn *conn,
|
||||||
|
@ -266,8 +266,6 @@ void main(void)
|
||||||
|
|
||||||
printk("Starting Bluetooth Peripheral OTS example\n");
|
printk("Starting Bluetooth Peripheral OTS example\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Bluetooth init failed (err %d)\n", err);
|
printk("Bluetooth init failed (err %d)\n", err);
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
.identity_resolved = identity_resolved,
|
.identity_resolved = identity_resolved,
|
||||||
|
@ -136,7 +136,6 @@ void main(void)
|
||||||
|
|
||||||
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -173,7 +173,7 @@ static void disconnected(struct bt_conn *disconn, uint8_t reason)
|
||||||
LOG_INF("Disconnected (reason %u)", reason);
|
LOG_INF("Disconnected (reason %u)", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -191,7 +191,6 @@ void main(void)
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
/* Initialize the Bluetooth Subsystem */
|
/* Initialize the Bluetooth Subsystem */
|
||||||
err = bt_enable(bt_ready);
|
err = bt_enable(bt_ready);
|
||||||
|
|
|
@ -271,7 +271,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -534,7 +534,5 @@ void ble_init(void)
|
||||||
|
|
||||||
k_work_init_delayable(&ble_work, ble_timeout);
|
k_work_init_delayable(&ble_work, ble_timeout);
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
local_attr = &pong_svc.attrs[1];
|
local_attr = &pong_svc.attrs[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_cb = {
|
BT_CONN_CB_DEFINE(conn_cb) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -164,7 +164,6 @@ static void bt_ready(int err)
|
||||||
|
|
||||||
printk("Mesh initialized\n");
|
printk("Mesh initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_cb);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb);
|
bt_conn_auth_cb_register(&auth_cb);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SETTINGS)) {
|
if (IS_ENABLED(CONFIG_SETTINGS)) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
k_work_submit(&advertise_work);
|
k_work_submit(&advertise_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -82,8 +82,6 @@ void start_smp_bluetooth(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
/* Initialize the Bluetooth mcumgr transport. */
|
/* Initialize the Bluetooth mcumgr transport. */
|
||||||
smp_bt_register();
|
smp_bt_register();
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ void le_phy_updated(struct bt_conn *conn,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
.le_param_req = le_param_req,
|
.le_param_req = le_param_req,
|
||||||
|
@ -576,8 +576,6 @@ static void bt_ready(int err)
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CONN)
|
#if defined(CONFIG_BT_CONN)
|
||||||
default_conn = NULL;
|
default_conn = NULL;
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
#endif /* CONFIG_BT_CONN */
|
#endif /* CONFIG_BT_CONN */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PER_ADV_SYNC)
|
#if defined(CONFIG_BT_PER_ADV_SYNC)
|
||||||
|
|
|
@ -184,7 +184,7 @@ static void l2cap_whitelist_remove(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb l2cap_conn_callbacks = {
|
BT_CONN_CB_DEFINE(l2cap_conn_callbacks) = {
|
||||||
.disconnected = l2cap_whitelist_remove,
|
.disconnected = l2cap_whitelist_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -268,8 +268,6 @@ static int cmd_register(const struct shell *shell, size_t argc, char *argv[])
|
||||||
server.psm = 0U;
|
server.psm = 0U;
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
} else {
|
} else {
|
||||||
bt_conn_cb_register(&l2cap_conn_callbacks);
|
|
||||||
|
|
||||||
shell_print(shell, "L2CAP psm %u sec_level %u registered",
|
shell_print(shell, "L2CAP psm %u sec_level %u registered",
|
||||||
server.psm, server.sec_level);
|
server.psm, server.sec_level);
|
||||||
}
|
}
|
||||||
|
|
|
@ -603,7 +603,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
default_conn = NULL;
|
default_conn = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -615,9 +615,6 @@ static int net_bt_init(const struct device *dev)
|
||||||
|
|
||||||
NET_DBG("dev %p driver_data %p", dev, dev->data);
|
NET_DBG("dev %p driver_data %p", dev, dev->data);
|
||||||
|
|
||||||
#if defined(CONFIG_NET_L2_BT_MGMT)
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
#endif
|
|
||||||
err = bt_l2cap_server_register(&server);
|
err = bt_l2cap_server_register(&server);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
is_disconnected = true;
|
is_disconnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -180,10 +180,6 @@ static void test_advx_main(void)
|
||||||
}
|
}
|
||||||
printk("success.\n");
|
printk("success.\n");
|
||||||
|
|
||||||
printk("Connection callbacks register...");
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
printk("success.\n");
|
|
||||||
|
|
||||||
printk("Connectable advertising...");
|
printk("Connectable advertising...");
|
||||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1203,10 +1199,6 @@ static void test_scanx_main(void)
|
||||||
bt_le_scan_cb_register(&scan_callbacks);
|
bt_le_scan_cb_register(&scan_callbacks);
|
||||||
printk("success.\n");
|
printk("success.\n");
|
||||||
|
|
||||||
printk("Connection callbacks register...");
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
printk("success.\n");
|
|
||||||
|
|
||||||
printk("Periodic Advertising callbacks register...");
|
printk("Periodic Advertising callbacks register...");
|
||||||
bt_le_per_adv_sync_cb_register(&sync_cb);
|
bt_le_per_adv_sync_cb_register(&sync_cb);
|
||||||
printk("Success.\n");
|
printk("Success.\n");
|
||||||
|
|
|
@ -361,7 +361,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
.le_param_updated = params_updated,
|
.le_param_updated = params_updated,
|
||||||
|
@ -380,8 +380,6 @@ static void test_con1_main(void)
|
||||||
|
|
||||||
printk("Bluetooth initialized\n");
|
printk("Bluetooth initialized\n");
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found);
|
err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -156,8 +156,6 @@ static void test_con2_main(void)
|
||||||
|
|
||||||
bt_ready();
|
bt_ready();
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
/* Implement notification. At the moment there is no suitable way
|
/* Implement notification. At the moment there is no suitable way
|
||||||
* of starting delayed work so we do it here
|
* of starting delayed work so we do it here
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#define VOCS_DESC_SIZE 64
|
#define VOCS_DESC_SIZE 64
|
||||||
#define AICS_DESC_SIZE 64
|
#define AICS_DESC_SIZE 64
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks;
|
|
||||||
extern enum bst_result_t bst_result;
|
extern enum bst_result_t bst_result;
|
||||||
|
|
||||||
static struct bt_mics *mics;
|
static struct bt_mics *mics;
|
||||||
|
@ -222,7 +221,7 @@ static void bt_ready(int err)
|
||||||
g_bt_init = true;
|
g_bt_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -390,7 +389,6 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_mics_client_cb_register(&mics_cbs);
|
bt_mics_client_cb_register(&mics_cbs);
|
||||||
|
|
||||||
WAIT_FOR(g_bt_init);
|
WAIT_FOR(g_bt_init);
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
g_is_connected = true;
|
g_is_connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -427,8 +427,6 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_mics_included_get(mics, &mics_included);
|
err = bt_mics_included_get(mics, &mics_included);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
FAIL("MICS get failed (err %d)\n", err);
|
FAIL("MICS get failed (err %d)\n", err);
|
||||||
|
|
|
@ -295,7 +295,7 @@ static void bt_ready(int err)
|
||||||
g_bt_init = true;
|
g_bt_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -560,8 +560,6 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_vcs_client_cb_register(&vcs_cbs);
|
err = bt_vcs_client_cb_register(&vcs_cbs);
|
||||||
if (err) {
|
if (err) {
|
||||||
FAIL("CB register failed (err %d)\n", err);
|
FAIL("CB register failed (err %d)\n", err);
|
||||||
|
|
|
@ -201,7 +201,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
g_is_connected = true;
|
g_is_connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
};
|
};
|
||||||
|
@ -675,8 +675,6 @@ static void test_main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
|
|
||||||
err = bt_vcs_included_get(vcs, &vcs_included);
|
err = bt_vcs_included_get(vcs, &vcs_included);
|
||||||
if (err) {
|
if (err) {
|
||||||
FAIL("VCS included get failed (err %d)\n", err);
|
FAIL("VCS included get failed (err %d)\n", err);
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level,
|
||||||
printk("Security changed: %s level %u\n", addr, level);
|
printk("Security changed: %s level %u\n", addr, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_conn_cb conn_callbacks = {
|
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
.connected = connected,
|
.connected = connected,
|
||||||
.disconnected = disconnected,
|
.disconnected = disconnected,
|
||||||
.security_changed = security_changed,
|
.security_changed = security_changed,
|
||||||
|
@ -335,7 +335,6 @@ void main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
|
||||||
bt_conn_auth_cb_register(&auth_cb_display);
|
bt_conn_auth_cb_register(&auth_cb_display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue