Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Audio: tbs: modify TBS server notifications #68225

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions subsys/bluetooth/audio/tbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,20 @@ int bt_tbs_remote_incoming(uint8_t bearer_index, const char *to,
return call->index;
}

static void tbs_ntf_cb(struct bt_conn *conn, void *data)
{
struct service_inst *inst = data;
uint16_t mtu = bt_gatt_get_mtu(conn);
size_t len = strlen(inst->provider_name);

if (len > (mtu - 3)) {
len = mtu - 3;
}

bt_gatt_notify_uuid(conn, BT_UUID_TBS_PROVIDER_NAME, inst->attrs,
inst->provider_name, len);
}

int bt_tbs_set_bearer_provider_name(uint8_t bearer_index, const char *name)
{
struct service_inst *inst = inst_lookup_index(bearer_index);
Expand All @@ -1970,8 +1984,7 @@ int bt_tbs_set_bearer_provider_name(uint8_t bearer_index, const char *name)

(void)utf8_lcpy(inst->provider_name, name, sizeof(inst->provider_name));

bt_gatt_notify_uuid(NULL, BT_UUID_TBS_PROVIDER_NAME, inst->attrs, inst->provider_name,
strlen(inst->provider_name));
bt_conn_foreach(BT_CONN_TYPE_LE, tbs_ntf_cb, inst);
return 0;
}

Expand Down Expand Up @@ -2092,9 +2105,7 @@ int bt_tbs_set_uri_scheme_list(uint8_t bearer_index, const char **uri_list,

LOG_DBG("TBS instance %u uri prefix list is now %s", bearer_index, inst->uri_scheme_list);

bt_gatt_notify_uuid(NULL, BT_UUID_TBS_URI_LIST,
inst->inst.attrs, &inst->uri_scheme_list,
strlen(inst->uri_scheme_list));
bt_conn_foreach(BT_CONN_TYPE_LE, tbs_ntf_cb, inst);

if (IS_ENABLED(CONFIG_BT_GTBS)) {
NET_BUF_SIMPLE_DEFINE(uri_scheme_buf, READ_BUF_SIZE);
Expand Down
Loading