1 /* 2 * Copyright 2023 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/types.h> 8 #include <stddef.h> 9 #include <zephyr/kernel.h> 10 #include <zephyr/sys/printk.h> 11 12 #include <zephyr/bluetooth/bluetooth.h> 13 #include <zephyr/bluetooth/audio/audio.h> 14 #include <zephyr/bluetooth/audio/tmap.h> 15 16 #include "tmap_bms.h" 17 init(void)18static int init(void) 19 { 20 int err; 21 22 err = bt_enable(NULL); 23 if (err != 0) { 24 printk("Bluetooth enable failed (err %d)\n", err); 25 return err; 26 } 27 28 printk("Bluetooth initialized\n"); 29 30 return 0; 31 } 32 main(void)33int main(void) 34 { 35 int err; 36 37 err = init(); 38 if (err != 0) { 39 return err; 40 } 41 42 printk("Initializing TMAP and setting role\n"); 43 /* Initialize TMAP */ 44 err = bt_tmap_register(BT_TMAP_ROLE_BMS); 45 if (err != 0) { 46 return err; 47 } 48 49 /* Initialize CAP Initiator */ 50 err = cap_initiator_init(); 51 if (err != 0) { 52 return err; 53 } 54 printk("CAP initialized\n"); 55 56 /* Configure and start broadcast stream */ 57 err = cap_initiator_setup(); 58 if (err != 0) { 59 return err; 60 } 61 62 return 0; 63 } 64