16#ifndef _SERVER_STORE_H_
17#define _SERVER_STORE_H_
19#include <zephyr/bluetooth/conn.h>
20#include <zephyr/bluetooth/audio/audio.h>
21#include <zephyr/bluetooth/audio/csip.h>
22#include <zephyr/bluetooth/audio/cap.h>
23#include <zephyr/bluetooth/audio/bap.h>
24#include <zephyr/bluetooth/audio/bap_lc3_preset.h>
25#include <zephyr/bluetooth/addr.h>
30 struct bt_bap_lc3_preset
lc3_preset[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
31 struct bt_audio_codec_cap
codec_caps[CONFIG_CODEC_CAP_COUNT_MAX];
33 struct bt_bap_ep *
eps[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
37 struct bt_cap_stream
cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
43 struct bt_bap_lc3_preset
lc3_preset[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
44 struct bt_audio_codec_cap
codec_caps[CONFIG_CODEC_CAP_COUNT_MAX];
46 struct bt_bap_ep *
eps[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
50 struct bt_cap_stream
cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
58 const struct bt_csip_set_coordinator_set_member *
member;
64 enum bt_audio_codec_cap_freq
freq;
65 enum bt_audio_codec_cap_frame_dur
dur;
108 struct bt_audio_codec_cfg
const *
const existing,
109 uint8_t pref_sample_rate_value);
134 uint32_t *existing_pres_dly_us,
135 struct bt_bap_qos_cfg_pref
const *server_qos_pref,
136 bool *group_reconfig_needed,
137 struct bt_cap_unicast_group *unicast_group);
153 enum bt_audio_location loc);
173 uint32_t *valid_codec_caps,
175 uint8_t num_client_supp_cfgs);
217 enum bt_audio_context src_ctx);
234 struct bt_audio_codec_cap
const *
const codec);
422int _srv_store_lock(k_timeout_t timeout,
const char *file,
int line);
425#define srv_store_lock(timeout) _srv_store_lock(timeout, __func__, __LINE__)
427#define srv_store_lock(timeout) _srv_store_lock(timeout, NULL, 0)
int srv_store_num_get(void)
Get the number of stored servers.
int srv_store_all_ep_state_count(enum bt_bap_ep_state state, enum bt_audio_dir dir)
Get the number of endpoints in a given state across all stored servers.
bool srv_store_preset_validated(struct bt_audio_codec_cfg const *const new, struct bt_audio_codec_cfg const *const existing, uint8_t pref_sample_rate_value)
Validate the codec configuration preset.
int srv_store_remove_by_conn(struct bt_conn const *const conn)
Remove a server by conn pointer.
void srv_store_unlock(void)
Give the server store semaphore to unlock server store.
int srv_store_init(void)
Initialize the server store and clear all contents.
int srv_store_from_stream_get(struct bt_bap_stream const *const stream, struct server_store **server)
Get a server based on stream pointer.
int srv_store_location_set(struct bt_conn const *const conn, enum bt_audio_dir dir, enum bt_audio_location loc)
Set the valid locations of a unicast server.
int srv_store_conn_update(struct bt_conn *conn, bt_addr_le_t const *const addr)
Update the conn pointer of an existing server, based on address.
int srv_store_remove_by_addr(bt_addr_le_t const *const addr)
Remove a single stored server based on address.
int srv_store_valid_codec_cap_check(struct bt_conn const *const conn, enum bt_audio_dir dir, uint32_t *valid_codec_caps, struct client_supp_configs const **const client_supp_cfgs, uint8_t num_client_supp_cfgs)
Check which codec capabilities are valid.
int srv_store_add_by_conn(struct bt_conn *conn)
Add a server to the storage based on conn.
int srv_store_remove_all(bool force)
Remove all servers.
int srv_store_avail_context_set(struct bt_conn *conn, enum bt_audio_context snk_ctx, enum bt_audio_context src_ctx)
Store the available audio context for a server based on conn.
int srv_store_add_by_addr(const bt_addr_le_t *addr)
Add a server to the storage based on address.
bool(* srv_store_foreach_func_t)(struct server_store *server, void *user_data)
Function for bt_bap_unicast_group_foreach_server().
Definition server_store.h:79
bool srv_store_server_exists(bt_addr_le_t const *const addr)
Check if there is a server with the given address in the server store.
int srv_store_foreach_server(srv_store_foreach_func_t func, void *user_data)
Iterate through all stored servers and call the given function for each.
int srv_store_pres_dly_find(struct bt_bap_stream *stream, uint32_t *computed_pres_dly_us, uint32_t *existing_pres_dly_us, struct bt_bap_qos_cfg_pref const *server_qos_pref, bool *group_reconfig_needed, struct bt_cap_unicast_group *unicast_group)
Search for a common presentation delay across all server Audio Stream Endpoints (ASEs) in a given uni...
int srv_store_from_conn_get(struct bt_conn const *const conn, struct server_store **server)
Get a server from the conn pointer.
int srv_store_codec_cap_set(struct bt_conn const *const conn, enum bt_audio_dir dir, struct bt_audio_codec_cap const *const codec)
Store the codec capabilities for a given server based on conn.
int srv_store_clear_by_conn(struct bt_conn const *const conn)
Clear the contents of a server based on conn pointer.
int srv_store_from_addr_get(bt_addr_le_t const *const addr, struct server_store **server)
Get a server from the address.
enum bt_audio_codec_cap_frame_dur dur
Definition server_store.h:65
enum bt_audio_codec_cap_freq freq
Definition server_store.h:64
struct bt_audio_codec_octets_per_codec_frame oct_per_codec_frame
Definition server_store.h:67
enum bt_audio_codec_cap_chan_count chan_count
Definition server_store.h:66
Definition server_store.h:63
const struct bt_csip_set_coordinator_set_member * member
Definition server_store.h:58
struct bt_conn * conn
Definition server_store.h:57
struct unicast_server_snk_vars snk
Definition server_store.h:59
struct unicast_server_src_vars src
Definition server_store.h:60
bt_addr_le_t addr
Definition server_store.h:56
char * name
Definition server_store.h:55
Definition server_store.h:54
struct bt_cap_stream cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT]
Definition server_store.h:37
size_t num_eps
Definition server_store.h:34
enum bt_audio_context supported_ctx
Definition server_store.h:35
struct bt_bap_ep * eps[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT]
Definition server_store.h:33
bool waiting_for_disc
Definition server_store.h:28
struct bt_bap_lc3_preset lc3_preset[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT]
Definition server_store.h:30
size_t num_codec_caps
Definition server_store.h:32
enum bt_audio_context available_ctx
Definition server_store.h:36
struct bt_audio_codec_cap codec_caps[CONFIG_CODEC_CAP_COUNT_MAX]
Definition server_store.h:31
uint32_t locations
Definition server_store.h:29
Definition server_store.h:27
struct bt_audio_codec_cap codec_caps[CONFIG_CODEC_CAP_COUNT_MAX]
Definition server_store.h:44
uint32_t locations
Definition server_store.h:42
enum bt_audio_context available_ctx
Definition server_store.h:49
enum bt_audio_context supported_ctx
Definition server_store.h:48
struct bt_bap_lc3_preset lc3_preset[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT]
Definition server_store.h:43
size_t num_codec_caps
Definition server_store.h:45
size_t num_eps
Definition server_store.h:47
struct bt_cap_stream cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT]
Definition server_store.h:50
struct bt_bap_ep * eps[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT]
Definition server_store.h:46
bool waiting_for_disc
Definition server_store.h:41
Definition server_store.h:40