Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
csis.h
Go to the documentation of this file.
1
7#ifndef ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_
8#define ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_
9
21#include <zephyr/types.h>
22#include <stdbool.h>
23#include <bluetooth/conn.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30#define CSIS_CLIENT_DISCOVER_TIMER_VALUE K_SECONDS(10)
31
32#if defined(CONFIG_BT_CSIS_CLIENT)
33#define BT_CSIS_CLIENT_MAX_CSIS_INSTANCES CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES
34#else
35#define BT_CSIS_CLIENT_MAX_CSIS_INSTANCES 0
36#endif /* CONFIG_BT_CSIS_CLIENT */
37
39#define BT_CSIS_MINIMUM_SET_SIZE 2
40
42#define BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT 0x00
44#define BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC 0x01
46#define BT_CSIS_READ_SIRK_REQ_RSP_REJECT 0x02
48#define BT_CSIS_READ_SIRK_REQ_RSP_OOB_ONLY 0x03
49
51#define BT_CSIS_SET_SIRK_SIZE 16
52
53/* Coordinate Set Identification Service Error codes */
55#define BT_CSIS_ERROR_LOCK_DENIED 0x80
57#define BT_CSIS_ERROR_LOCK_RELEASE_DENIED 0x81
59#define BT_CSIS_ERROR_LOCK_INVAL_VALUE 0x82
61#define BT_CSIS_ERROR_SIRK_OOB_ONLY 0x83
63#define BT_CSIS_ERROR_LOCK_ALREADY_GRANTED 0x84
64
66struct bt_csis;
67
69struct bt_csis_cb {
80 void (*lock_changed)(struct bt_conn *conn, struct bt_csis *csis,
81 bool locked);
82
95 uint8_t (*sirk_read_req)(struct bt_conn *conn, struct bt_csis *csis);
96};
97
107
115
122
131
133 struct bt_csis_cb *cb;
134};
135
145void *bt_csis_svc_decl_get(const struct bt_csis *csis);
146
162 struct bt_csis **csis);
163
169void bt_csis_print_sirk(const struct bt_csis *csis);
170
181int bt_csis_advertise(struct bt_csis *csis, bool enable);
182
194int bt_csis_lock(struct bt_csis *csis, bool lock, bool force);
195
205
212
219};
220
229
231 struct bt_csis *csis;
232};
233
237 struct bt_conn *conn;
240};
241
251 int err, uint8_t set_count);
252
262
269typedef void (*bt_csis_client_lock_set_cb)(int err);
270
282 bool locked);
283
297typedef void (*bt_csis_client_lock_state_read_cb)(const struct bt_csis_client_set_info *set_info,
298 int err, bool locked);
299
301 /* Set callbacks */
305
306 /* Device specific callbacks */
309};
310
320 struct bt_data *data);
321
328
344 const struct bt_csis_client_set_info *set_info);
345
362 const struct bt_csis_client_set_info *set_info);
363
378 const struct bt_csis_client_set_info *set_info);
379
380
381#ifdef __cplusplus
382}
383#endif
384
389#endif /* ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_ */
ZTEST_BMEM int count
Definition: main.c:33
Bluetooth connection handling.
void * bt_csis_svc_decl_get(const struct bt_csis *csis)
Get the service declaration attribute.
void(* bt_csis_client_lock_changed_cb)(struct bt_csis_client_csis_inst *inst, bool locked)
Callback when the lock value on a set of a connected device changes.
Definition: csis.h:281
int bt_csis_client_lock(const struct bt_csis_client_set_member **members, uint8_t count, const struct bt_csis_client_set_info *set_info)
Lock an array of set members.
#define BT_CSIS_CLIENT_MAX_CSIS_INSTANCES
Definition: csis.h:35
int bt_csis_client_discover(struct bt_csis_client_set_member *member)
Initialise the csis_client instance for a connection. This will do a discovery on the device and prep...
int bt_csis_register(const struct bt_csis_register_param *param, struct bt_csis **csis)
Register a Coordinated Set Identification Service instance.
int bt_csis_advertise(struct bt_csis *csis, bool enable)
Starts advertising the Resolveable Set Identifier value.
int bt_csis_client_release(const struct bt_csis_client_set_member **members, uint8_t count, const struct bt_csis_client_set_info *set_info)
Release an array of set members.
bool bt_csis_client_is_set_member(uint8_t set_sirk[16], struct bt_data *data)
Check if advertising data indicates a set member.
int bt_csis_lock(struct bt_csis *csis, bool lock, bool force)
Locks a specific Coordinated Set Identification Service instance on the server.
void(* bt_csis_client_discover_cb)(struct bt_csis_client_set_member *member, int err, uint8_t set_count)
Callback for discovering Coordinated Set Identification Services.
Definition: csis.h:250
int bt_csis_client_get_lock_state(const struct bt_csis_client_set_member **members, uint8_t count, const struct bt_csis_client_set_info *set_info)
Check if an array of set members are unlocked.
void bt_csis_print_sirk(const struct bt_csis *csis)
Print the SIRK to the debug output.
void(* bt_csis_client_lock_state_read_cb)(const struct bt_csis_client_set_info *set_info, int err, bool locked)
Callback for bt_csis_client_get_lock_state()
Definition: csis.h:297
void bt_csis_client_register_cb(struct bt_csis_client_cb *cb)
Registers callbacks for csis_client.
void(* bt_csis_client_lock_set_cb)(int err)
Callback for locking a set across one or more devices.
Definition: csis.h:269
#define BT_CSIS_SET_SIRK_SIZE
Definition: csis.h:51
static struct k_spinlock lock
Definition: spinlock_error_case.c:12
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Definition: csis.h:69
uint8_t(* sirk_read_req)(struct bt_conn *conn, struct bt_csis *csis)
Request from a peer device to read the sirk.
Definition: csis.h:95
void(* lock_changed)(struct bt_conn *conn, struct bt_csis *csis, bool locked)
Callback whenever the lock changes on the server.
Definition: csis.h:80
Definition: csis.h:300
bt_csis_client_lock_set_cb release_set
Definition: csis.h:303
bt_csis_client_lock_changed_cb lock_changed
Definition: csis.h:304
bt_csis_client_lock_state_read_cb lock_state_read
Definition: csis.h:308
bt_csis_client_discover_cb discover
Definition: csis.h:307
bt_csis_client_lock_set_cb lock_set
Definition: csis.h:302
Struct representing a coordinated set instance on a remote device.
Definition: csis.h:227
struct bt_csis * csis
Definition: csis.h:231
struct bt_csis_client_set_info info
Definition: csis.h:228
Definition: csis.h:197
uint8_t set_sirk[16]
The 16 octet set Set Identity Resolving Key (SIRK)
Definition: csis.h:204
uint8_t set_size
The size of the set.
Definition: csis.h:211
uint8_t rank
The rank of the set on on the remote device.
Definition: csis.h:218
Definition: csis.h:235
struct bt_conn * conn
Definition: csis.h:237
struct bt_csis_client_csis_inst insts[0]
Definition: csis.h:239
Definition: csis.h:99
uint8_t set_sirk[16]
The unique Set Identity Resolving Key (SIRK)
Definition: csis.h:114
uint8_t rank
Rank of this device in this set.
Definition: csis.h:130
bool lockable
Boolean to set whether the set is lockable by clients.
Definition: csis.h:121
struct bt_csis_cb * cb
Definition: csis.h:133
uint8_t set_size
Size of the set.
Definition: csis.h:106
Bluetooth data.
Definition: bluetooth.h:293
static fdata_t data[2]
Definition: test_fifo_contexts.c:15