Skip to content

Commit c3e4c50

Browse files
Thalleynashif
authored andcommitted
samples: Bluetooth: TMAP periph: Handle empty URI string
The supported URI list may be empty which the sample did not properly support. Signed-off-by: Emil Gydesen <[email protected]>
1 parent b1dc99d commit c3e4c50

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

samples/bluetooth/tmap_peripheral/src/ccp_call_ctrl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* SPDX-License-Identifier: Apache-2.0
99
*/
10+
#include <errno.h>
1011

1112
#include <zephyr/kernel.h>
1213
#include <zephyr/sys/printk.h>
@@ -139,6 +140,12 @@ int ccp_originate_call(void)
139140
int err;
140141
char uri[CONFIG_BT_TBS_MAX_URI_LENGTH];
141142

143+
/* If remote_uri is empty then we cannot place a call */
144+
if (remote_uri[0] == '\0') {
145+
printk("Remote does not support any URI schemes, cannot place call\n");
146+
return -ENOENT;
147+
}
148+
142149
strcpy(uri, remote_uri);
143150
strcat(uri, URI_SEPARATOR);
144151
strcat(uri, CALLER_ID);

samples/bluetooth/tmap_peripheral/src/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,10 @@ int main(void)
289289
err = ccp_originate_call();
290290
if (err != 0) {
291291
printk("Error sending call originate command!\n");
292+
} else {
293+
/* Start timer to send terminate call command */
294+
k_work_schedule(&call_terminate_set_work, K_MSEC(2000));
292295
}
293-
/* Start timer to send terminate call command */
294-
k_work_schedule(&call_terminate_set_work, K_MSEC(2000));
295296
}
296297

297298
if (peer_is_ums) {

0 commit comments

Comments
 (0)