Browse Source

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 <emil.gydesen@nordicsemi.no>
pull/84478/head
Emil Gydesen 6 months ago committed by Anas Nashif
parent
commit
c3e4c50866
  1. 7
      samples/bluetooth/tmap_peripheral/src/ccp_call_ctrl.c
  2. 5
      samples/bluetooth/tmap_peripheral/src/main.c

7
samples/bluetooth/tmap_peripheral/src/ccp_call_ctrl.c

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
@ -139,6 +140,12 @@ int ccp_originate_call(void) @@ -139,6 +140,12 @@ int ccp_originate_call(void)
int err;
char uri[CONFIG_BT_TBS_MAX_URI_LENGTH];
/* If remote_uri is empty then we cannot place a call */
if (remote_uri[0] == '\0') {
printk("Remote does not support any URI schemes, cannot place call\n");
return -ENOENT;
}
strcpy(uri, remote_uri);
strcat(uri, URI_SEPARATOR);
strcat(uri, CALLER_ID);

5
samples/bluetooth/tmap_peripheral/src/main.c

@ -289,9 +289,10 @@ int main(void) @@ -289,9 +289,10 @@ int main(void)
err = ccp_originate_call();
if (err != 0) {
printk("Error sending call originate command!\n");
} else {
/* Start timer to send terminate call command */
k_work_schedule(&call_terminate_set_work, K_MSEC(2000));
}
/* Start timer to send terminate call command */
k_work_schedule(&call_terminate_set_work, K_MSEC(2000));
}
if (peer_is_ums) {

Loading…
Cancel
Save