nus_send_enabled_cb invoked before connected

Hi

In my firmware, i setup a NUS service, piece of code as below:

...

static struct bt_nus_cb nus_cb = {
	.sent = nus_sent_cb,
	.send_enabled = nus_send_enabled_cb,
	.received = nus_receive_cb,
};

...

static struct bt_conn_cb conn_callbacks = {
    .connected = connected,
    .disconnected = disconnected,
    .le_param_req = le_param_req,
    .le_param_updated = le_param_updated,

#if defined(CONFIG_BT_SMP)
    .security_changed = security_changed,
#endif /* CONFIG_BT_SMP */

#if defined(CONFIG_BT_USER_PHY_UPDATE)
    .le_phy_updated = le_phy_updated,
#endif /* CONFIG_BT_USER_PHY_UPDATE */

#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
    .le_data_len_updated = le_data_len_updated,
#endif /* CONFIG_BT_USER_DATA_LEN_UPDATE */
};

...

int main()
{
...
    bt_conn_cb_register(&conn_callbacks);
...
    bt_nus_init(&nus_cb);
...
}

I found that the nus_send_enabled_cb function is always invoked before connected function in ncs sdk v2.0.0.

In my mind, it should be connected first, then ccc_cfg_changed of service can be called. Is it right?

logo
Parents Reply Children
No Data
Related