Zephyr Project API 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
csip.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2021-2024 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_
13#define ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_
14
30#include <stdbool.h>
31#include <stddef.h>
32#include <stdint.h>
33
34#include <zephyr/autoconf.h>
39#include <zephyr/kernel.h>
40#include <zephyr/sys/slist.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
47#define BT_CSIP_SET_COORDINATOR_DISCOVER_TIMER_VALUE K_SECONDS(10)
48
53#if defined(CONFIG_BT_CSIP_SET_COORDINATOR)
54#define BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES
55#else
56#define BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES 0
57#endif /* CONFIG_BT_CSIP_SET_COORDINATOR */
58
60#define BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT 0x00
62#define BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC 0x01
64#define BT_CSIP_READ_SIRK_REQ_RSP_REJECT 0x02
66#define BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY 0x03
67
69#define BT_CSIP_SIRK_SIZE 16
70
72#define BT_CSIP_RSI_SIZE 6
73
74/* Coordinate Set Identification Service Error codes */
76#define BT_CSIP_ERROR_LOCK_DENIED 0x80
78#define BT_CSIP_ERROR_LOCK_RELEASE_DENIED 0x81
80#define BT_CSIP_ERROR_LOCK_INVAL_VALUE 0x82
82#define BT_CSIP_ERROR_SIRK_OOB_ONLY 0x83
84#define BT_CSIP_ERROR_LOCK_ALREADY_GRANTED 0x84
85
94#define BT_CSIP_DATA_RSI(_rsi) BT_DATA(BT_DATA_CSIS_RSI, _rsi, BT_CSIP_RSI_SIZE)
95
97struct bt_csip_set_member_svc_inst;
98
112 void (*lock_changed)(struct bt_conn *conn,
113 struct bt_csip_set_member_svc_inst *svc_inst,
114 bool locked);
115
129 uint8_t (*sirk_read_req)(struct bt_conn *conn,
130 struct bt_csip_set_member_svc_inst *svc_inst);
131};
132
141
149
156
165
168
169#if CONFIG_BT_CSIP_SET_MEMBER_MAX_INSTANCE_COUNT > 1 || defined(__DOXYGEN__)
179 const struct bt_gatt_service *parent;
180#endif /* CONFIG_BT_CSIP_SET_MEMBER_MAX_INSTANCE_COUNT > 1 */
181};
182
192void *bt_csip_set_member_svc_decl_get(const struct bt_csip_set_member_svc_inst *svc_inst);
193
210 struct bt_csip_set_member_svc_inst **svc_inst);
211
221int bt_csip_set_member_unregister(struct bt_csip_set_member_svc_inst *svc_inst);
222
229int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
230 const uint8_t sirk[BT_CSIP_SIRK_SIZE]);
231
252int bt_csip_set_member_set_size_and_rank(struct bt_csip_set_member_svc_inst *svc_inst, uint8_t size,
253 uint8_t rank);
254
283
293int bt_csip_set_member_get_info(const struct bt_csip_set_member_svc_inst *svc_inst,
294 struct bt_csip_set_member_set_info *info);
295
306int bt_csip_set_member_generate_rsi(const struct bt_csip_set_member_svc_inst *svc_inst,
308
320int bt_csip_set_member_lock(struct bt_csip_set_member_svc_inst *svc_inst,
321 bool lock, bool force);
322
350
364
370
381 struct bt_conn *conn,
382 const struct bt_csip_set_coordinator_set_member *member,
383 int err, size_t set_count);
384
393int bt_csip_set_coordinator_discover(struct bt_conn *conn);
394
409
416typedef void (*bt_csip_set_coordinator_lock_set_cb)(int err);
417
429 struct bt_csip_set_coordinator_csis_inst *inst, bool locked);
430
440
457 struct bt_conn *conn, const struct bt_csip_set_coordinator_csis_inst *inst);
458
474 const struct bt_csip_set_coordinator_set_info *set_info,
475 int err, bool locked,
477
504
514 struct bt_data *data);
515
524
537 const struct bt_csip_set_coordinator_set_info *set_info,
538 struct bt_csip_set_coordinator_set_member *members[],
539 size_t count);
540
565 const struct bt_csip_set_coordinator_set_member *members[],
566 uint8_t count,
567 const struct bt_csip_set_coordinator_set_info *set_info,
569
587 uint8_t count,
588 const struct bt_csip_set_coordinator_set_info *set_info);
589
605 uint8_t count,
606 const struct bt_csip_set_coordinator_set_info *set_info);
607
608#ifdef __cplusplus
609}
610#endif
611
616#endif /* ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem core APIs.
Bluetooth connection handling.
Bluetooth Generic Access Profile defines and Assigned Numbers.
int bt_csip_set_coordinator_register_cb(struct bt_csip_set_coordinator_cb *cb)
Registers callbacks for csip_set_coordinator.
void(* bt_csip_set_coordinator_ordered_access_cb_t)(const struct bt_csip_set_coordinator_set_info *set_info, int err, bool locked, struct bt_csip_set_coordinator_set_member *member)
Callback for bt_csip_set_coordinator_ordered_access()
Definition csip.h:473
void(* bt_csip_set_coordinator_lock_set_cb)(int err)
Callback for locking a set across one or more devices.
Definition csip.h:416
void(* bt_csip_set_coordinator_sirk_changed_cb)(struct bt_csip_set_coordinator_csis_inst *inst)
Callback when the SIRK value of a set of a connected device changes.
Definition csip.h:438
bool(* bt_csip_set_coordinator_ordered_access_t)(const struct bt_csip_set_coordinator_set_info *set_info, struct bt_csip_set_coordinator_set_member *members[], size_t count)
Callback function definition for bt_csip_set_coordinator_ordered_access()
Definition csip.h:536
int bt_csip_set_coordinator_lock(const struct bt_csip_set_coordinator_set_member **members, uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info)
Lock an array of set members.
#define BT_CSIP_SIRK_SIZE
Size of the Set Identification Resolving Key (SIRK)
Definition csip.h:69
#define BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES
Defines the maximum number of Coordinated Set Identification service instances for the Coordinated Se...
Definition csip.h:56
void(* bt_csip_set_coordinator_lock_changed_cb)(struct bt_csip_set_coordinator_csis_inst *inst, bool locked)
Callback when the lock value on a set of a connected device changes.
Definition csip.h:428
int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_member **members, uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info)
Release an array of set members.
#define BT_CSIP_RSI_SIZE
Size of the Resolvable Set Identifier (RSI)
Definition csip.h:72
int bt_csip_set_coordinator_discover(struct bt_conn *conn)
Initialise the csip_set_coordinator instance for a connection.
struct bt_csip_set_coordinator_set_member * bt_csip_set_coordinator_set_member_by_conn(const struct bt_conn *conn)
Get the set member from a connection pointer.
int bt_csip_set_member_generate_rsi(const struct bt_csip_set_member_svc_inst *svc_inst, uint8_t rsi[6])
Generate the Resolvable Set Identifier (RSI) value.
int bt_csip_set_member_lock(struct bt_csip_set_member_svc_inst *svc_inst, bool lock, bool force)
Locks a specific Coordinated Set Identification Service instance on the server.
void(* bt_csip_set_coordinator_size_changed_cb)(struct bt_conn *conn, const struct bt_csip_set_coordinator_csis_inst *inst)
Callback when the size of a set of a connected device changes.
Definition csip.h:456
int bt_csip_set_member_unregister(struct bt_csip_set_member_svc_inst *svc_inst)
Unregister a Coordinated Set Identification Service instance.
int bt_csip_set_member_register(const struct bt_csip_set_member_register_param *param, struct bt_csip_set_member_svc_inst **svc_inst)
Register a Coordinated Set Identification Service instance.
void * bt_csip_set_member_svc_decl_get(const struct bt_csip_set_member_svc_inst *svc_inst)
Get the service declaration attribute.
bool bt_csip_set_coordinator_is_set_member(const uint8_t sirk[16], struct bt_data *data)
Check if advertising data indicates a set member.
int bt_csip_set_coordinator_ordered_access(const struct bt_csip_set_coordinator_set_member *members[], uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info, bt_csip_set_coordinator_ordered_access_t cb)
Access Coordinated Set devices in an ordered manner as a client.
int bt_csip_set_member_get_info(const struct bt_csip_set_member_svc_inst *svc_inst, struct bt_csip_set_member_set_info *info)
Get information about a service instances.
int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst, const uint8_t sirk[16])
Set the SIRK of a service instance.
void(* bt_csip_set_coordinator_discover_cb)(struct bt_conn *conn, const struct bt_csip_set_coordinator_set_member *member, int err, size_t set_count)
Callback for discovering Coordinated Set Identification Services.
Definition csip.h:380
int bt_csip_set_member_set_size_and_rank(struct bt_csip_set_member_svc_inst *svc_inst, uint8_t size, uint8_t rank)
Set a new size and rank for a service instance.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public kernel APIs.
#define bool
Definition stdbool.h:13
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Bluetooth LE Device Address.
Definition addr.h:49
Struct to hold the Coordinated Set Identification Profile Set Coordinator callbacks.
Definition csip.h:483
bt_csip_set_coordinator_lock_set_cb lock_set
Callback when locking a set has finished.
Definition csip.h:487
bt_csip_set_coordinator_sirk_changed_cb sirk_changed
Callback when a set's SIRK has changed.
Definition csip.h:493
bt_csip_set_coordinator_discover_cb discover
Callback when discovery has finished.
Definition csip.h:485
bt_csip_set_coordinator_size_changed_cb size_changed
Callback when a set's size has changed.
Definition csip.h:495
bt_csip_set_coordinator_lock_set_cb release_set
Callback when unlocking a set has finished.
Definition csip.h:489
bt_csip_set_coordinator_lock_changed_cb lock_changed
Callback when a set's lock state has changed.
Definition csip.h:491
bt_csip_set_coordinator_ordered_access_cb_t ordered_access
Callback for the ordered access procedure.
Definition csip.h:497
Struct representing a coordinated set instance on a remote device.
Definition csip.h:357
struct bt_csip_set_coordinator_set_info info
Information about the coordinated set.
Definition csip.h:359
void * svc_inst
Internally used pointer value.
Definition csip.h:362
Information about a specific set.
Definition csip.h:324
uint8_t rank
The rank of the set on the remote device.
Definition csip.h:345
uint8_t sirk[16]
The 16 octet set Set Identity Resolving Key (SIRK)
Definition csip.h:331
bool lockable
Whether or not the set can be locked on this device.
Definition csip.h:348
uint8_t set_size
The size of the set.
Definition csip.h:338
Struct representing a remote device as a set member.
Definition csip.h:366
struct bt_csip_set_coordinator_csis_inst insts[0]
Array of Coordinated Set Identification Service instances for the remote device.
Definition csip.h:368
Callback structure for the Coordinated Set Identification Service.
Definition csip.h:100
uint8_t(* sirk_read_req)(struct bt_conn *conn, struct bt_csip_set_member_svc_inst *svc_inst)
Request from a peer device to read the sirk.
Definition csip.h:129
void(* lock_changed)(struct bt_conn *conn, struct bt_csip_set_member_svc_inst *svc_inst, bool locked)
Callback whenever the lock changes on the server.
Definition csip.h:112
Register structure for Coordinated Set Identification Service.
Definition csip.h:134
struct bt_csip_set_member_cb * cb
Pointer to the callback structure.
Definition csip.h:167
const struct bt_gatt_service * parent
Parent service pointer.
Definition csip.h:179
uint8_t sirk[16]
The unique Set Identity Resolving Key (SIRK)
Definition csip.h:148
bool lockable
Boolean to set whether the set is lockable by clients.
Definition csip.h:155
uint8_t rank
Rank of this device in this set.
Definition csip.h:164
uint8_t set_size
Size of the set.
Definition csip.h:140
Struct to hold information about a service instance.
Definition csip.h:256
bool lockable
Whether the set is lockable
Definition csip.h:271
bt_addr_le_t lock_client_addr
The address of the client that currently holds the lock.
Definition csip.h:281
uint8_t rank
The rank.
Definition csip.h:268
bool locked
Whether the set is currently locked.
Definition csip.h:274
uint8_t sirk[16]
The 16-octet SIRK.
Definition csip.h:258
uint8_t set_size
The set size.
Definition csip.h:261
Bluetooth data.
Definition bluetooth.h:531
GATT Service structure.
Definition gatt.h:332