From 4db60883db39ceef6dfbaf8f13101ec86b605d92 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 16 Jan 2023 15:30:56 +0100 Subject: [PATCH] samples: Bluetooth: Unicast audio server: Add missing supported contexts Add missing calls to setting supported contexts. Signed-off-by: Emil Gydesen --- .../bluetooth/unicast_audio_server/src/main.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/samples/bluetooth/unicast_audio_server/src/main.c b/samples/bluetooth/unicast_audio_server/src/main.c index fefc6a50ce6..6de0acca0d6 100644 --- a/samples/bluetooth/unicast_audio_server/src/main.c +++ b/samples/bluetooth/unicast_audio_server/src/main.c @@ -599,6 +599,37 @@ static int set_location(void) return 0; } +static int set_supported_contexts(void) +{ + int err; + + if (IS_ENABLED(CONFIG_BT_PAC_SNK)) { + err = bt_pacs_set_supported_contexts(BT_AUDIO_DIR_SINK, + AVAILABLE_SINK_CONTEXT); + if (err != 0) { + printk("Failed to set sink supported contexts (err %d)\n", + err); + + return err; + } + } + + if (IS_ENABLED(CONFIG_BT_PAC_SRC)) { + err = bt_pacs_set_supported_contexts(BT_AUDIO_DIR_SOURCE, + AVAILABLE_SOURCE_CONTEXT); + if (err != 0) { + printk("Failed to set source supported contexts (err %d)\n", + err); + + return err; + } + } + + printk("Supported contexts successfully set\n"); + + return 0; +} + static int set_available_contexts(void) { int err; @@ -652,6 +683,11 @@ void main(void) return; } + err = set_supported_contexts(); + if (err != 0) { + return; + } + err = set_available_contexts(); if (err != 0) { return;