Bluetooth: TBS: Allow multiple callbacks for client

The TBS client callbacks are just informative so we
provide the information to multiple listeners.

To support this for the long strings, the function
handle_string_long_read was refactored.

This also allows for multiple users of the TBS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-08-23 17:55:15 +02:00 committed by Fabio Baltieri
commit 57b35e1047
8 changed files with 420 additions and 249 deletions

View file

@ -303,7 +303,7 @@ static void tbs_client_term_reason_cb(struct bt_conn *conn,
SET_FLAG(term_reason);
}
static const struct bt_tbs_client_cb tbs_client_cbs = {
static struct bt_tbs_client_cb tbs_client_cbs = {
.discover = tbs_client_discover_cb,
.originate_call = tbs_client_originate_call_cb,
.terminate_call = tbs_client_terminate_call_cb,
@ -492,7 +492,12 @@ static void test_main(void)
}
bt_conn_cb_register(&conn_callbacks);
bt_tbs_client_register_cb(&tbs_client_cbs);
err = bt_tbs_client_register_cb(&tbs_client_cbs);
if (err != 0) {
FAIL("Failed to register TBS client cbs (err %d)\n", err);
return;
}
WAIT_FOR_COND(bt_init);