nRF Connect SDK API 3.3.99
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
15#ifndef _UNICAST_CLIENT_H_
16#define _UNICAST_CLIENT_H_
17
18#include "bt_le_audio_tx.h"
19
20#include <zephyr/bluetooth/audio/audio.h>
21#include <audio_defines.h>
22
27 UNICAST_SERVER_SINK = BT_AUDIO_DIR_SINK,
28 UNICAST_SERVER_SOURCE = BT_AUDIO_DIR_SOURCE,
29 UNICAST_SERVER_BIDIR = (BT_AUDIO_DIR_SINK | BT_AUDIO_DIR_SOURCE)
30};
31
32#if CONFIG_BT_BAP_UNICAST_CONFIGURABLE
33#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SINK \
34 BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \
35 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED, \
36 CONFIG_BT_AUDIO_BITRATE_UNICAST_SINK)
37
38#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SOURCE \
39 BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \
40 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED, \
41 CONFIG_BT_AUDIO_BITRATE_UNICAST_SRC)
42
43#elif CONFIG_BT_BAP_UNICAST_16_2_1
44#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SINK \
45 BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, \
46 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
47
48#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SOURCE \
49 BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, \
50 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
51
52#elif CONFIG_BT_BAP_UNICAST_24_2_1
53#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SINK \
54 BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, \
55 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
56
57#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SOURCE \
58 BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_FRONT_LEFT, \
59 BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
60#elif CONFIG_BT_BAP_UNICAST_48_4_1
61#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SINK \
62 BT_BAP_LC3_UNICAST_PRESET_48_4_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
63
64#define BT_BAP_LC3_UNICAST_PRESET_NRF_AUDIO_SOURCE \
65 BT_BAP_LC3_UNICAST_PRESET_48_4_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED)
66#else
67#error Unsupported LC3 codec preset for unicast
68#endif /* CONFIG_BT_BAP_UNICAST_CONFIGURABLE */
69
79int unicast_client_config_get(struct bt_bap_stream *stream, uint32_t *bitrate,
80 uint32_t *sampling_rate_hz);
81
90int unicast_client_locations_get(uint32_t *locations, enum bt_audio_dir dir);
91
102int unicast_client_discover(struct bt_conn *conn, enum unicast_discover_dir dir);
103
109void unicast_client_conn_disconnected(struct bt_conn *conn);
110
120int unicast_client_start(uint8_t cig_index);
121
131int unicast_client_stop(uint8_t cig_index);
132
141int unicast_client_send(struct net_buf const *const audio_frame, uint8_t cig_index);
142
150int unicast_client_disable(uint8_t cig_index);
151
160int unicast_client_enable(uint8_t cig_index, le_audio_receive_cb recv_cb);
161
167#endif /* _UNICAST_CLIENT_H_ */
Globally accessible audio related defines.
void(* le_audio_receive_cb)(struct net_buf *audio_frame, struct audio_metadata *meta, uint8_t location_index)
Callback for receiving Bluetooth LE Audio data.
Definition le_audio.h:66
int unicast_client_disable(uint8_t cig_index)
Disable the Bluetooth LE Audio unicast (CIS) client.
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_send(struct net_buf const *const audio_frame, uint8_t cig_index)
Send encoded audio using the Bluetooth LE Audio unicast.
int unicast_client_locations_get(uint32_t *locations, enum bt_audio_dir dir)
Get the current audio locations used by the unicast client.
int unicast_client_config_get(struct bt_bap_stream *stream, uint32_t *bitrate, uint32_t *sampling_rate_hz)
Get configuration for the audio stream.
unicast_discover_dir
Unicast discovery direction enumeration.
Definition unicast_client.h:26
@ UNICAST_SERVER_SINK
Definition unicast_client.h:27
@ UNICAST_SERVER_BIDIR
Definition unicast_client.h:29
@ UNICAST_SERVER_SOURCE
Definition unicast_client.h:28
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.