Hi!
We have two similar nRF52840 boards and want them to talk via nus_client and nus_server.
At the moment, we consider connection established after client receives the generic bluetooth connected callback and setups nus (below code).
static void connected(struct bt_conn *conn, uint8_t err) { // setup NUS static struct bt_gatt_exchange_params exchange_params; exchange_params.func = exchange_func; bt_gatt_exchange_mtu(conn, &exchange_params); bt_conn_set_security(conn, BT_SECURITY_L2); gatt_discover(conn); bt_scan_stop(); <send first NUS data> }
Of course, NUS is not ready at that moment, so the message is lost (without any error being reported), just as any messages sent within the next ~1 second.
Is there a way to register a callback that will notify us when NUS is actually ready?
We are using NCS_VERSION=v2.6.1
(I should note that I came across https://devzone.nordicsemi.com/f/nordic-q-a/28208/when-is-nus-ready, but it seems no longer relevant. If I am mistaken, then how can the mentioned handler registered?)