nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
unicast_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef _UNICAST_CLIENT_H_
8#define _UNICAST_CLIENT_H_
9
10#include "bt_le_audio_tx.h"
11
12#include <zephyr/bluetooth/audio/audio.h>
13#include <audio_defines.h>
14
16 UNICAST_SERVER_SINK = BT_AUDIO_DIR_SINK,
17 UNICAST_SERVER_SOURCE = BT_AUDIO_DIR_SOURCE,
18 UNICAST_SERVER_BIDIR = (BT_AUDIO_DIR_SINK | BT_AUDIO_DIR_SOURCE)
19};
20
21#if CONFIG_BT_BAP_UNICAST_CONFIGURABLE
22#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \
23 BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA, \
24 CONFIG_BT_AUDIO_BITRATE_UNICAST_SINK)
25
26#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE \
27 BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA, \
28 CONFIG_BT_AUDIO_BITRATE_UNICAST_SRC)
29
30#elif CONFIG_BT_BAP_UNICAST_16_2_1
31#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \
32 BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA)
33
34#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE \
35 BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA)
36
37#elif CONFIG_BT_BAP_UNICAST_24_2_1
38#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \
39 BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA)
40
41#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE \
42 BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_MEDIA)
43#elif CONFIG_BT_BAP_UNICAST_48_4_1
44#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \
45 BT_BAP_LC3_UNICAST_PRESET_48_4_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_MEDIA)
46
47#define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE \
48 BT_BAP_LC3_UNICAST_PRESET_48_4_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_MEDIA)
49#else
50#error Unsupported LC3 codec preset for unicast
51#endif /* CONFIG_BT_BAP_UNICAST_CONFIGURABLE */
52
63int unicast_client_config_get(struct bt_conn *conn, enum bt_audio_dir dir, uint32_t *bitrate,
64 uint32_t *sampling_rate_hz);
65
76int unicast_client_discover(struct bt_conn *conn, enum unicast_discover_dir dir);
77
83void unicast_client_conn_disconnected(struct bt_conn *conn);
84
94int unicast_client_start(uint8_t cig_index);
95
105int unicast_client_stop(uint8_t cig_index);
106
115int unicast_client_send(uint8_t cig_index, struct le_audio_encoded_audio enc_audio);
116
124int unicast_client_disable(uint8_t cig_index);
125
134int unicast_client_enable(uint8_t cig_index, le_audio_receive_cb recv_cb);
135
136#endif /* _UNICAST_CLIENT_H_ */
Globally accessible audio related defines.
void(* le_audio_receive_cb)(const uint8_t *const data, size_t size, bool bad_frame, uint32_t sdu_ref, enum audio_channel channel_index, size_t desired_size)
Callback for receiving Bluetooth LE Audio data.
Definition: le_audio.h:54
Encoded audio data and information.
Definition: le_audio.h:63
int unicast_client_disable(uint8_t cig_index)
Disable the Bluetooth LE Audio unicast (CIS) client.
int unicast_client_send(uint8_t cig_index, struct le_audio_encoded_audio enc_audio)
Send encoded audio using the Bluetooth LE Audio unicast.
int unicast_client_enable(uint8_t cig_index, le_audio_receive_cb recv_cb)
Enable the Bluetooth LE Audio unicast (CIS) client.
int unicast_client_discover(struct bt_conn *conn, enum unicast_discover_dir dir)
Start service discovery for a Bluetooth LE Audio unicast (CIS) server.
int unicast_client_config_get(struct bt_conn *conn, enum bt_audio_dir dir, uint32_t *bitrate, uint32_t *sampling_rate_hz)
Get configuration for the audio stream.
unicast_discover_dir
Definition: unicast_client.h:15
@ UNICAST_SERVER_SINK
Definition: unicast_client.h:16
@ UNICAST_SERVER_BIDIR
Definition: unicast_client.h:18
@ UNICAST_SERVER_SOURCE
Definition: unicast_client.h:17
int unicast_client_start(uint8_t cig_index)
Start the Bluetooth LE Audio unicast (CIS) client.
int unicast_client_stop(uint8_t cig_index)
Stop the Bluetooth LE Audio unicast (CIS) client.
void unicast_client_conn_disconnected(struct bt_conn *conn)
Handle a disconnected Bluetooth LE Audio unicast (CIS) server.