Bluetooth: Audio: Rename CSIS to CSIP
Renamed the coordinated set implementation to use the
profile (CSIP) name instead of the service (CSIS) name, as
the former is more general.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
diff --git a/doc/connectivity/bluetooth/api/coordinated_sets.rst b/doc/connectivity/bluetooth/api/coordinated_sets.rst
index 4254609..1e84678 100644
--- a/doc/connectivity/bluetooth/api/coordinated_sets.rst
+++ b/doc/connectivity/bluetooth/api/coordinated_sets.rst
@@ -7,4 +7,4 @@
API Reference
*************
-.. doxygengroup:: bt_gatt_csis
+.. doxygengroup:: bt_gatt_csip
diff --git a/doc/connectivity/bluetooth/api/shell/csip.rst b/doc/connectivity/bluetooth/api/shell/csip.rst
index 052d87a..f8b856b 100644
--- a/doc/connectivity/bluetooth/api/shell/csip.rst
+++ b/doc/connectivity/bluetooth/api/shell/csip.rst
@@ -27,7 +27,7 @@
When the Bluetooth stack has been initialized (:code:`bt init`),
and a set member device has been connected, the call control client can be
-initialized by calling :code:`csis_client init`, which will start a discovery
+initialized by calling :code:`csip_set_coordinator init`, which will start a discovery
for the TBS uuids and store the handles, and optionally subscribe to all
notifications (default is to subscribe to all).
@@ -36,15 +36,15 @@
The client can then scan for and connect to the remaining set members, and once
all the members has been connected to, it can lock and release the set.
-It is necessary to enable :code:`BT_DEBUG_CSIS_CLIENT` to properly use the set
+It is necessary to enable :code:`BT_DEBUG_CSIP_SET_COORDINATOR` to properly use the set
coordinator.
.. code-block:: console
- csis_client --help
- csis_client - Bluetooth CSIS_CLIENT shell commands
+ csip_set_coordinator --help
+ csip_set_coordinator - Bluetooth CSIP_SET_COORDINATOR shell commands
Subcommands:
- init :Initialize CSIS_CLIENT
+ init :Initialize CSIP_SET_COORDINATOR
discover :Run discover for CSIS on peer device [member_index]
discover_members :Scan for set members <set_pointer>
lock_set :Lock set
@@ -73,62 +73,62 @@
.. code-block:: console
- uart:~$ csis_client init
- <dbg> bt_csis_client.primary_discover_func: [ATTRIBUTE] handle 0x0048
- <dbg> bt_csis_client.primary_discover_func: Discover complete, found 1 instances
- <dbg> bt_csis_client.discover_func: Setup complete for 1 / 1
+ uart:~$ csip_set_coordinator init
+ <dbg> bt_csip_set_coordinator.primary_discover_func: [ATTRIBUTE] handle 0x0048
+ <dbg> bt_csip_set_coordinator.primary_discover_func: Discover complete, found 1 instances
+ <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
Found 1 sets on device
- uart:~$ csis_client discover_sets
- <dbg> bt_csis_client.Set SIRK
+ uart:~$ csip_set_coordinator discover_sets
+ <dbg> bt_csip_set_coordinator.Set SIRK
36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>.
- <dbg> bt_csis_client.csis_client_discover_sets_read_set_size_cb: 2
- <dbg> bt_csis_client.csis_client_discover_sets_read_set_lock_cb: 1
- <dbg> bt_csis_client.csis_client_discover_sets_read_rank_cb: 1
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 1
Set size 2 (pointer: 0x566fdfe8)
Discover set members, based on the set pointer above:
.. code-block:: console
- uart:~$ csis_client discover_members 0x566fdfe8
- <dbg> bt_csis_client.csis_found: Found CSIS advertiser with address 34:02:86:03:86:c0 (public)
- <dbg> bt_csis_client.is_set_member: hash: 0x33ccb1, prand 0x5bfe6a
- <dbg> bt_csis_client.is_discovered: 34:02:86:03:86:c0 (public)
- <dbg> bt_csis_client.is_discovered: 34:13:e8:b3:7f:9e (public)
- <dbg> bt_csis_client.csis_found: Found member (2 / 2)
+ uart:~$ csip_set_coordinator discover_members 0x566fdfe8
+ <dbg> bt_csip_set_coordinator.csip_found: Found CSIS advertiser with address 34:02:86:03:86:c0 (public)
+ <dbg> bt_csip_set_coordinator.is_set_member: hash: 0x33ccb1, prand 0x5bfe6a
+ <dbg> bt_csip_set_coordinator.is_discovered: 34:02:86:03:86:c0 (public)
+ <dbg> bt_csip_set_coordinator.is_discovered: 34:13:e8:b3:7f:9e (public)
+ <dbg> bt_csip_set_coordinator.csip_found: Found member (2 / 2)
Discovered 2/2 set members
Lock set members:
.. code-block:: console
- uart:~$ csis_client lock_set
- <dbg> bt_csis_client.bt_csis_client_lock_set: Connecting to 34:02:86:03:86:c0 (public)
- <dbg> bt_csis_client.csis_client_connected: Connected to 34:02:86:03:86:c0 (public)
- <dbg> bt_csis_client.discover_func: Setup complete for 1 / 1
- <dbg> bt_csis_client.csis_client_lock_set_init_cb:
- <dbg> bt_csis_client.Set SIRK
+ uart:~$ csip_set_coordinator lock_set
+ <dbg> bt_csip_set_coordinator.bt_csip_set_coordinator_lock_set: Connecting to 34:02:86:03:86:c0 (public)
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_connected: Connected to 34:02:86:03:86:c0 (public)
+ <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_lock_set_init_cb:
+ <dbg> bt_csip_set_coordinator.Set SIRK
36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>.
- <dbg> bt_csis_client.csis_client_discover_sets_read_set_size_cb: 2
- <dbg> bt_csis_client.csis_client_discover_sets_read_set_lock_cb: 1
- <dbg> bt_csis_client.csis_client_discover_sets_read_rank_cb: 2
- <dbg> bt_csis_client.csis_client_write_lowest_rank: Locking member with rank 1
- <dbg> bt_csis_client.notify_func: Instance 0 lock was locked
- <dbg> bt_csis_client.csis_client_write_lowest_rank: Locking member with rank 2
- <dbg> bt_csis_client.notify_func: Instance 0 lock was locked
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 2
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 1
+ <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 2
+ <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
Set locked
Release set members:
.. code-block:: console
- uart:~$ csis_client release_set
- <dbg> bt_csis_client.csis_client_release_highest_rank: Releasing member with rank 2
- <dbg> bt_csis_client.notify_func: Instance 0 lock was released
- <dbg> bt_csis_client.csis_client_release_highest_rank: Releasing member with rank 1
- <dbg> bt_csis_client.notify_func: Instance 0 lock was released
+ uart:~$ csip_set_coordinator release_set
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 2
+ <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
+ <dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 1
+ <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
Set released
Coordinated Set Member (Server)
@@ -141,12 +141,11 @@
.. code-block:: console
- csis --help
- csis - Bluetooth CSIS shell commands
+ csip --help
+ csip - Bluetooth CSIP shell commands
Subcommands:
register :Initialize the service and register callbacks [size <int>]
[rank <int>] [not-lockable] [sirk <data>]
- advertise :Start/stop advertising CSIS PSRIs <on/off>
update_psri :Update the advertised PSRI
lock :Lock the set
release :Release the set [force]
@@ -163,5 +162,4 @@
.. code-block:: console
uart:~$ bt init
- uart:~$ csis register
- uart:~$ csis advertise on
+ uart:~$ csip register
diff --git a/doc/connectivity/bluetooth/bluetooth-audio-arch.rst b/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
index 9282adb..80d05c9 100644
--- a/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
+++ b/doc/connectivity/bluetooth/bluetooth-audio-arch.rst
@@ -132,8 +132,8 @@
The CSIP implementation supports the following roles
-* Coordinated Set Identification Service (CSIS) Server
-* Coordinated Set Identification Service (CSIS) Client
+* Coordinated Set Identification Service (CSIP) Server
+* Coordinated Set Identification Service (CSIP) Set Coordinator
The API reference for media control can be found in
:ref:`Bluetooth Coordinated Sets <bluetooth_coordinated_sets>`.
diff --git a/doc/connectivity/bluetooth/img/zephyr_gaf.svg b/doc/connectivity/bluetooth/img/zephyr_gaf.svg
index 67fa66e..a0e42c9 100644
--- a/doc/connectivity/bluetooth/img/zephyr_gaf.svg
+++ b/doc/connectivity/bluetooth/img/zephyr_gaf.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file with editors other than diagrams.net -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="691px" height="251px" viewBox="-0.5 -0.5 691 251" content="<mxfile host="Electron" modified="2022-03-15T12:49:25.976Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.174 Electron/16.1.0 Safari/537.36" etag="CGwhUKyyGXw_Nl4C97iT" version="16.5.1" type="device"><diagram id="eUOrdC6oSSvFH25F21La" name="Page-1">7Vldb5swFP01edyEIUB4bGmbVmqlbKm6x8nBDlgzmBnna79+pjHhw0zNupJZUZ4w5xoM55x7ucDICdPtlMM8eWII05Ftoe3IuRnZNrBtS25KZLdHfGuyB2JOkJpUA3PyCytQHRevCMJFa6JgjAqSt8GIZRmORAuDnLNNe9qS0faqOYyxBswjSHX0G0EiUSjwgjpwj0mcVEt77ngfSWE1W91KkUDENg3IuR05IWdM7EfpNsS0ZK8iZn/c3R+ihyvjOBPHHICnz8v7+3T78/ElAl/mz9HDDH9SZ1lDulJ3PMUZ5iSS4NUKESa3dxymeMP4j5HtUbnU9YLLUVyOLkgbedVZ7Cr3cLbKEC75t2R4kxCB5zmMyuhG5ovEEpFSuQfkkMIFpjNWEEFYJrFI6oq5DKwxF0Ra8rEzISUIlStdQ0ri3iOuVOAwc0koDRllctINwku4ovV1N51U2UKeB28bkHLWFLMUC76TU1TUdZTLVZ6Px2p/U2eNFygsaSSM7SoQqkyND+euvSwHys5/Ye2xZu2QSX7kLdpWOeKMnlgwwfJj1FowIVgqAwgWyevFgI50Gcvwx+jmd3RzLV03MO7RDUyG0q26ooZwTxgRKKEZZ9vdoBkN01KibFHkg573X2z3EaqPO6qDHtXtPtW9oVS3NdHngmOYXpK1UWS7sk102fpqLLAGy1VNta9YasJJFpfLZaiUD+ZixfFFyFrISfC2kE5v/g2mpKspeX01M6Mx+ojMcTuEBzrhfg/fgz3kfI1uWHbbn5P/T5XXpspzdKrcHqqcoagK9HYgfL8zDXsQ+28XAu+UvgR685VGhQG29CcdW9o6U3196mC2BPqzL5w/nIsxvSMK5mmNqb/ORQUxwZneEQXztM7Un+VPD2dTMgPrbWcCcFJrenrNJEYUzQCYZk2973k5G2cCq/t+1mfN01bNicb32ghnAss1zZp6n7lmZnAFLMO4qnqv5uuLGRUPANN8Zeu+MoSrwLTGxdH/RqXll9/vefnd1wDGfNdtF/ievxx9H+DewZjcrX8NvsYaf1id298=</diagram></mxfile>"><defs/><g><rect x="0" y="0" width="690" height="250" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 688px; height: 1px; padding-top: 125px; margin-left: 1px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Generic Audio Framework<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div></div></div></foreignObject><text x="345" y="129" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Generic Audio Framework...</text></switch></g><rect x="200" y="60" width="140" height="180" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 138px; height: 1px; padding-top: 57px; margin-left: 201px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Content Control</div></div></div></foreignObject><text x="270" y="57" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Content Control</text></switch></g><rect x="210" y="70" width="120" height="160" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 150px; margin-left: 211px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Media Proxy<br /><br /><br /><br /><br /> <br /><br /><br /><br /> </div></div></div></foreignObject><text x="270" y="154" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Media Proxy...</text></switch></g><rect x="10" y="140" width="90" height="100" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 137px; margin-left: 11px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Stream Control</div></div></div></foreignObject><text x="55" y="137" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Stream Control</text></switch></g><rect x="360" y="140" width="320" height="100" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 318px; height: 1px; padding-top: 137px; margin-left: 361px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Rendering and Capture Control</div></div></div></foreignObject><text x="520" y="137" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Rendering and Capture Control</text></switch></g><rect x="20" y="150" width="70" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 68px; height: 1px; padding-top: 190px; margin-left: 21px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">BAP<br /><br /><br /><br /></div></div></div></foreignObject><text x="55" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">BAP...</text></switch></g><rect x="30" y="190" width="50" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 205px; margin-left: 31px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">audio.h</div></div></div></foreignObject><text x="55" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">audio.h</text></switch></g><rect x="240" y="140" width="60" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 180px; margin-left: 241px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">MCP<br /><br /><br /> </div></div></div></foreignObject><text x="270" y="184" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">MCP...</text></switch></g><rect x="250" y="180" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 195px; margin-left: 251px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">mcs.h</div></div></div></foreignObject><text x="270" y="199" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">mcs.h</text></switch></g><rect x="120" y="150" width="60" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 190px; margin-left: 121px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">CSIP<br /><br /><br /> </div></div></div></foreignObject><text x="150" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">CSIP...</text></switch></g><rect x="130" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 131px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">csis.h</div></div></div></foreignObject><text x="150" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">csis.h</text></switch></g><rect x="370" y="150" width="110" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 108px; height: 1px; padding-top: 190px; margin-left: 371px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">MICP<br /><br /><br /> </div></div></div></foreignObject><text x="425" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">MICP...</text></switch></g><rect x="380" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 381px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">micp.h</div></div></div></foreignObject><text x="400" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">micp.h</text></switch></g><rect x="510" y="150" width="160" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 190px; margin-left: 511px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">VCP<br /><br /><br /> </div></div></div></foreignObject><text x="590" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">VCP...</text></switch></g><rect x="520" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 521px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">vcs.h</div></div></div></foreignObject><text x="540" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">vcs.h</text></switch></g><rect x="570" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 571px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">vocs.h</div></div></div></foreignObject><text x="590" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">vocs.h</text></switch></g><rect x="620" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 621px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">aics.h</div></div></div></foreignObject><text x="640" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">aics.h</text></switch></g><rect x="430" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 431px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">aics.h</div></div></div></foreignObject><text x="450" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">aics.h</text></switch></g><rect x="225" y="100" width="90" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 115px; margin-left: 226px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">media_proxy.h</div></div></div></foreignObject><text x="270" y="119" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">media_proxy.h</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="691px" height="251px" viewBox="-0.5 -0.5 691 251" content="<mxfile host="Electron" modified="2022-03-15T12:49:25.976Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.174 Electron/16.1.0 Safari/537.36" etag="CGwhUKyyGXw_Nl4C97iT" version="16.5.1" type="device"><diagram id="eUOrdC6oSSvFH25F21La" name="Page-1">7Vldb5swFP01edyEIUB4bGmbVmqlbKm6x8nBDlgzmBnna79+pjHhw0zNupJZUZ4w5xoM55x7ucDICdPtlMM8eWII05Ftoe3IuRnZNrBtS25KZLdHfGuyB2JOkJpUA3PyCytQHRevCMJFa6JgjAqSt8GIZRmORAuDnLNNe9qS0faqOYyxBswjSHX0G0EiUSjwgjpwj0mcVEt77ngfSWE1W91KkUDENg3IuR05IWdM7EfpNsS0ZK8iZn/c3R+ihyvjOBPHHICnz8v7+3T78/ElAl/mz9HDDH9SZ1lDulJ3PMUZ5iSS4NUKESa3dxymeMP4j5HtUbnU9YLLUVyOLkgbedVZ7Cr3cLbKEC75t2R4kxCB5zmMyuhG5ovEEpFSuQfkkMIFpjNWEEFYJrFI6oq5DKwxF0Ra8rEzISUIlStdQ0ri3iOuVOAwc0koDRllctINwku4ovV1N51U2UKeB28bkHLWFLMUC76TU1TUdZTLVZ6Px2p/U2eNFygsaSSM7SoQqkyND+euvSwHys5/Ye2xZu2QSX7kLdpWOeKMnlgwwfJj1FowIVgqAwgWyevFgI50Gcvwx+jmd3RzLV03MO7RDUyG0q26ooZwTxgRKKEZZ9vdoBkN01KibFHkg573X2z3EaqPO6qDHtXtPtW9oVS3NdHngmOYXpK1UWS7sk102fpqLLAGy1VNta9YasJJFpfLZaiUD+ZixfFFyFrISfC2kE5v/g2mpKspeX01M6Mx+ojMcTuEBzrhfg/fgz3kfI1uWHbbn5P/T5XXpspzdKrcHqqcoagK9HYgfL8zDXsQ+28XAu+UvgR685VGhQG29CcdW9o6U3196mC2BPqzL5w/nIsxvSMK5mmNqb/ORQUxwZneEQXztM7Un+VPD2dTMgPrbWcCcFJrenrNJEYUzQCYZk2973k5G2cCq/t+1mfN01bNicb32ghnAss1zZp6n7lmZnAFLMO4qnqv5uuLGRUPANN8Zeu+MoSrwLTGxdH/RqXll9/vefnd1wDGfNdtF/ievxx9H+DewZjcrX8NvsYaf1id298=</diagram></mxfile>"><defs/><g><rect x="0" y="0" width="690" height="250" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 688px; height: 1px; padding-top: 125px; margin-left: 1px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Generic Audio Framework<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div></div></div></foreignObject><text x="345" y="129" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Generic Audio Framework...</text></switch></g><rect x="200" y="60" width="140" height="180" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 138px; height: 1px; padding-top: 57px; margin-left: 201px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Content Control</div></div></div></foreignObject><text x="270" y="57" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Content Control</text></switch></g><rect x="210" y="70" width="120" height="160" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 150px; margin-left: 211px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Media Proxy<br /><br /><br /><br /><br /> <br /><br /><br /><br /> </div></div></div></foreignObject><text x="270" y="154" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Media Proxy...</text></switch></g><rect x="10" y="140" width="90" height="100" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 137px; margin-left: 11px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Stream Control</div></div></div></foreignObject><text x="55" y="137" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Stream Control</text></switch></g><rect x="360" y="140" width="320" height="100" fill="none" stroke="rgb(0, 0, 0)" stroke-dasharray="3 3" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-end; justify-content: unsafe center; width: 318px; height: 1px; padding-top: 137px; margin-left: 361px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Rendering and Capture Control</div></div></div></foreignObject><text x="520" y="137" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Rendering and Capture Control</text></switch></g><rect x="20" y="150" width="70" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 68px; height: 1px; padding-top: 190px; margin-left: 21px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">BAP<br /><br /><br /><br /></div></div></div></foreignObject><text x="55" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">BAP...</text></switch></g><rect x="30" y="190" width="50" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 205px; margin-left: 31px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">audio.h</div></div></div></foreignObject><text x="55" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">audio.h</text></switch></g><rect x="240" y="140" width="60" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 180px; margin-left: 241px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">MCP<br /><br /><br /> </div></div></div></foreignObject><text x="270" y="184" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">MCP...</text></switch></g><rect x="250" y="180" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 195px; margin-left: 251px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">mcs.h</div></div></div></foreignObject><text x="270" y="199" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">mcs.h</text></switch></g><rect x="120" y="150" width="60" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 190px; margin-left: 121px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">CSIP<br /><br /><br /> </div></div></div></foreignObject><text x="150" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">CSIP...</text></switch></g><rect x="130" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 131px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">csip.h</div></div></div></foreignObject><text x="150" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">csip.h</text></switch></g><rect x="370" y="150" width="110" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 108px; height: 1px; padding-top: 190px; margin-left: 371px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">MICP<br /><br /><br /> </div></div></div></foreignObject><text x="425" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">MICP...</text></switch></g><rect x="380" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 381px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">micp.h</div></div></div></foreignObject><text x="400" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">micp.h</text></switch></g><rect x="510" y="150" width="160" height="80" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 190px; margin-left: 511px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">VCP<br /><br /><br /> </div></div></div></foreignObject><text x="590" y="194" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">VCP...</text></switch></g><rect x="520" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 521px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">vcs.h</div></div></div></foreignObject><text x="540" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">vcs.h</text></switch></g><rect x="570" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 571px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">vocs.h</div></div></div></foreignObject><text x="590" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">vocs.h</text></switch></g><rect x="620" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 621px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">aics.h</div></div></div></foreignObject><text x="640" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">aics.h</text></switch></g><rect x="430" y="190" width="40" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 205px; margin-left: 431px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">aics.h</div></div></div></foreignObject><text x="450" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">aics.h</text></switch></g><rect x="225" y="100" width="90" height="30" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 115px; margin-left: 226px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">media_proxy.h</div></div></div></foreignObject><text x="270" y="119" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">media_proxy.h</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h
index 41771d8..efaea96 100644
--- a/include/zephyr/bluetooth/audio/cap.h
+++ b/include/zephyr/bluetooth/audio/cap.h
@@ -20,7 +20,7 @@
*/
#include <zephyr/types.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include <zephyr/bluetooth/iso.h>
#include <zephyr/bluetooth/audio/audio.h>
@@ -40,13 +40,13 @@
* is not enabled, the Common Audio Service will by statically registered.
*
* @param[in] param Coordinated Set Identification Service register parameters.
- * @param[out] csis Pointer to the registered Coordinated Set Identification
+ * @param[out] csip Pointer to the registered Coordinated Set Identification
* Service.
*
* @return 0 if success, errno on failure.
*/
-int bt_cap_acceptor_register(const struct bt_csis_register_param *param,
- struct bt_csis **csis);
+int bt_cap_acceptor_register(const struct bt_csip_register_param *param,
+ struct bt_csip **csip);
/** Callback structure for CAP procedures */
struct bt_cap_initiator_cb {
@@ -63,8 +63,9 @@
* NULL on error or if remote device does not include
* Coordinated Set Identification Service.
*/
- void (*unicast_discovery_complete)(struct bt_conn *conn, int err,
- const struct bt_csis_client_csis_inst *csis_inst);
+ void (*unicast_discovery_complete)(
+ struct bt_conn *conn, int err,
+ const struct bt_csip_set_coordinator_csis_inst *csis_inst);
/**
* @brief Callback for bt_cap_initiator_unicast_audio_start().
@@ -133,7 +134,7 @@
struct bt_conn *member;
/** CSIP Coordinated Set struct used if type is BT_CAP_SET_TYPE_CSIP. */
- struct bt_csis_client_set_member *csip;
+ struct bt_csip_set_coordinator_set_member *csip;
};
struct bt_cap_stream {
diff --git a/include/zephyr/bluetooth/audio/csis.h b/include/zephyr/bluetooth/audio/csip.h
similarity index 62%
rename from include/zephyr/bluetooth/audio/csis.h
rename to include/zephyr/bluetooth/audio/csip.h
index 6ca1919..53f29de 100644
--- a/include/zephyr/bluetooth/audio/csis.h
+++ b/include/zephyr/bluetooth/audio/csip.h
@@ -1,16 +1,16 @@
/**
- * Copyright (c) 2021 Nordic Semiconductor ASA
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
-#ifndef ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_
-#define ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_
+#ifndef ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_
+#define ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_
/**
- * @brief Coordinated Set Identification Service (CSIS)
+ * @brief Coordinated Set Identification Profile (CSIP)
*
- * @defgroup bt_gatt_csis Coordinated Set Identification Service (CSIS)
+ * @defgroup bt_gatt_csip Coordinated Set Identification Profile (CSIP)
*
* @ingroup bluetooth
* @{
@@ -27,40 +27,40 @@
#endif
/** Recommended timer for member discovery */
-#define CSIS_CLIENT_DISCOVER_TIMER_VALUE K_SECONDS(10)
+#define BT_CSIP_SET_COORDINATOR_DISCOVER_TIMER_VALUE K_SECONDS(10)
-#if defined(CONFIG_BT_CSIS_CLIENT)
-#define BT_CSIS_CLIENT_MAX_CSIS_INSTANCES CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES
+#if defined(CONFIG_BT_CSIP_SET_COORDINATOR)
+#define BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES
#else
-#define BT_CSIS_CLIENT_MAX_CSIS_INSTANCES 0
-#endif /* CONFIG_BT_CSIS_CLIENT */
+#define BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES 0
+#endif /* CONFIG_BT_CSIP_SET_COORDINATOR */
/** Accept the request to read the SIRK as plaintext */
-#define BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT 0x00
+#define BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT 0x00
/** Accept the request to read the SIRK, but return encrypted SIRK */
-#define BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC 0x01
+#define BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC 0x01
/** Reject the request to read the SIRK */
-#define BT_CSIS_READ_SIRK_REQ_RSP_REJECT 0x02
+#define BT_CSIP_READ_SIRK_REQ_RSP_REJECT 0x02
/** SIRK is available only via an OOB procedure */
-#define BT_CSIS_READ_SIRK_REQ_RSP_OOB_ONLY 0x03
+#define BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY 0x03
/** Size of the Set Identification Resolving Key (SIRK) */
-#define BT_CSIS_SET_SIRK_SIZE 16
+#define BT_CSIP_SET_SIRK_SIZE 16
/** Size of the Resolvable Set Identifier (RSI) */
-#define BT_CSIS_RSI_SIZE 6
+#define BT_CSIP_RSI_SIZE 6
/* Coordinate Set Identification Service Error codes */
/** Service is already locked */
-#define BT_CSIS_ERROR_LOCK_DENIED 0x80
+#define BT_CSIP_ERROR_LOCK_DENIED 0x80
/** Service is not locked */
-#define BT_CSIS_ERROR_LOCK_RELEASE_DENIED 0x81
+#define BT_CSIP_ERROR_LOCK_RELEASE_DENIED 0x81
/** Invalid lock value */
-#define BT_CSIS_ERROR_LOCK_INVAL_VALUE 0x82
+#define BT_CSIP_ERROR_LOCK_INVAL_VALUE 0x82
/** SIRK only available out-of-band */
-#define BT_CSIS_ERROR_SIRK_OOB_ONLY 0x83
+#define BT_CSIP_ERROR_SIRK_OOB_ONLY 0x83
/** Client is already owner of the lock */
-#define BT_CSIS_ERROR_LOCK_ALREADY_GRANTED 0x84
+#define BT_CSIP_ERROR_LOCK_ALREADY_GRANTED 0x84
/**
* @brief Helper to declare bt_data array including RSI
@@ -70,24 +70,24 @@
*
* @param _rsi Pointer to the RSI value
*/
-#define BT_CSIS_DATA_RSI(_rsi) BT_DATA(BT_DATA_CSIS_RSI, _rsi, BT_CSIS_RSI_SIZE)
+#define BT_CSIP_DATA_RSI(_rsi) BT_DATA(BT_DATA_CSIS_RSI, _rsi, BT_CSIP_RSI_SIZE)
/** @brief Opaque Coordinated Set Identification Service instance. */
-struct bt_csis;
+struct bt_csip;
/** Callback structure for the Coordinated Set Identification Service */
-struct bt_csis_cb {
+struct bt_csip_cb {
/**
* @brief Callback whenever the lock changes on the server.
*
* @param conn The connection to the client that changed the lock.
* NULL if server changed it, either by calling
- * bt_csis_lock() or by timeout.
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * bt_csip_lock() or by timeout.
+ * @param csip Pointer to the Coordinated Set Identification Service.
* @param locked Whether the lock was locked or released.
*
*/
- void (*lock_changed)(struct bt_conn *conn, struct bt_csis *csis,
+ void (*lock_changed)(struct bt_conn *conn, struct bt_csip *csip,
bool locked);
/**
@@ -98,15 +98,15 @@
*
* @param conn The connection to the client that requested to read the
* SIRK.
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * @param csip Pointer to the Coordinated Set Identification Service.
*
- * @return A BT_CSIS_READ_SIRK_REQ_RSP_* response code.
+ * @return A BT_CSIP_READ_SIRK_REQ_RSP_* response code.
*/
- uint8_t (*sirk_read_req)(struct bt_conn *conn, struct bt_csis *csis);
+ uint8_t (*sirk_read_req)(struct bt_conn *conn, struct bt_csip *csip);
};
/** Register structure for Coordinated Set Identification Service */
-struct bt_csis_register_param {
+struct bt_csip_register_param {
/**
* @brief Size of the set.
*
@@ -120,7 +120,7 @@
* This shall be unique between different sets, and shall be the same
* for each set member for each set.
*/
- uint8_t set_sirk[BT_CSIS_SET_SIRK_SIZE];
+ uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE];
/**
* @brief Boolean to set whether the set is lockable by clients
@@ -139,20 +139,20 @@
uint8_t rank;
/** Pointer to the callback structure. */
- struct bt_csis_cb *cb;
+ struct bt_csip_cb *cb;
-#if CONFIG_BT_CSIS_MAX_INSTANCE_COUNT > 1
+#if CONFIG_BT_CSIP_MAX_INSTANCE_COUNT > 1
/**
* @brief Parent service pointer
*
* Mandatory parent service pointer if this CSIS instance is included
* by another service. All CSIS instances when
- * @kconfig{CONFIG_BT_CSIS_MAX_INSTANCE_COUNT} is above 1 shall
+ * @kconfig{CONFIG_BT_CSIP_MAX_INSTANCE_COUNT} is above 1 shall
* be included by another service, as per the
* Coordinated Set Identification Profile (CSIP).
*/
const struct bt_gatt_service *parent;
-#endif /* CONFIG_BT_CSIS_MAX_INSTANCE_COUNT > 1 */
+#endif /* CONFIG_BT_CSIP_MAX_INSTANCE_COUNT > 1 */
};
/**
@@ -160,11 +160,11 @@
*
* The first service attribute can be included in any other GATT service.
*
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * @param csip Pointer to the Coordinated Set Identification Service.
*
* @return The first CSIS attribute instance.
*/
-void *bt_csis_svc_decl_get(const struct bt_csis *csis);
+void *bt_csip_svc_decl_get(const struct bt_csip *csip);
/**
* @brief Register a Coordinated Set Identification Service instance.
@@ -175,37 +175,37 @@
* This shall only be done as a server.
*
* @param param Coordinated Set Identification Service register parameters.
- * @param[out] csis Pointer to the registered Coordinated Set Identification
+ * @param[out] csip Pointer to the registered Coordinated Set Identification
* Service.
*
* @return 0 if success, errno on failure.
*/
-int bt_csis_register(const struct bt_csis_register_param *param,
- struct bt_csis **csis);
+int bt_csip_register(const struct bt_csip_register_param *param,
+ struct bt_csip **csip);
/**
* @brief Print the SIRK to the debug output
*
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * @param csip Pointer to the Coordinated Set Identification Service.
*/
-void bt_csis_print_sirk(const struct bt_csis *csis);
+void bt_csip_print_sirk(const struct bt_csip *csip);
/**
* @brief Generate the Resolvable Set Identifier (RSI) value.
*
- * This will generate RSI for given @p csis instance.
+ * This will generate RSI for given @p csip instance.
*
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * @param csip Pointer to the Coordinated Set Identification Service.
* @param rsi Pointer to the 6-octet newly generated RSI data.
*
* @return int 0 if on success, errno on error.
*/
-int bt_csis_generate_rsi(const struct bt_csis *csis, uint8_t rsi[BT_CSIS_RSI_SIZE]);
+int bt_csip_generate_rsi(const struct bt_csip *csip, uint8_t rsi[BT_CSIP_RSI_SIZE]);
/**
* @brief Locks a specific Coordinated Set Identification Service instance on the server.
*
- * @param csis Pointer to the Coordinated Set Identification Service.
+ * @param csip Pointer to the Coordinated Set Identification Service.
* @param lock If true lock the set, if false release the set.
* @param force This argument only have meaning when @p lock is false
* (release) and will force release the lock, regardless of who
@@ -213,17 +213,17 @@
*
* @return 0 on success, GATT error on error.
*/
-int bt_csis_lock(struct bt_csis *csis, bool lock, bool force);
+int bt_csip_lock(struct bt_csip *csip, bool lock, bool force);
/** Information about a specific set */
-struct bt_csis_client_set_info {
+struct bt_csip_set_coordinator_set_info {
/**
* @brief The 16 octet set Set Identity Resolving Key (SIRK)
*
* The Set SIRK may not be exposed by the server over Bluetooth, and
* may require an out-of-band solution.
*/
- uint8_t set_sirk[BT_CSIS_SET_SIRK_SIZE];
+ uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE];
/**
* @brief The size of the set
@@ -244,23 +244,23 @@
* @brief Struct representing a coordinated set instance on a remote device
*
* The values in this struct will be populated during discovery of sets
- * (bt_csis_client_discover()).
+ * (bt_csip_set_coordinator_discover()).
*/
-struct bt_csis_client_csis_inst {
- struct bt_csis_client_set_info info;
+struct bt_csip_set_coordinator_csis_inst {
+ struct bt_csip_set_coordinator_set_info info;
/** Internally used pointer value */
- struct bt_csis *csis;
+ struct bt_csip *csip;
};
/** Struct representing a remote device as a set member */
-struct bt_csis_client_set_member {
+struct bt_csip_set_coordinator_set_member {
/** Array of Coordinated Set Identification Service instances for the remote device */
- struct bt_csis_client_csis_inst insts[BT_CSIS_CLIENT_MAX_CSIS_INSTANCES];
+ struct bt_csip_set_coordinator_csis_inst insts[BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES];
};
/**
- * @typedef bt_csis_client_discover_cb
+ * @typedef bt_csip_set_coordinator_discover_cb
* @brief Callback for discovering Coordinated Set Identification Services.
*
* @param conn Pointer to the remote device.
@@ -268,30 +268,31 @@
* @param err 0 on success, or an errno value on error.
* @param set_count Number of sets on the member.
*/
-typedef void (*bt_csis_client_discover_cb)(struct bt_conn *conn,
- const struct bt_csis_client_set_member *member,
- int err, size_t set_count);
+typedef 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);
/**
- * @brief Initialise the csis_client instance for a connection. This will do a
+ * @brief Initialise the csip_set_coordinator instance for a connection. This will do a
* discovery on the device and prepare the instance for following commands.
*
* @param conn Pointer to remote device to perform discovery on.
*
* @return int Return 0 on success, or an errno value on error.
*/
-int bt_csis_client_discover(struct bt_conn *conn);
+int bt_csip_set_coordinator_discover(struct bt_conn *conn);
/**
- * @typedef bt_csis_client_lock_set_cb
+ * @typedef bt_csip_set_coordinator_lock_set_cb
* @brief Callback for locking a set across one or more devices
*
* @param err 0 on success, or an errno value on error.
*/
-typedef void (*bt_csis_client_lock_set_cb)(int err);
+typedef void (*bt_csip_set_coordinator_lock_set_cb)(int err);
/**
- * @typedef bt_csis_client_lock_changed_cb
+ * @typedef bt_csip_set_coordinator_lock_changed_cb
* @brief Callback when the lock value on a set of a connected device changes.
*
* @param inst The Coordinated Set Identification Service instance that was
@@ -300,14 +301,14 @@
*
* @return int Return 0 on success, or an errno value on error.
*/
-typedef void (*bt_csis_client_lock_changed_cb)(struct bt_csis_client_csis_inst *inst,
- bool locked);
+typedef void (*bt_csip_set_coordinator_lock_changed_cb)(
+ struct bt_csip_set_coordinator_csis_inst *inst, bool locked);
/**
- * @typedef bt_csis_client_ordered_access_cb_t
- * @brief Callback for bt_csis_client_ordered_access()
+ * @typedef bt_csip_set_coordinator_ordered_access_cb_t
+ * @brief Callback for bt_csip_set_coordinator_ordered_access()
*
- * If any of the set members supplied to bt_csis_client_ordered_access() is
+ * If any of the set members supplied to bt_csip_set_coordinator_ordered_access() is
* in the locked state, this will be called with @p locked true and @p member
* will be the locked member, and the ordered access procedure is cancelled.
* Likewise, if any error occurs, the procedure will also be aborted.
@@ -317,19 +318,20 @@
* @param locked Whether the lock is locked or release.
* @param member The locked member if @p locked is true, otherwise NULL.
*/
-typedef void (*bt_csis_client_ordered_access_cb_t)(const struct bt_csis_client_set_info *set_info,
- int err, bool locked,
- struct bt_csis_client_set_member *member);
+typedef 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);
-struct bt_csis_client_cb {
+struct bt_csip_set_coordinator_cb {
/* Set callbacks */
- bt_csis_client_lock_set_cb lock_set;
- bt_csis_client_lock_set_cb release_set;
- bt_csis_client_lock_changed_cb lock_changed;
+ bt_csip_set_coordinator_lock_set_cb lock_set;
+ bt_csip_set_coordinator_lock_set_cb release_set;
+ bt_csip_set_coordinator_lock_changed_cb lock_changed;
/* Device specific callbacks */
- bt_csis_client_discover_cb discover;
- bt_csis_client_ordered_access_cb_t ordered_access;
+ bt_csip_set_coordinator_discover_cb discover;
+ bt_csip_set_coordinator_ordered_access_cb_t ordered_access;
/** Internally used field for list handling */
sys_snode_t _node;
@@ -343,20 +345,20 @@
*
* @return true if the advertising data indicates a set member, false otherwise
*/
-bool bt_csis_client_is_set_member(const uint8_t set_sirk[BT_CSIS_SET_SIRK_SIZE],
- struct bt_data *data);
+bool bt_csip_set_coordinator_is_set_member(const uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE],
+ struct bt_data *data);
/**
- * @brief Registers callbacks for csis_client.
+ * @brief Registers callbacks for csip_set_coordinator.
*
* @param cb Pointer to the callback structure.
*
* @return Return 0 on success, or an errno value on error.
*/
-int bt_csis_client_register_cb(struct bt_csis_client_cb *cb);
+int bt_csip_set_coordinator_register_cb(struct bt_csip_set_coordinator_cb *cb);
/**
- * @brief Callback function definition for bt_csis_client_ordered_access()
+ * @brief Callback function definition for bt_csip_set_coordinator_ordered_access()
*
* @param set_info Pointer to the a specific set_info struct.
* @param members Array of members ordered by rank. The procedure shall be
@@ -366,9 +368,10 @@
* @return true if the procedures can be successfully done, or false to stop the
* procedure.
*/
-typedef bool (*bt_csis_client_ordered_access_t)(const struct bt_csis_client_set_info *set_info,
- struct bt_csis_client_set_member *members[],
- size_t count);
+typedef 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);
/**
* @brief Access Coordinated Set devices in an ordered manner as a client
@@ -377,7 +380,7 @@
* in the unlocked state, then @p cb will be called with the same members as
* provided by @p members, but where the members are ordered by rank
* (if present). Once this procedure is finished or an error occurs,
- * @ref bt_csis_client_cb.ordered_access will be called.
+ * @ref bt_csip_set_coordinator_cb.ordered_access will be called.
*
* This procedure only works if all the members have the lock characterstic,
* and all either has rank = 0 or unique ranks.
@@ -393,10 +396,11 @@
* be part of multiple sets.
* @param cb The callback function to be called for each member.
*/
-int bt_csis_client_ordered_access(const struct bt_csis_client_set_member *members[],
- uint8_t count,
- const struct bt_csis_client_set_info *set_info,
- bt_csis_client_ordered_access_t cb);
+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);
/**
* @brief Lock an array of set members
@@ -412,9 +416,9 @@
*
* @return Return 0 on success, or an errno value on error.
*/
-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);
+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);
/**
* @brief Release an array of set members
@@ -428,9 +432,9 @@
*
* @return Return 0 on success, or an errno value on error.
*/
-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);
+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);
#ifdef __cplusplus
@@ -441,4 +445,4 @@
* @}
*/
-#endif /* ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIS_H_ */
+#endif /* ZEPHYR_SUBSYS_BLUETOOTH_AUDIO_CSIP_H_ */
diff --git a/samples/bluetooth/hap_ha/Kconfig b/samples/bluetooth/hap_ha/Kconfig
index 32dc353..8ac4b4e 100644
--- a/samples/bluetooth/hap_ha/Kconfig
+++ b/samples/bluetooth/hap_ha/Kconfig
@@ -14,7 +14,7 @@
config HAP_HA_SET_RANK
int "Device rank in set"
- depends on BT_CSIS
+ depends on BT_CSIP
range 1 2
help
Rank of this device in set.
diff --git a/samples/bluetooth/hap_ha/binaural.conf b/samples/bluetooth/hap_ha/binaural.conf
index 8e6e8d5..d102b0f 100644
--- a/samples/bluetooth/hap_ha/binaural.conf
+++ b/samples/bluetooth/hap_ha/binaural.conf
@@ -1,3 +1,3 @@
-CONFIG_BT_CSIS=y
+CONFIG_BT_CSIP=y
CONFIG_BT_HAS_HEARING_AID_BINAURAL=y
CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y
diff --git a/samples/bluetooth/hap_ha/src/csip_set_member.c b/samples/bluetooth/hap_ha/src/csip_set_member.c
index bd30640..3eb709e 100644
--- a/samples/bluetooth/hap_ha/src/csip_set_member.c
+++ b/samples/bluetooth/hap_ha/src/csip_set_member.c
@@ -10,50 +10,50 @@
#include <zephyr/sys/printk.h>
#include <zephyr/bluetooth/audio/cap.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
-#define CSIS_SIRK_DEBUG { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, \
+#define CSIP_SIRK_DEBUG { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, \
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 }
-static struct bt_csis *csis;
+static struct bt_csip *csip;
-static void csis_lock_changed_cb(struct bt_conn *conn, struct bt_csis *csis, bool locked)
+static void csip_lock_changed_cb(struct bt_conn *conn, struct bt_csip *csip, bool locked)
{
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
}
-static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csis *csis)
+static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csip *csip)
{
- return BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
+ return BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
}
-static struct bt_csis_cb csis_cb = {
- .lock_changed = csis_lock_changed_cb,
+static struct bt_csip_cb csip_cb = {
+ .lock_changed = csip_lock_changed_cb,
.sirk_read_req = sirk_read_req_cb,
};
int csip_set_member_init(void)
{
- struct bt_csis_register_param param = {
+ struct bt_csip_register_param param = {
.set_size = 2,
.rank = CONFIG_HAP_HA_SET_RANK,
.lockable = false,
- .set_sirk = CSIS_SIRK_DEBUG,
- .cb = &csis_cb,
+ .set_sirk = CSIP_SIRK_DEBUG,
+ .cb = &csip_cb,
};
- return bt_cap_acceptor_register(¶m, &csis);
+ return bt_cap_acceptor_register(¶m, &csip);
}
int csip_generate_rsi(uint8_t *rsi)
{
int err;
- if (csis == NULL) {
+ if (csip == NULL) {
return -ENODEV;
}
- err = bt_csis_generate_rsi(csis, rsi);
+ err = bt_csip_generate_rsi(csip, rsi);
if (err) {
printk("Failed to generate RSI (err %d)\n", err);
return err;
diff --git a/samples/bluetooth/hap_ha/src/hap_ha.h b/samples/bluetooth/hap_ha/src/hap_ha.h
index 3265760..e496403 100644
--- a/samples/bluetooth/hap_ha/src/hap_ha.h
+++ b/samples/bluetooth/hap_ha/src/hap_ha.h
@@ -23,8 +23,6 @@
/**
* @brief Generate the Resolvable Set Identifier (RSI) value.
*
- * This will generate RSI for given @p csis instance.
- *
* @param rsi Pointer to place the 6-octet newly generated RSI data.
*
* @return 0 if on success, errno on error.
diff --git a/samples/bluetooth/hap_ha/src/main.c b/samples/bluetooth/hap_ha/src/main.c
index 816b1b3..4a1a2e8 100644
--- a/samples/bluetooth/hap_ha/src/main.c
+++ b/samples/bluetooth/hap_ha/src/main.c
@@ -12,7 +12,7 @@
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/pacs.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include <zephyr/bluetooth/services/ias.h>
#include "hap_ha.h"
@@ -38,15 +38,15 @@
0x00, /* Metadata length */
};
-static uint8_t csis_rsi_addata[BT_CSIS_RSI_SIZE];
+static uint8_t csis_rsi_addata[BT_CSIP_RSI_SIZE];
/* TODO: Expand with BAP data */
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_ASCS_VAL)),
-#if defined(CONFIG_BT_CSIS)
+#if defined(CONFIG_BT_CSIP)
BT_DATA(BT_DATA_CSIS_RSI, csis_rsi_addata, ARRAY_SIZE(csis_rsi_addata)),
-#endif /* CONFIG_BT_CSIS */
+#endif /* CONFIG_BT_CSIP */
BT_DATA(BT_DATA_SVC_DATA16, unicast_server_addata, ARRAY_SIZE(unicast_server_addata)),
};
@@ -63,7 +63,7 @@
.disconnected = disconnected,
};
-#if defined(CONFIG_BT_PRIVACY) && defined(CONFIG_BT_CSIS)
+#if defined(CONFIG_BT_PRIVACY) && defined(CONFIG_BT_CSIP)
static bool adv_rpa_expired_cb(struct bt_le_ext_adv *adv)
{
char rsi_str[13];
@@ -89,12 +89,12 @@
return true;
}
-#endif /* CONFIG_BT_PRIVACY && CONFIG_BT_CSIS */
+#endif /* CONFIG_BT_PRIVACY && CONFIG_BT_CSIP */
static const struct bt_le_ext_adv_cb adv_cb = {
-#if defined(CONFIG_BT_PRIVACY) && defined(CONFIG_BT_CSIS)
+#if defined(CONFIG_BT_PRIVACY) && defined(CONFIG_BT_CSIP)
.rpa_expired = adv_rpa_expired_cb,
-#endif /* CONFIG_BT_PRIVACY && CONFIG_BT_CSIS */
+#endif /* CONFIG_BT_PRIVACY && CONFIG_BT_CSIP */
};
static void adv_work_handler(struct k_work *work)
diff --git a/subsys/bluetooth/audio/CMakeLists.txt b/subsys/bluetooth/audio/CMakeLists.txt
index 619ca60..8b6f94c 100644
--- a/subsys/bluetooth/audio/CMakeLists.txt
+++ b/subsys/bluetooth/audio/CMakeLists.txt
@@ -30,10 +30,10 @@
zephyr_library_link_libraries(subsys__bluetooth)
-zephyr_library_sources_ifdef(CONFIG_BT_CSIS csis.c)
-zephyr_library_sources_ifdef(CONFIG_BT_CSIS_CLIENT csis_client.c)
-if (CONFIG_BT_CSIS OR CONFIG_BT_CSIS_CLIENT)
- zephyr_library_sources(csis_crypto.c)
+zephyr_library_sources_ifdef(CONFIG_BT_CSIP csip.c)
+zephyr_library_sources_ifdef(CONFIG_BT_CSIP_SET_COORDINATOR csip_set_coordinator.c)
+if (CONFIG_BT_CSIP OR CONFIG_BT_CSIP_SET_COORDINATOR)
+ zephyr_library_sources(csip_crypto.c)
endif()
zephyr_library_sources_ifdef(CONFIG_BT_TBS tbs.c)
diff --git a/subsys/bluetooth/audio/Kconfig b/subsys/bluetooth/audio/Kconfig
index 5bf57cf..3d4902d 100644
--- a/subsys/bluetooth/audio/Kconfig
+++ b/subsys/bluetooth/audio/Kconfig
@@ -30,7 +30,7 @@
rsource "Kconfig.aics"
rsource "Kconfig.vcs"
rsource "Kconfig.micp"
-rsource "Kconfig.csis"
+rsource "Kconfig.csip"
rsource "Kconfig.tbs"
rsource "Kconfig.mcs"
rsource "Kconfig.bass"
diff --git a/subsys/bluetooth/audio/Kconfig.cap b/subsys/bluetooth/audio/Kconfig.cap
index 30675b7..c2baf78 100644
--- a/subsys/bluetooth/audio/Kconfig.cap
+++ b/subsys/bluetooth/audio/Kconfig.cap
@@ -19,12 +19,12 @@
config BT_CAP_ACCEPTOR_SET_MEMBER
bool "Common Audio Profile Acceptor Role Set Member support"
depends on BT_CAP_ACCEPTOR
- depends on BT_CSIS
+ depends on BT_CSIP
help
Enabling this will allow a CAP acceptor to be a set member.
Enabling this will require a manual register of the CAS service.
Enabling will take one of the allocated CSIS instances
- (BT_CSIS_MAX_INSTANCE_COUNT).
+ (BT_CSIP_MAX_INSTANCE_COUNT).
config BT_DEBUG_CAP_ACCEPTOR
bool "Common Audio Profile debug"
@@ -35,7 +35,7 @@
config BT_CAP_INITIATOR
bool "Common Audio Profile Initiator Role Support [EXPERIMENTAL]"
- depends on (BT_AUDIO_UNICAST_CLIENT && BT_CSIS_CLIENT) || BT_AUDIO_BROADCAST_SOURCE
+ depends on (BT_AUDIO_UNICAST_CLIENT && BT_CSIP_SET_COORDINATOR) || BT_AUDIO_BROADCAST_SOURCE
select EXPERIMENTAL
help
Enabling this will enable the CAP Initiator role.
diff --git a/subsys/bluetooth/audio/Kconfig.csis b/subsys/bluetooth/audio/Kconfig.csip
similarity index 78%
rename from subsys/bluetooth/audio/Kconfig.csis
rename to subsys/bluetooth/audio/Kconfig.csip
index b845fc9..5ce9314 100644
--- a/subsys/bluetooth/audio/Kconfig.csis
+++ b/subsys/bluetooth/audio/Kconfig.csip
@@ -8,7 +8,7 @@
#################### Coordinated Set Identification Service ####################
-config BT_CSIS
+config BT_CSIP
bool "Coordinated Set Identification Service Support [EXPERIMENTAL]"
imply BT_EXT_ADV if BT_PRIVACY
select EXPERIMENTAL
@@ -16,9 +16,9 @@
This option enables support for Coordinated Set Identification
Service.
-if BT_CSIS
+if BT_CSIP
-config BT_CSIS_TEST_SAMPLE_DATA
+config BT_CSIP_TEST_SAMPLE_DATA
bool "Coordinated Set Identification Service Test Sample Data"
help
Enable the use of the sample data defined by the CSIS spec SIRK.
@@ -28,13 +28,13 @@
(if encrypted) using public sample data.
Should not be used for production builds.
-config BT_CSIS_ENC_SIRK_SUPPORT
+config BT_CSIP_ENC_SIRK_SUPPORT
bool "Support for encrypted SIRK"
default y
help
Enables support encrypting the SIRK.
-config BT_CSIS_MAX_INSTANCE_COUNT
+config BT_CSIP_MAX_INSTANCE_COUNT
int "Coordinated Set Identification Service max instance count"
default 1
range 1 255
@@ -48,28 +48,28 @@
############### DEBUG ###############
-config BT_DEBUG_CSIS
+config BT_DEBUG_CSIP
bool "Coordinated Set Identification Service debug"
help
Use this option to enable Coordinated Set Identification Service debug
logs for the Bluetooth Audio functionality.
-endif # BT_CSIS
+endif # BT_CSIP
#################### Coordinated Set Identification Client ####################
-config BT_CSIS_CLIENT
- bool "Coordinated Set Identification Profile Support [EXPERIMENTAL]"
+config BT_CSIP_SET_COORDINATOR
+ bool "Coordinated Set Identification Profile Set Coordinator Support [EXPERIMENTAL]"
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select EXPERIMENTAL
help
This option enables support for Coordinated Set Identification
- Profile.
+ Profile Set Coordinator.
-if BT_CSIS_CLIENT
+if BT_CSIP_SET_COORDINATOR
-config BT_CSIS_CLIENT_TEST_SAMPLE_DATA
+config BT_CSIP_SET_COORDINATOR_TEST_SAMPLE_DATA
bool "Coordinated Set Identification Service Test Sample Data"
help
Enable the use of the sample data defined by the CSIS spec.
@@ -80,7 +80,7 @@
with set members that are not using the sample data.
Should not be used for production builds.
-config BT_CSIS_CLIENT_MAX_CSIS_INSTANCES
+config BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES
int "Coordinated Set Identification Service Count"
default 1
range 1 3
@@ -88,7 +88,7 @@
Sets the number of service instances, which corresponds to the number
of different sets the peer device may be in.
-config BT_CSIS_CLIENT_ENC_SIRK_SUPPORT
+config BT_CSIP_SET_COORDINATOR_ENC_SIRK_SUPPORT
bool "Support for encrypted SIRK"
default y
help
@@ -96,17 +96,17 @@
############### DEBUG ###############
-config BT_DEBUG_CSIS_CLIENT
+config BT_DEBUG_CSIP_SET_COORDINATOR
bool "Coordinated Set Identification Profile debug"
help
Use this option to enable Coordinated Set Identification Profile debug
logs for the Bluetooth Audio functionality.
-endif # BT_CSIS_CLIENT
+endif # BT_CSIP_SET_COORDINATOR
-config BT_DEBUG_CSIS_CRYPTO
- bool "Coordinated Set Identification Service crypto functions debug"
- depends on BT_CSIS_CLIENT || BT_CSIS
+config BT_DEBUG_CSIP_CRYPTO
+ bool "Coordinated Set Identification Profile crypto functions debug"
+ depends on BT_CSIP_SET_COORDINATOR || BT_CSIP
help
- Use this option to enable Coordinated Set Identification Service
+ Use this option to enable Coordinated Set Identification Profile
crypto functions debug logs for the Bluetooth Audio functionality.
diff --git a/subsys/bluetooth/audio/Kconfig.has b/subsys/bluetooth/audio/Kconfig.has
index 81ea6d1..e6d065c 100644
--- a/subsys/bluetooth/audio/Kconfig.has
+++ b/subsys/bluetooth/audio/Kconfig.has
@@ -23,7 +23,7 @@
bool "Monaural Hearing Aid"
config BT_HAS_HEARING_AID_BINAURAL
- depends on BT_CSIS
+ depends on BT_CSIP
bool "Binaural Hearing Aid"
config BT_HAS_HEARING_AID_BANDED
diff --git a/subsys/bluetooth/audio/cap_acceptor.c b/subsys/bluetooth/audio/cap_acceptor.c
index 1ea736a..a3577d2 100644
--- a/subsys/bluetooth/audio/cap_acceptor.c
+++ b/subsys/bluetooth/audio/cap_acceptor.c
@@ -7,7 +7,7 @@
#include <zephyr/sys/check.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/audio/tbs.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include "cap_internal.h"
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CAP_ACCEPTOR)
@@ -21,22 +21,22 @@
BT_GATT_INCLUDE_SERVICE(NULL) /* To be overwritten */
};
-int bt_cap_acceptor_register(const struct bt_csis_register_param *param,
- struct bt_csis **csis)
+int bt_cap_acceptor_register(const struct bt_csip_register_param *param,
+ struct bt_csip **csip)
{
static struct bt_gatt_service cas;
int err;
- err = bt_csis_register(param, csis);
+ err = bt_csip_register(param, csip);
if (err != 0) {
- BT_DBG("Failed to register CSIS");
+ BT_DBG("Failed to register CSIP");
return err;
}
cas = (struct bt_gatt_service)BT_GATT_SERVICE(svc_attrs);
- /* Overwrite the include definition with the CSIS */
- cas.attrs[1].user_data = bt_csis_svc_decl_get(*csis);
+ /* Overwrite the include definition with the CSIP */
+ cas.attrs[1].user_data = bt_csip_svc_decl_get(*csip);
err = bt_gatt_service_register(&cas);
if (err) {
@@ -51,7 +51,7 @@
BT_GATT_SERVICE_DEFINE(cas_svc,
BT_GATT_PRIMARY_SERVICE(BT_UUID_CAS)
- /* TODO: Add support for included CSIS */
+ /* TODO: Add support for included CSIP */
);
#endif /* CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER */
diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c
index 14721be..da591c5 100644
--- a/subsys/bluetooth/audio/cap_initiator.c
+++ b/subsys/bluetooth/audio/cap_initiator.c
@@ -9,7 +9,7 @@
#include <zephyr/bluetooth/audio/tbs.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "cap_internal.h"
-#include "csis_internal.h"
+#include "csip_internal.h"
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_CAP_INITIATOR)
#define LOG_MODULE_NAME bt_cap_initiator
@@ -62,13 +62,13 @@
struct cap_unicast_client {
struct bt_gatt_discover_params param;
uint16_t csis_start_handle;
- const struct bt_csis_client_csis_inst *csis_inst;
+ const struct bt_csip_set_coordinator_csis_inst *csis_inst;
};
static struct cap_unicast_client bt_cap_unicast_clients[CONFIG_BT_MAX_CONN];
static void csis_client_discover_cb(struct bt_conn *conn,
- const struct bt_csis_client_set_member *member,
+ const struct bt_csip_set_coordinator_set_member *member,
int err, size_t set_count)
{
struct cap_unicast_client *client;
@@ -84,7 +84,7 @@
}
client = &bt_cap_unicast_clients[bt_conn_index(conn)];
- client->csis_inst = bt_csis_client_csis_inst_by_handle(
+ client->csis_inst = bt_csip_set_coordinator_csis_inst_by_handle(
conn, client->csis_start_handle);
if (member == NULL || set_count == 0 || client->csis_inst == NULL) {
@@ -127,11 +127,11 @@
* CSIS discovery
*/
client->csis_start_handle = included_service->start_handle;
- client->csis_inst = bt_csis_client_csis_inst_by_handle(
+ client->csis_inst = bt_csip_set_coordinator_csis_inst_by_handle(
conn, client->csis_start_handle);
if (client->csis_inst == NULL) {
- static struct bt_csis_client_cb csis_client_cb = {
+ static struct bt_csip_set_coordinator_cb csis_client_cb = {
.discover = csis_client_discover_cb
};
static bool csis_cbs_registered;
@@ -140,11 +140,11 @@
BT_DBG("CAS CSIS not known, discovering");
if (!csis_cbs_registered) {
- bt_csis_client_register_cb(&csis_client_cb);
+ bt_csip_set_coordinator_register_cb(&csis_client_cb);
csis_cbs_registered = true;
}
- err = bt_csis_client_discover(conn);
+ err = bt_csip_set_coordinator_discover(conn);
if (err != 0) {
BT_DBG("Discover failed (err %d)", err);
if (cap_cb && cap_cb->unicast_discovery_complete) {
diff --git a/subsys/bluetooth/audio/csip.c b/subsys/bluetooth/audio/csip.c
new file mode 100644
index 0000000..19282c9
--- /dev/null
+++ b/subsys/bluetooth/audio/csip.c
@@ -0,0 +1,768 @@
+/* Bluetooth CSIP - Coordinated Set Identification Profile */
+
+/*
+ * Copyright (c) 2019 Bose Corporation
+ * Copyright (c) 2020-2022 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <zephyr/kernel.h>
+#include <zephyr/types.h>
+
+#include <zephyr/device.h>
+#include <zephyr/init.h>
+#include <stdlib.h>
+
+#include <zephyr/bluetooth/bluetooth.h>
+#include <zephyr/bluetooth/conn.h>
+#include <zephyr/bluetooth/gatt.h>
+#include <zephyr/bluetooth/buf.h>
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/sys/check.h>
+
+#include "audio_internal.h"
+#include "csip_internal.h"
+#include "csip_crypto.h"
+#include "../host/conn_internal.h"
+#include "../host/hci_core.h"
+#include "../host/keys.h"
+
+#define BT_CSIP_SIH_PRAND_SIZE 3
+#define BT_CSIP_SIH_HASH_SIZE 3
+#define CSIP_SET_LOCK_TIMER_VALUE K_SECONDS(60)
+
+#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIP)
+#define LOG_MODULE_NAME bt_csip
+#include "common/log.h"
+#include "common/bt_str.h"
+
+static struct bt_csip csip_insts[CONFIG_BT_CSIP_MAX_INSTANCE_COUNT];
+static bt_addr_le_t server_dummy_addr; /* 0'ed address */
+
+struct csip_notify_foreach {
+ struct bt_conn *excluded_client;
+ struct bt_csip *csip;
+};
+
+static bool is_last_client_to_write(const struct bt_csip *csip,
+ const struct bt_conn *conn)
+{
+ if (conn != NULL) {
+ return bt_addr_le_eq(bt_conn_get_dst(conn),
+ &csip->srv.lock_client_addr);
+ } else {
+ return bt_addr_le_eq(&server_dummy_addr,
+ &csip->srv.lock_client_addr);
+ }
+}
+
+static void notify_lock_value(const struct bt_csip *csip, struct bt_conn *conn)
+{
+ bt_gatt_notify_uuid(conn, BT_UUID_CSIS_SET_LOCK,
+ csip->srv.service_p->attrs,
+ &csip->srv.set_lock,
+ sizeof(csip->srv.set_lock));
+}
+
+static void notify_client(struct bt_conn *conn, void *data)
+{
+ struct csip_notify_foreach *csip_data = (struct csip_notify_foreach *)data;
+ struct bt_csip *csip = csip_data->csip;
+ struct bt_conn *excluded_conn = csip_data->excluded_client;
+
+ if (excluded_conn != NULL && conn == excluded_conn) {
+ return;
+ }
+
+ notify_lock_value(csip, conn);
+
+ for (int i = 0; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (pend_notify->pending &&
+ bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
+ pend_notify->pending = false;
+ break;
+ }
+ }
+}
+
+static void notify_clients(struct bt_csip *csip,
+ struct bt_conn *excluded_client)
+{
+ struct csip_notify_foreach data = {
+ .excluded_client = excluded_client,
+ .csip = csip,
+ };
+
+ /* Mark all bonded devices as pending notifications, and clear those
+ * that are notified in `notify_client`
+ */
+ for (int i = 0; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (pend_notify->active) {
+ if (excluded_client != NULL &&
+ bt_addr_le_eq(bt_conn_get_dst(excluded_client), &pend_notify->addr)) {
+ continue;
+ }
+
+ pend_notify->pending = true;
+ }
+ }
+
+ bt_conn_foreach(BT_CONN_TYPE_LE, notify_client, &data);
+}
+
+static int sirk_encrypt(struct bt_conn *conn,
+ const struct bt_csip_set_sirk *sirk,
+ struct bt_csip_set_sirk *enc_sirk)
+{
+ int err;
+ uint8_t *k;
+
+ if (IS_ENABLED(CONFIG_BT_CSIP_TEST_SAMPLE_DATA)) {
+ /* test_k is from the sample data from A.2 in the CSIS spec */
+ static uint8_t test_k[] = {0x67, 0x6e, 0x1b, 0x9b,
+ 0xd4, 0x48, 0x69, 0x6f,
+ 0x06, 0x1e, 0xc6, 0x22,
+ 0x3c, 0xe5, 0xce, 0xd9};
+ static bool swapped;
+
+ if (!swapped && IS_ENABLED(CONFIG_LITTLE_ENDIAN)) {
+ /* Swap test_k to little endian */
+ sys_mem_swap(test_k, 16);
+ swapped = true;
+ }
+ BT_DBG("Encrypting test SIRK");
+ k = test_k;
+ } else {
+ k = conn->le.keys->ltk.val;
+ }
+
+ err = bt_csip_sef(k, sirk->value, enc_sirk->value);
+
+ if (err != 0) {
+ return err;
+ }
+
+ enc_sirk->type = BT_CSIP_SIRK_TYPE_ENCRYPTED;
+
+ return 0;
+}
+
+static int generate_prand(uint32_t *dest)
+{
+ bool valid = false;
+
+ do {
+ int res;
+
+ *dest = 0;
+ res = bt_rand(dest, BT_CSIP_SIH_PRAND_SIZE);
+ if (res != 0) {
+ return res;
+ }
+
+ /* Validate Prand: Must contain both a 1 and a 0 */
+ if (*dest != 0 && *dest != 0x3FFFFF) {
+ valid = true;
+ }
+ } while (!valid);
+
+ *dest &= 0x3FFFFF;
+ *dest |= BIT(22); /* bit 23 shall be 0, and bit 22 shall be 1 */
+
+ return 0;
+}
+
+int bt_csip_generate_rsi(const struct bt_csip *csip, uint8_t rsi[BT_CSIP_RSI_SIZE])
+{
+ int res = 0;
+ uint32_t prand;
+ uint32_t hash;
+
+ if (IS_ENABLED(CONFIG_BT_CSIP_TEST_SAMPLE_DATA)) {
+ /* prand is from the sample data from A.2 in the CSIS spec */
+ prand = 0x69f563;
+ } else {
+ res = generate_prand(&prand);
+
+ if (res != 0) {
+ BT_WARN("Could not generate new prand");
+ return res;
+ }
+ }
+
+ res = bt_csip_sih(csip->srv.set_sirk.value, prand, &hash);
+ if (res != 0) {
+ BT_WARN("Could not generate new RSI");
+ return res;
+ }
+
+ (void)memcpy(rsi, &hash, BT_CSIP_SIH_HASH_SIZE);
+ (void)memcpy(rsi + BT_CSIP_SIH_HASH_SIZE, &prand, BT_CSIP_SIH_PRAND_SIZE);
+
+ return res;
+}
+
+static ssize_t read_set_sirk(struct bt_conn *conn,
+ const struct bt_gatt_attr *attr,
+ void *buf, uint16_t len, uint16_t offset)
+{
+ struct bt_csip_set_sirk enc_sirk;
+ struct bt_csip_set_sirk *sirk;
+ struct bt_csip *csip = BT_AUDIO_CHRC_USER_DATA(attr);
+
+ if (csip->srv.cb != NULL && csip->srv.cb->sirk_read_req != NULL) {
+ uint8_t cb_rsp;
+
+ /* Ask higher layer for what SIRK to return, if any */
+ cb_rsp = csip->srv.cb->sirk_read_req(conn, &csip_insts[0]);
+
+ if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT) {
+ sirk = &csip->srv.set_sirk;
+ } else if (IS_ENABLED(CONFIG_BT_CSIP_ENC_SIRK_SUPPORT) &&
+ cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC) {
+ int err;
+
+ err = sirk_encrypt(conn, &csip->srv.set_sirk,
+ &enc_sirk);
+ if (err != 0) {
+ BT_ERR("Could not encrypt SIRK: %d",
+ err);
+ return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
+ }
+
+ sirk = &enc_sirk;
+ LOG_HEXDUMP_DBG(enc_sirk.value, sizeof(enc_sirk.value),
+ "Encrypted Set SIRK");
+ } else if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_REJECT) {
+ return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION);
+ } else if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY) {
+ return BT_GATT_ERR(BT_CSIP_ERROR_SIRK_OOB_ONLY);
+ } else {
+ BT_ERR("Invalid callback response: %u", cb_rsp);
+ return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
+ }
+ } else {
+ sirk = &csip->srv.set_sirk;
+ }
+
+
+ BT_DBG("Set sirk %sencrypted",
+ sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
+ LOG_HEXDUMP_DBG(csip->srv.set_sirk.value,
+ sizeof(csip->srv.set_sirk.value), "Set SIRK");
+ return bt_gatt_attr_read(conn, attr, buf, len, offset,
+ sirk, sizeof(*sirk));
+}
+
+static void set_sirk_cfg_changed(const struct bt_gatt_attr *attr,
+ uint16_t value)
+{
+ BT_DBG("value 0x%04x", value);
+}
+
+static ssize_t read_set_size(struct bt_conn *conn,
+ const struct bt_gatt_attr *attr,
+ void *buf, uint16_t len, uint16_t offset)
+{
+ struct bt_csip *csip = BT_AUDIO_CHRC_USER_DATA(attr);
+
+ BT_DBG("%u", csip->srv.set_size);
+
+ return bt_gatt_attr_read(conn, attr, buf, len, offset,
+ &csip->srv.set_size,
+ sizeof(csip->srv.set_size));
+}
+
+static void set_size_cfg_changed(const struct bt_gatt_attr *attr,
+ uint16_t value)
+{
+ BT_DBG("value 0x%04x", value);
+}
+
+static ssize_t read_set_lock(struct bt_conn *conn,
+ const struct bt_gatt_attr *attr,
+ void *buf, uint16_t len, uint16_t offset)
+{
+ struct bt_csip *csip = BT_AUDIO_CHRC_USER_DATA(attr);
+
+ BT_DBG("%u", csip->srv.set_lock);
+
+ return bt_gatt_attr_read(conn, attr, buf, len, offset,
+ &csip->srv.set_lock,
+ sizeof(csip->srv.set_lock));
+}
+
+/**
+ * @brief Set the lock value of a CSIP instance.
+ *
+ * @param conn The connection locking the instance.
+ * Will be NULL if the server locally sets the lock.
+ * @param csip The CSIP instance to change the lock value of
+ * @param val The lock value (BT_CSIP_LOCK_VALUE or BT_CSIP_RELEASE_VALUE)
+ *
+ * @return BT_CSIP_ERROR_* on failure or 0 if success
+ */
+static uint8_t set_lock(struct bt_conn *conn, struct bt_csip *csip, uint8_t val)
+{
+ bool notify;
+
+ if (val != BT_CSIP_RELEASE_VALUE && val != BT_CSIP_LOCK_VALUE) {
+ return BT_CSIP_ERROR_LOCK_INVAL_VALUE;
+ }
+
+ if (csip->srv.set_lock == BT_CSIP_LOCK_VALUE) {
+ if (val == BT_CSIP_LOCK_VALUE) {
+ if (is_last_client_to_write(csip, conn)) {
+ return BT_CSIP_ERROR_LOCK_ALREADY_GRANTED;
+ } else {
+ return BT_CSIP_ERROR_LOCK_DENIED;
+ }
+ } else if (!is_last_client_to_write(csip, conn)) {
+ return BT_CSIP_ERROR_LOCK_RELEASE_DENIED;
+ }
+ }
+
+ notify = csip->srv.set_lock != val;
+
+ csip->srv.set_lock = val;
+ if (csip->srv.set_lock == BT_CSIP_LOCK_VALUE) {
+ if (conn != NULL) {
+ bt_addr_le_copy(&csip->srv.lock_client_addr,
+ bt_conn_get_dst(conn));
+ }
+ (void)k_work_reschedule(&csip->srv.set_lock_timer,
+ CSIP_SET_LOCK_TIMER_VALUE);
+ } else {
+ (void)memset(&csip->srv.lock_client_addr, 0,
+ sizeof(csip->srv.lock_client_addr));
+ (void)k_work_cancel_delayable(&csip->srv.set_lock_timer);
+ }
+
+ BT_DBG("%u", csip->srv.set_lock);
+
+ if (notify) {
+ /*
+ * The Spec states that all clients, except for the
+ * client writing the value, shall be notified
+ * (if subscribed)
+ */
+ notify_clients(csip, conn);
+
+ if (csip->srv.cb != NULL && csip->srv.cb->lock_changed != NULL) {
+ bool locked = csip->srv.set_lock == BT_CSIP_LOCK_VALUE;
+
+ csip->srv.cb->lock_changed(conn, csip, locked);
+ }
+ }
+
+ return 0;
+}
+
+static ssize_t write_set_lock(struct bt_conn *conn,
+ const struct bt_gatt_attr *attr,
+ const void *buf, uint16_t len,
+ uint16_t offset, uint8_t flags)
+{
+ ssize_t res;
+ uint8_t val;
+ struct bt_csip *csip = BT_AUDIO_CHRC_USER_DATA(attr);
+
+ if (offset != 0) {
+ return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
+ } else if (len != sizeof(val)) {
+ return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
+ }
+
+ (void)memcpy(&val, buf, len);
+
+ res = set_lock(conn, csip, val);
+ if (res != BT_ATT_ERR_SUCCESS) {
+ return BT_GATT_ERR(res);
+ }
+
+ return len;
+}
+
+static void set_lock_cfg_changed(const struct bt_gatt_attr *attr,
+ uint16_t value)
+{
+ BT_DBG("value 0x%04x", value);
+}
+
+static ssize_t read_rank(struct bt_conn *conn, const struct bt_gatt_attr *attr,
+ void *buf, uint16_t len, uint16_t offset)
+{
+ struct bt_csip *csip = BT_AUDIO_CHRC_USER_DATA(attr);
+
+ BT_DBG("%u", csip->srv.rank);
+
+ return bt_gatt_attr_read(conn, attr, buf, len, offset,
+ &csip->srv.rank,
+ sizeof(csip->srv.rank));
+
+}
+
+static void set_lock_timer_handler(struct k_work *work)
+{
+ struct k_work_delayable *delayable;
+ struct bt_csip_server *server;
+ struct bt_csip *csip;
+
+ delayable = CONTAINER_OF(work, struct k_work_delayable, work);
+ server = CONTAINER_OF(delayable, struct bt_csip_server, set_lock_timer);
+ csip = CONTAINER_OF(server, struct bt_csip, srv);
+
+ BT_DBG("Lock timeout, releasing");
+ csip->srv.set_lock = BT_CSIP_RELEASE_VALUE;
+ notify_clients(csip, NULL);
+
+ if (csip->srv.cb != NULL && csip->srv.cb->lock_changed != NULL) {
+ bool locked = csip->srv.set_lock == BT_CSIP_LOCK_VALUE;
+
+ csip->srv.cb->lock_changed(NULL, csip, locked);
+ }
+}
+
+static void csip_security_changed(struct bt_conn *conn, bt_security_t level,
+ enum bt_security_err err)
+{
+ if (err != 0 || conn->encrypt == 0) {
+ return;
+ }
+
+ if (!bt_addr_le_is_bonded(conn->id, &conn->le.dst)) {
+ return;
+ }
+
+ for (int i = 0; i < ARRAY_SIZE(csip_insts); i++) {
+ struct bt_csip *csip = &csip_insts[i];
+
+ for (int j = 0; j < ARRAY_SIZE(csip->srv.pend_notify); j++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[j];
+
+ if (pend_notify->pending &&
+ bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
+ notify_lock_value(csip, conn);
+ pend_notify->pending = false;
+ break;
+ }
+ }
+ }
+}
+
+static void handle_csip_disconnect(struct bt_csip *csip, struct bt_conn *conn)
+{
+ BT_DBG("Non-bonded device");
+ if (is_last_client_to_write(csip, conn)) {
+ (void)memset(&csip->srv.lock_client_addr, 0,
+ sizeof(csip->srv.lock_client_addr));
+ csip->srv.set_lock = BT_CSIP_RELEASE_VALUE;
+ notify_clients(csip, NULL);
+
+ if (csip->srv.cb != NULL && csip->srv.cb->lock_changed != NULL) {
+ bool locked = csip->srv.set_lock == BT_CSIP_LOCK_VALUE;
+
+ csip->srv.cb->lock_changed(conn, csip, locked);
+ }
+ }
+
+ /* Check if the disconnected device once was bonded and stored
+ * here as a bonded device
+ */
+ for (int i = 0; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
+ (void)memset(pend_notify, 0, sizeof(*pend_notify));
+ break;
+ }
+ }
+}
+
+static void csip_disconnected(struct bt_conn *conn, uint8_t reason)
+{
+ BT_DBG("Disconnected: %s (reason %u)",
+ bt_addr_le_str(bt_conn_get_dst(conn)), reason);
+
+ for (int i = 0; i < ARRAY_SIZE(csip_insts); i++) {
+ handle_csip_disconnect(&csip_insts[i], conn);
+ }
+}
+
+static void handle_csip_auth_complete(struct bt_csip *csip,
+ struct bt_conn *conn)
+{
+ /* Check if already in list, and do nothing if it is */
+ for (int i = 0; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (pend_notify->active &&
+ bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
+#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
+ pend_notify->age = csip->srv.age_counter++;
+#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
+ return;
+ }
+ }
+
+ /* Copy addr to list over devices to save notifications for */
+ for (int i = 0; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (!pend_notify->active) {
+ bt_addr_le_copy(&pend_notify->addr,
+ bt_conn_get_dst(conn));
+ pend_notify->active = true;
+#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
+ pend_notify->age = csip->srv.age_counter++;
+#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
+ return;
+ }
+ }
+
+#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
+ struct csip_pending_notifications *oldest;
+
+ oldest = &csip->srv.pend_notify[0];
+
+ for (int i = 1; i < ARRAY_SIZE(csip->srv.pend_notify); i++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[i];
+
+ if (pend_notify->age < oldest->age) {
+ oldest = pend_notify;
+ }
+ }
+ (void)memset(oldest, 0, sizeof(*oldest));
+ bt_addr_le_copy(&oldest->addr, &conn->le.dst);
+ oldest->active = true;
+ oldest->age = csip->srv.age_counter++;
+#else
+ BT_WARN("Could not add device to pending notification list");
+#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
+
+}
+
+static void auth_pairing_complete(struct bt_conn *conn, bool bonded)
+{
+ /**
+ * If a pairing is complete for a bonded device, then we
+ * 1) Store the connection pointer to later validate SIRK encryption
+ * 2) Check if the device is already in the `pend_notify`, and if it is
+ * not, then we
+ * 3) Check if there's room for another device in the `pend_notify`
+ * array. If there are no more room for a new device, then
+ * 4) Either we ignore this new device (bad luck), or we overwrite
+ * the oldest entry, following the behavior of the key storage.
+ */
+
+ BT_DBG("%s paired (%sbonded)",
+ bt_addr_le_str(bt_conn_get_dst(conn)), bonded ? "" : "not ");
+
+ if (!bonded) {
+ return;
+ }
+
+ for (int i = 0; i < ARRAY_SIZE(csip_insts); i++) {
+ handle_csip_auth_complete(&csip_insts[i], conn);
+ }
+}
+
+static void csip_bond_deleted(uint8_t id, const bt_addr_le_t *peer)
+{
+ for (int i = 0; i < ARRAY_SIZE(csip_insts); i++) {
+ struct bt_csip *csip = &csip_insts[i];
+
+ for (int j = 0; j < ARRAY_SIZE(csip->srv.pend_notify); j++) {
+ struct csip_pending_notifications *pend_notify;
+
+ pend_notify = &csip->srv.pend_notify[j];
+
+ if (pend_notify->active &&
+ bt_addr_le_eq(peer, &pend_notify->addr)) {
+ (void)memset(pend_notify, 0,
+ sizeof(*pend_notify));
+ break;
+ }
+ }
+ }
+}
+
+static struct bt_conn_cb conn_callbacks = {
+ .disconnected = csip_disconnected,
+ .security_changed = csip_security_changed,
+};
+
+static struct bt_conn_auth_info_cb auth_callbacks = {
+ .pairing_complete = auth_pairing_complete,
+ .bond_deleted = csip_bond_deleted
+};
+
+#define BT_CSIP_SERVICE_DEFINITION(_csip) {\
+ BT_GATT_PRIMARY_SERVICE(BT_UUID_CSIS), \
+ BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIRK, \
+ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
+ BT_GATT_PERM_READ_ENCRYPT, \
+ read_set_sirk, NULL, &_csip), \
+ BT_AUDIO_CCC(set_sirk_cfg_changed), \
+ BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIZE, \
+ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
+ BT_GATT_PERM_READ_ENCRYPT, \
+ read_set_size, NULL, &_csip), \
+ BT_AUDIO_CCC(set_size_cfg_changed), \
+ BT_AUDIO_CHRC(BT_UUID_CSIS_SET_LOCK, \
+ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY | BT_GATT_CHRC_WRITE, \
+ BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, \
+ read_set_lock, write_set_lock, &_csip), \
+ BT_AUDIO_CCC(set_lock_cfg_changed), \
+ BT_AUDIO_CHRC(BT_UUID_CSIS_RANK, \
+ BT_GATT_CHRC_READ, \
+ BT_GATT_PERM_READ_ENCRYPT, \
+ read_rank, NULL, &_csip) \
+ }
+
+BT_GATT_SERVICE_INSTANCE_DEFINE(csip_service_list, csip_insts,
+ CONFIG_BT_CSIP_MAX_INSTANCE_COUNT,
+ BT_CSIP_SERVICE_DEFINITION);
+
+/****************************** Public API ******************************/
+void *bt_csip_svc_decl_get(const struct bt_csip *csip)
+{
+ return csip->srv.service_p->attrs;
+}
+
+static bool valid_register_param(const struct bt_csip_register_param *param)
+{
+ if (param->lockable && param->rank == 0) {
+ BT_DBG("Rank cannot be 0 if service is lockable");
+ return false;
+ }
+
+ if (param->rank > 0 && param->rank > param->set_size) {
+ BT_DBG("Invalid rank: %u (shall be less than set_size: %u)",
+ param->set_size, param->set_size);
+ return false;
+ }
+
+#if CONFIG_BT_CSIP_MAX_INSTANCE_COUNT > 1
+ if (param->parent == NULL) {
+ BT_DBG("Parent service not provided");
+ return false;
+ }
+#endif /* CONFIG_BT_CSIP_MAX_INSTANCE_COUNT > 1 */
+
+ return true;
+}
+
+int bt_csip_register(const struct bt_csip_register_param *param,
+ struct bt_csip **csip)
+{
+ static uint8_t instance_cnt;
+ struct bt_csip *inst;
+ int err;
+
+ if (instance_cnt == ARRAY_SIZE(csip_insts)) {
+ return -ENOMEM;
+ }
+
+ CHECKIF(param == NULL) {
+ BT_DBG("NULL param");
+ return -EINVAL;
+ }
+
+ CHECKIF(!valid_register_param(param)) {
+ BT_DBG("Invalid parameters");
+ return -EINVAL;
+ }
+
+ inst = &csip_insts[instance_cnt];
+ inst->srv.service_p = &csip_service_list[instance_cnt];
+ instance_cnt++;
+
+ bt_conn_cb_register(&conn_callbacks);
+ bt_conn_auth_info_cb_register(&auth_callbacks);
+
+ err = bt_gatt_service_register(inst->srv.service_p);
+ if (err != 0) {
+ BT_DBG("CSIS service register failed: %d", err);
+ return err;
+ }
+
+ k_work_init_delayable(&inst->srv.set_lock_timer,
+ set_lock_timer_handler);
+ inst->srv.rank = param->rank;
+ inst->srv.set_size = param->set_size;
+ inst->srv.set_lock = BT_CSIP_RELEASE_VALUE;
+ inst->srv.set_sirk.type = BT_CSIP_SIRK_TYPE_PLAIN;
+ inst->srv.cb = param->cb;
+
+ if (IS_ENABLED(CONFIG_BT_CSIP_TEST_SAMPLE_DATA)) {
+ uint8_t test_sirk[] = {
+ 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
+ 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45,
+ };
+
+ (void)memcpy(inst->srv.set_sirk.value, test_sirk,
+ sizeof(test_sirk));
+ BT_DBG("CSIP SIRK was overwritten by sample data SIRK");
+ } else {
+ (void)memcpy(inst->srv.set_sirk.value, param->set_sirk,
+ sizeof(inst->srv.set_sirk.value));
+ }
+
+ *csip = inst;
+ return 0;
+}
+
+int bt_csip_lock(struct bt_csip *csip, bool lock, bool force)
+{
+ uint8_t lock_val;
+ int err = 0;
+
+ if (lock) {
+ lock_val = BT_CSIP_LOCK_VALUE;
+ } else {
+ lock_val = BT_CSIP_RELEASE_VALUE;
+ }
+
+ if (!lock && force) {
+ csip->srv.set_lock = BT_CSIP_RELEASE_VALUE;
+ notify_clients(csip, NULL);
+
+ if (csip->srv.cb != NULL && csip->srv.cb->lock_changed != NULL) {
+ csip->srv.cb->lock_changed(NULL, &csip_insts[0], false);
+ }
+ } else {
+ err = set_lock(NULL, csip, lock_val);
+ }
+
+ if (err < 0) {
+ return BT_GATT_ERR(err);
+ } else {
+ return 0;
+ }
+}
+
+void bt_csip_print_sirk(const struct bt_csip *csip)
+{
+ LOG_HEXDUMP_DBG(&csip->srv.set_sirk, sizeof(csip->srv.set_sirk),
+ "Set SIRK");
+}
diff --git a/subsys/bluetooth/audio/csis_crypto.c b/subsys/bluetooth/audio/csip_crypto.c
similarity index 75%
rename from subsys/bluetooth/audio/csis_crypto.c
rename to subsys/bluetooth/audio/csip_crypto.c
index 54c3e2c..914acf6 100644
--- a/subsys/bluetooth/audio/csis_crypto.c
+++ b/subsys/bluetooth/audio/csip_crypto.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Bose Corporation
- * Copyright (c) 2021 Nordic Semiconductor ASA
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -9,7 +9,7 @@
* in the CSIS spec is also provided as BE, and logging values as BE will make
* it easier to compare.
*/
-#include "csis_crypto.h"
+#include "csip_crypto.h"
#include <zephyr/bluetooth/crypto.h>
#include <tinycrypt/constants.h>
#include <tinycrypt/utils.h>
@@ -18,16 +18,16 @@
#include <tinycrypt/ccm_mode.h>
#include <zephyr/sys/byteorder.h>
-#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIS_CRYPTO)
-#define LOG_MODULE_NAME bt_csis_crypto
+#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIP_CRYPTO)
+#define LOG_MODULE_NAME bt_csip_crypto
#include "common/log.h"
#include "common/bt_str.h"
-#define BT_CSIS_CRYPTO_PADDING_SIZE 13
-#define BT_CSIS_R_SIZE 3 /* r is 24 bit / 3 octet */
-#define BT_CSIS_R_MASK BIT_MASK(24) /* r is 24 bit / 3 octet */
+#define BT_CSIP_CRYPTO_PADDING_SIZE 13
+#define BT_CSIP_R_SIZE 3 /* r is 24 bit / 3 octet */
+#define BT_CSIP_R_MASK BIT_MASK(24) /* r is 24 bit / 3 octet */
-static int aes_cmac(const uint8_t key[BT_CSIS_CRYPTO_KEY_SIZE],
+static int aes_cmac(const uint8_t key[BT_CSIP_CRYPTO_KEY_SIZE],
const uint8_t *in, size_t in_len, uint8_t *out)
{
struct tc_aes_key_sched_struct sched;
@@ -60,31 +60,31 @@
}
}
-int bt_csis_sih(const uint8_t sirk[BT_CSIS_SET_SIRK_SIZE], uint32_t r,
+int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint32_t r,
uint32_t *out)
{
uint8_t res[16]; /* need to store 128 bit */
int err;
- uint8_t sirk_tmp[BT_CSIS_SET_SIRK_SIZE];
+ uint8_t sirk_tmp[BT_CSIP_SET_SIRK_SIZE];
if ((r & BIT(23)) || ((r & BIT(22)) == 0)) {
- BT_DBG("Invalid r %0x06x", (uint32_t)(r & BT_CSIS_R_MASK));
+ BT_DBG("Invalid r %0x06x", (uint32_t)(r & BT_CSIP_R_MASK));
}
- BT_DBG("SIRK %s", bt_hex(sirk, BT_CSIS_SET_SIRK_SIZE));
+ BT_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SET_SIRK_SIZE));
BT_DBG("r 0x%06x", r);
/* r' = padding || r */
- (void)memset(res, 0, BT_CSIS_CRYPTO_PADDING_SIZE);
- sys_put_be24(r, res + BT_CSIS_CRYPTO_PADDING_SIZE);
+ (void)memset(res, 0, BT_CSIP_CRYPTO_PADDING_SIZE);
+ sys_put_be24(r, res + BT_CSIP_CRYPTO_PADDING_SIZE);
BT_DBG("BE: r' %s", bt_hex(res, sizeof(res)));
if (IS_ENABLED(CONFIG_LITTLE_ENDIAN)) {
/* Swap to Big Endian (BE) */
- sys_memcpy_swap(sirk_tmp, sirk, BT_CSIS_SET_SIRK_SIZE);
+ sys_memcpy_swap(sirk_tmp, sirk, BT_CSIP_SET_SIRK_SIZE);
} else {
- (void)memcpy(sirk_tmp, sirk, BT_CSIS_SET_SIRK_SIZE);
+ (void)memcpy(sirk_tmp, sirk, BT_CSIP_SET_SIRK_SIZE);
}
err = bt_encrypt_be(sirk_tmp, res, res);
@@ -126,7 +126,7 @@
* @return int 0 on success, any other value indicates a failure.
*/
static int k1(const uint8_t *n, size_t n_size,
- const uint8_t salt[BT_CSIS_CRYPTO_SALT_SIZE],
+ const uint8_t salt[BT_CSIP_CRYPTO_SALT_SIZE],
const uint8_t *p, size_t p_size, uint8_t out[16])
{
/* TODO: This is basically a duplicate of bt_mesh_k1 - Perhaps they can
@@ -142,7 +142,7 @@
*/
BT_DBG("BE: n %s", bt_hex(n, n_size));
- BT_DBG("BE: salt %s", bt_hex(salt, BT_CSIS_CRYPTO_SALT_SIZE));
+ BT_DBG("BE: salt %s", bt_hex(salt, BT_CSIP_CRYPTO_SALT_SIZE));
BT_DBG("BE: p %s", bt_hex(p, p_size));
err = aes_cmac(salt, n, n_size, t);
@@ -169,7 +169,7 @@
* @return int 0 on success, any other value indicates a failure.
*/
static int s1(const uint8_t *m, size_t m_size,
- uint8_t out[BT_CSIS_CRYPTO_SALT_SIZE])
+ uint8_t out[BT_CSIP_CRYPTO_SALT_SIZE])
{
uint8_t zero[16];
int err;
@@ -189,22 +189,22 @@
return err;
}
-int bt_csis_sef(const uint8_t k[BT_CSIS_CRYPTO_KEY_SIZE],
- const uint8_t sirk[BT_CSIS_SET_SIRK_SIZE],
- uint8_t out_sirk[BT_CSIS_SET_SIRK_SIZE])
+int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
+ const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE],
+ uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE])
{
const uint8_t m[] = {'S', 'I', 'R', 'K', 'e', 'n', 'c'};
const uint8_t p[] = {'c', 's', 'i', 's'};
- uint8_t s1_out[BT_CSIS_CRYPTO_SALT_SIZE];
- uint8_t k1_out[BT_CSIS_CRYPTO_KEY_SIZE];
- uint8_t k1_tmp[BT_CSIS_CRYPTO_KEY_SIZE];
+ uint8_t s1_out[BT_CSIP_CRYPTO_SALT_SIZE];
+ uint8_t k1_out[BT_CSIP_CRYPTO_KEY_SIZE];
+ uint8_t k1_tmp[BT_CSIP_CRYPTO_KEY_SIZE];
int err;
/*
* sef(K, SIRK) = k1(K, s1("SIRKenc"), "csis") ^ SIRK
*/
- BT_DBG("SIRK %s", bt_hex(sirk, BT_CSIS_SET_SIRK_SIZE));
+ BT_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SET_SIRK_SIZE));
if (IS_ENABLED(CONFIG_LITTLE_ENDIAN)) {
/* Swap because aes_cmac is big endian
@@ -236,14 +236,14 @@
}
xor_128(k1_out, sirk, out_sirk);
- BT_DBG("out %s", bt_hex(out_sirk, BT_CSIS_SET_SIRK_SIZE));
+ BT_DBG("out %s", bt_hex(out_sirk, BT_CSIP_SET_SIRK_SIZE));
return 0;
}
-int bt_csis_sdf(const uint8_t k[BT_CSIS_CRYPTO_KEY_SIZE],
- const uint8_t enc_sirk[BT_CSIS_SET_SIRK_SIZE],
- uint8_t out_sirk[BT_CSIS_SET_SIRK_SIZE])
+int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
+ const uint8_t enc_sirk[BT_CSIP_SET_SIRK_SIZE],
+ uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE])
{
/* SIRK encryption is currently symmetric, which means that we can
* simply apply the sef function to decrypt it.
@@ -254,5 +254,5 @@
*/
BT_DBG("Running SDF as SEF");
- return bt_csis_sef(k, enc_sirk, out_sirk);
+ return bt_csip_sef(k, enc_sirk, out_sirk);
}
diff --git a/subsys/bluetooth/audio/csis_crypto.h b/subsys/bluetooth/audio/csip_crypto.h
similarity index 82%
rename from subsys/bluetooth/audio/csis_crypto.h
rename to subsys/bluetooth/audio/csip_crypto.h
index a14f65b..62da5f0 100644
--- a/subsys/bluetooth/audio/csis_crypto.h
+++ b/subsys/bluetooth/audio/csip_crypto.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2019 Bose Corporation
- * Copyright (c) 2021 Nordic Semiconductor ASA
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -8,10 +8,10 @@
#include <stddef.h>
#include <zephyr/types.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
-#define BT_CSIS_CRYPTO_KEY_SIZE 16
-#define BT_CSIS_CRYPTO_SALT_SIZE 16
+#define BT_CSIP_CRYPTO_KEY_SIZE 16
+#define BT_CSIP_CRYPTO_SALT_SIZE 16
/**
* @brief Private Set Unique identifier hash function sih.
@@ -25,7 +25,7 @@
* @param out The 3 byte output buffer
* @return int 0 on success, any other value indicates a failure.
*/
-int bt_csis_sih(const uint8_t sirk[BT_CSIS_SET_SIRK_SIZE], uint32_t r,
+int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint32_t r,
uint32_t *out);
/**
@@ -51,9 +51,9 @@
* @param out_sirk The encrypted SIRK.
* @return int 0 on success, any other value indicates a failure.
*/
-int bt_csis_sef(const uint8_t k[BT_CSIS_CRYPTO_KEY_SIZE],
- const uint8_t sirk[BT_CSIS_SET_SIRK_SIZE],
- uint8_t out_sirk[BT_CSIS_SET_SIRK_SIZE]);
+int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
+ const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE],
+ uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE]);
/**
* @brief SIRK decryption function sdf
@@ -78,6 +78,6 @@
* @param out_sirk The decrypted SIRK.
* @return int 0 on success, any other value indicates a failure.
*/
-int bt_csis_sdf(const uint8_t k[BT_CSIS_CRYPTO_KEY_SIZE],
- const uint8_t enc_sirk[BT_CSIS_SET_SIRK_SIZE],
- uint8_t out_sirk[BT_CSIS_SET_SIRK_SIZE]);
+int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
+ const uint8_t enc_sirk[BT_CSIP_SET_SIRK_SIZE],
+ uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE]);
diff --git a/subsys/bluetooth/audio/csip_internal.h b/subsys/bluetooth/audio/csip_internal.h
new file mode 100644
index 0000000..a0ec7b6
--- /dev/null
+++ b/subsys/bluetooth/audio/csip_internal.h
@@ -0,0 +1,90 @@
+/**
+ * @file
+ * @brief Internal APIs for Bluetooth CSIP
+ *
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <zephyr/bluetooth/audio/csip.h>
+
+
+#define BT_CSIP_SIRK_TYPE_ENCRYPTED 0x00
+#define BT_CSIP_SIRK_TYPE_PLAIN 0x01
+
+#define BT_CSIP_RELEASE_VALUE 0x01
+#define BT_CSIP_LOCK_VALUE 0x02
+
+struct csip_pending_notifications {
+ bt_addr_le_t addr;
+ bool pending;
+ bool active;
+
+/* Since there's a 1-to-1 connection between bonded devices, and devices in
+ * the array containing this struct, if the security manager overwrites
+ * the oldest keys, we also overwrite the oldest entry
+ */
+#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
+ uint32_t age;
+#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
+};
+
+struct bt_csip_set_sirk {
+ uint8_t type;
+ uint8_t value[BT_CSIP_SET_SIRK_SIZE];
+} __packed;
+
+struct bt_csip_set_coordinator_svc_inst {
+ uint8_t rank;
+ uint8_t set_lock;
+
+ uint16_t start_handle;
+ uint16_t end_handle;
+ uint16_t set_sirk_handle;
+ uint16_t set_size_handle;
+ uint16_t set_lock_handle;
+ uint16_t rank_handle;
+
+ uint8_t idx;
+ struct bt_gatt_subscribe_params sirk_sub_params;
+ struct bt_gatt_discover_params sirk_sub_disc_params;
+ struct bt_gatt_subscribe_params size_sub_params;
+ struct bt_gatt_discover_params size_sub_disc_params;
+ struct bt_gatt_subscribe_params lock_sub_params;
+ struct bt_gatt_discover_params lock_sub_disc_params;
+
+ struct bt_conn *conn;
+ struct bt_csip_set_coordinator_set_member *member;
+};
+
+/* TODO: Rename to bt_csip_svc_inst */
+struct bt_csip_server {
+ struct bt_csip_set_sirk set_sirk;
+ uint8_t set_size;
+ uint8_t set_lock;
+ uint8_t rank;
+ struct bt_csip_cb *cb;
+ struct k_work_delayable set_lock_timer;
+ bt_addr_le_t lock_client_addr;
+ struct bt_gatt_service *service_p;
+ struct csip_pending_notifications pend_notify[CONFIG_BT_MAX_PAIRED];
+#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
+ uint32_t age_counter;
+#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
+};
+
+struct bt_csip {
+ bool client_instance;
+ union {
+#if defined(CONFIG_BT_CSIP)
+ struct bt_csip_server srv;
+#endif /* CONFIG_BT_CSIP */
+#if defined(CONFIG_BT_CSIP_SET_COORDINATOR)
+ struct bt_csip_set_coordinator_svc_inst cli;
+#endif /* CONFIG_BT_CSIP_SET_COORDINATOR */
+ };
+};
+
+struct bt_csip_set_coordinator_csis_inst *bt_csip_set_coordinator_csis_inst_by_handle(
+ struct bt_conn *conn, uint16_t start_handle);
diff --git a/subsys/bluetooth/audio/csis_client.c b/subsys/bluetooth/audio/csip_set_coordinator.c
similarity index 66%
rename from subsys/bluetooth/audio/csis_client.c
rename to subsys/bluetooth/audio/csip_set_coordinator.c
index b31fb99..9d0d2a7 100644
--- a/subsys/bluetooth/audio/csis_client.c
+++ b/subsys/bluetooth/audio/csip_set_coordinator.c
@@ -1,11 +1,11 @@
/* Bluetooth Coordinated Set Identification Client
*
* Copyright (c) 2020 Bose Corporation
- * Copyright (c) 2021 Nordic Semiconductor ASA
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*
- * csis_client should be used in the following way
+ * csip_set_coordinator should be used in the following way
* 1) Find and connect to a set device
* 2) Do discovery
* 3) read values (always SIRK, size, lock and rank if possible)
@@ -31,50 +31,51 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/sys/byteorder.h>
-#include <zephyr/bluetooth/audio/csis.h>
-#include "csis_crypto.h"
-#include "csis_internal.h"
+#include <zephyr/bluetooth/audio/csip.h>
+#include "csip_crypto.h"
+#include "csip_internal.h"
#include "../host/conn_internal.h"
#include "../host/keys.h"
-#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIS_CLIENT)
-#define LOG_MODULE_NAME bt_csis_client
+#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIP_SET_COORDINATOR)
+#define LOG_MODULE_NAME bt_csip_set_coordinator
#include "common/log.h"
static uint8_t gatt_write_buf[1];
static struct bt_gatt_write_params write_params;
static struct bt_gatt_read_params read_params;
static struct bt_gatt_discover_params discover_params;
-static struct bt_csis *cur_inst;
+static struct bt_csip *cur_inst;
static bool busy;
static struct active_members {
- struct bt_csis_client_set_member *members[CONFIG_BT_MAX_CONN];
- const struct bt_csis_client_set_info *info;
+ struct bt_csip_set_coordinator_set_member *members[CONFIG_BT_MAX_CONN];
+ const struct bt_csip_set_coordinator_set_info *info;
uint8_t members_count;
uint8_t members_handled;
uint8_t members_restored;
- bt_csis_client_ordered_access_t oap_cb;
+ bt_csip_set_coordinator_ordered_access_t oap_cb;
} active;
-struct bt_csis_client_inst {
+struct bt_csip_set_coordinator_inst {
uint8_t inst_count;
- struct bt_csis csis_insts[CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES];
- struct bt_csis_client_set_member set_member;
+ struct bt_csip csip_insts[CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES];
+ struct bt_csip_set_coordinator_set_member set_member;
struct bt_conn *conn;
};
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
-static sys_slist_t csis_client_cbs = SYS_SLIST_STATIC_INIT(&csis_client_cbs);
-static struct bt_csis_client_inst client_insts[CONFIG_BT_MAX_CONN];
+static sys_slist_t csip_set_coordinator_cbs = SYS_SLIST_STATIC_INIT(&csip_set_coordinator_cbs);
+static struct bt_csip_set_coordinator_inst client_insts[CONFIG_BT_MAX_CONN];
-static int read_set_sirk(struct bt_csis *csis);
-static int csis_client_read_set_size(struct bt_conn *conn, uint8_t inst_idx,
- bt_gatt_read_func_t cb);
-static int csis_client_read_set_lock(struct bt_csis *inst);
+static int read_set_sirk(struct bt_csip *csip);
+static int csip_set_coordinator_read_set_size(struct bt_conn *conn,
+ uint8_t inst_idx,
+ bt_gatt_read_func_t cb);
+static int csip_set_coordinator_read_set_lock(struct bt_csip *inst);
-static uint8_t csis_client_discover_insts_read_set_sirk_cb(
+static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb(
struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params,
const void *data, uint16_t length);
static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle,
@@ -85,11 +86,11 @@
(void)memset(&active, 0, sizeof(active));
}
-static struct bt_csis *lookup_instance_by_handle(struct bt_conn *conn,
+static struct bt_csip *lookup_instance_by_handle(struct bt_conn *conn,
uint16_t handle)
{
uint8_t conn_index;
- struct bt_csis_client_inst *client;
+ struct bt_csip_set_coordinator_inst *client;
__ASSERT(conn, "NULL conn");
__ASSERT(handle > 0, "Handle cannot be 0");
@@ -97,41 +98,41 @@
conn_index = bt_conn_index(conn);
client = &client_insts[conn_index];
- for (int i = 0; i < ARRAY_SIZE(client->csis_insts); i++) {
- if (client->csis_insts[i].cli.start_handle <= handle &&
- client->csis_insts[i].cli.end_handle >= handle) {
- return &client->csis_insts[i];
+ for (int i = 0; i < ARRAY_SIZE(client->csip_insts); i++) {
+ if (client->csip_insts[i].cli.start_handle <= handle &&
+ client->csip_insts[i].cli.end_handle >= handle) {
+ return &client->csip_insts[i];
}
}
return NULL;
}
-static struct bt_csis *lookup_instance_by_index(const struct bt_conn *conn,
+static struct bt_csip *lookup_instance_by_index(const struct bt_conn *conn,
uint8_t idx)
{
uint8_t conn_index;
- struct bt_csis_client_inst *client;
+ struct bt_csip_set_coordinator_inst *client;
__ASSERT(conn, "NULL conn");
- __ASSERT(idx < CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES,
+ __ASSERT(idx < CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES,
"Index shall be less than maximum number of instances %u (was %u)",
- CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES, idx);
+ CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES, idx);
conn_index = bt_conn_index(conn);
client = &client_insts[conn_index];
- return &client->csis_insts[idx];
+ return &client->csip_insts[idx];
}
-static struct bt_csis *lookup_instance_by_set_info(const struct bt_csis_client_set_member *member,
- const struct bt_csis_client_set_info *set_info)
+static struct bt_csip *lookup_instance_by_set_info(
+ const struct bt_csip_set_coordinator_set_member *member,
+ const struct bt_csip_set_coordinator_set_info *set_info)
{
- struct bt_csis_client_inst *inst = CONTAINER_OF(member,
- struct bt_csis_client_inst,
- set_member);
+ struct bt_csip_set_coordinator_inst *inst =
+ CONTAINER_OF(member, struct bt_csip_set_coordinator_inst, set_member);
for (int i = 0; i < ARRAY_SIZE(member->insts); i++) {
- const struct bt_csis_client_set_info *member_set_info;
+ const struct bt_csip_set_coordinator_set_info *member_set_info;
member_set_info = &member->insts[i].info;
if (member_set_info->set_size == set_info->set_size &&
@@ -145,10 +146,10 @@
return NULL;
}
-static struct bt_csis *get_next_active_instance(void)
+static struct bt_csip *get_next_active_instance(void)
{
- struct bt_csis_client_set_member *member;
- struct bt_csis *inst;
+ struct bt_csip_set_coordinator_set_member *member;
+ struct bt_csip *inst;
member = active.members[active.members_handled];
@@ -162,12 +163,12 @@
static int member_rank_compare_asc(const void *m1, const void *m2)
{
- const struct bt_csis_client_set_member *member_1 =
- *(const struct bt_csis_client_set_member **)m1;
- const struct bt_csis_client_set_member *member_2 =
- *(const struct bt_csis_client_set_member **)m2;
- struct bt_csis *inst_1;
- struct bt_csis *inst_2;
+ const struct bt_csip_set_coordinator_set_member *member_1 =
+ *(const struct bt_csip_set_coordinator_set_member **)m1;
+ const struct bt_csip_set_coordinator_set_member *member_2 =
+ *(const struct bt_csip_set_coordinator_set_member **)m2;
+ struct bt_csip *inst_1;
+ struct bt_csip *inst_2;
inst_1 = lookup_instance_by_set_info(member_1, active.info);
inst_2 = lookup_instance_by_set_info(member_2, active.info);
@@ -193,9 +194,9 @@
return member_rank_compare_asc(m2, m1);
}
-static void active_members_store_ordered(const struct bt_csis_client_set_member *members[],
+static void active_members_store_ordered(const struct bt_csip_set_coordinator_set_member *members[],
size_t count,
- const struct bt_csis_client_set_info *info,
+ const struct bt_csip_set_coordinator_set_info *info,
bool ascending)
{
(void)memcpy(active.members, members, count * sizeof(members[0U]));
@@ -208,9 +209,9 @@
if (IS_ENABLED(CONFIG_ASSERT)) {
for (size_t i = 1U; i < count; i++) {
- const struct bt_csis *inst_1 =
+ const struct bt_csip *inst_1 =
lookup_instance_by_set_info(active.members[i - 1U], info);
- const struct bt_csis *inst_2 =
+ const struct bt_csip *inst_2 =
lookup_instance_by_set_info(active.members[i], info);
const uint8_t rank_1 = inst_1->cli.rank;
const uint8_t rank_2 = inst_2->cli.rank;
@@ -236,7 +237,7 @@
int err;
uint8_t *k;
- if (IS_ENABLED(CONFIG_BT_CSIS_CLIENT_TEST_SAMPLE_DATA)) {
+ if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR_TEST_SAMPLE_DATA)) {
/* test_k is from the sample data from A.2 in the CSIS spec */
static uint8_t test_k[] = {0x67, 0x6e, 0x1b, 0x9b,
0xd4, 0x48, 0x69, 0x6f,
@@ -256,18 +257,18 @@
k = conn->le.keys->ltk.val;
}
- err = bt_csis_sdf(k, enc_sirk, out_sirk);
+ err = bt_csip_sdf(k, enc_sirk, out_sirk);
return err;
}
-static void lock_changed(struct bt_csis_client_csis_inst *inst, bool locked)
+static void lock_changed(struct bt_csip_set_coordinator_csis_inst *inst, bool locked)
{
- struct bt_csis_client_cb *listener;
+ struct bt_csip_set_coordinator_cb *listener;
active_members_reset();
- SYS_SLIST_FOR_EACH_CONTAINER(&csis_client_cbs, listener, _node) {
+ SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->lock_changed) {
listener->lock_changed(inst, locked);
}
@@ -276,11 +277,11 @@
static void release_set_complete(int err)
{
- struct bt_csis_client_cb *listener;
+ struct bt_csip_set_coordinator_cb *listener;
active_members_reset();
- SYS_SLIST_FOR_EACH_CONTAINER(&csis_client_cbs, listener, _node) {
+ SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->release_set) {
listener->release_set(err);
}
@@ -289,41 +290,42 @@
static void lock_set_complete(int err)
{
- struct bt_csis_client_cb *listener;
+ struct bt_csip_set_coordinator_cb *listener;
active_members_reset();
- SYS_SLIST_FOR_EACH_CONTAINER(&csis_client_cbs, listener, _node) {
+ SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->lock_set) {
listener->lock_set(err);
}
}
}
-static void ordered_access_complete(const struct bt_csis_client_set_info *set_info,
+static void ordered_access_complete(const struct bt_csip_set_coordinator_set_info *set_info,
int err, bool locked,
- struct bt_csis_client_set_member *member)
+ struct bt_csip_set_coordinator_set_member *member)
{
- struct bt_csis_client_cb *listener;
+ struct bt_csip_set_coordinator_cb *listener;
active_members_reset();
- SYS_SLIST_FOR_EACH_CONTAINER(&csis_client_cbs, listener, _node) {
+ SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->ordered_access) {
listener->ordered_access(set_info, err, locked, member);
}
}
}
-static void discover_complete(struct bt_csis_client_inst *client, int err)
+static void discover_complete(struct bt_csip_set_coordinator_inst *client,
+ int err)
{
- struct bt_csis_client_cb *listener;
+ struct bt_csip_set_coordinator_cb *listener;
cur_inst = NULL;
busy = false;
- SYS_SLIST_FOR_EACH_CONTAINER(&csis_client_cbs, listener, _node) {
+ SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->discover) {
if (err == 0) {
listener->discover(client->conn,
@@ -341,7 +343,7 @@
const void *data, uint16_t length)
{
uint16_t handle = params->value_handle;
- struct bt_csis *csis_inst;
+ struct bt_csip *csip_inst;
if (data == NULL) {
BT_DBG("[UNSUBSCRIBED] %u", params->value_handle);
@@ -354,26 +356,26 @@
return BT_GATT_ITER_CONTINUE;
}
- csis_inst = lookup_instance_by_handle(conn, handle);
+ csip_inst = lookup_instance_by_handle(conn, handle);
- if (csis_inst != NULL) {
- BT_DBG("Instance %u", csis_inst->cli.idx);
- if (length == sizeof(struct bt_csis_set_sirk)) {
- struct bt_csis_set_sirk *sirk =
- (struct bt_csis_set_sirk *)data;
- struct bt_csis_client_inst *client;
+ if (csip_inst != NULL) {
+ BT_DBG("Instance %u", csip_inst->cli.idx);
+ if (length == sizeof(struct bt_csip_set_sirk)) {
+ struct bt_csip_set_sirk *sirk =
+ (struct bt_csip_set_sirk *)data;
+ struct bt_csip_set_coordinator_inst *client;
uint8_t *dst_sirk;
client = &client_insts[bt_conn_index(conn)];
- dst_sirk = client->set_member.insts[csis_inst->cli.idx].info.set_sirk;
+ dst_sirk = client->set_member.insts[csip_inst->cli.idx].info.set_sirk;
BT_DBG("Set SIRK %sencrypted",
- sirk->type == BT_CSIS_SIRK_TYPE_PLAIN
+ sirk->type == BT_CSIP_SIRK_TYPE_PLAIN
? "not " : "");
/* Assuming not connected to other set devices */
- if (sirk->type == BT_CSIS_SIRK_TYPE_ENCRYPTED) {
- if (IS_ENABLED(CONFIG_BT_CSIS_CLIENT_ENC_SIRK_SUPPORT)) {
+ if (sirk->type == BT_CSIP_SIRK_TYPE_ENCRYPTED) {
+ if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR_ENC_SIRK_SUPPORT)) {
int err;
LOG_HEXDUMP_DBG(sirk->value, sizeof(*sirk),
@@ -392,14 +394,15 @@
(void)memcpy(dst_sirk, sirk->value, sizeof(sirk->value));
}
- LOG_HEXDUMP_DBG(dst_sirk, BT_CSIS_SET_SIRK_SIZE, "Set SIRK");
+ LOG_HEXDUMP_DBG(dst_sirk, BT_CSIP_SET_SIRK_SIZE,
+ "Set SIRK");
/* TODO: Notify app */
} else {
BT_DBG("Invalid length %u", length);
}
} else {
- BT_DBG("Notification/Indication on unknown CSIS inst");
+ BT_DBG("Notification/Indication on unknown CSIP inst");
}
return BT_GATT_ITER_CONTINUE;
@@ -411,7 +414,7 @@
{
uint8_t set_size;
uint16_t handle = params->value_handle;
- struct bt_csis *csis_inst;
+ struct bt_csip *csip_inst;
if (data == NULL) {
BT_DBG("[UNSUBSCRIBED] %u", params->value_handle);
@@ -424,15 +427,15 @@
return BT_GATT_ITER_CONTINUE;
}
- csis_inst = lookup_instance_by_handle(conn, handle);
+ csip_inst = lookup_instance_by_handle(conn, handle);
- if (csis_inst != NULL) {
+ if (csip_inst != NULL) {
if (length == sizeof(set_size)) {
- struct bt_csis_client_inst *client;
- struct bt_csis_client_set_info *set_info;
+ struct bt_csip_set_coordinator_inst *client;
+ struct bt_csip_set_coordinator_set_info *set_info;
client = &client_insts[bt_conn_index(conn)];
- set_info = &client->set_member.insts[csis_inst->cli.idx].info;
+ set_info = &client->set_member.insts[csip_inst->cli.idx].info;
(void)memcpy(&set_size, data, length);
BT_DBG("Set size updated from %u to %u",
@@ -445,7 +448,7 @@
}
} else {
- BT_DBG("Notification/Indication on unknown CSIS inst");
+ BT_DBG("Notification/Indication on unknown CSIP inst");
}
LOG_HEXDUMP_DBG(data, length, "Value");
@@ -458,7 +461,7 @@
{
uint8_t value;
uint16_t handle = params->value_handle;
- struct bt_csis *csis_inst;
+ struct bt_csip *csip_inst;
if (data == NULL) {
BT_DBG("[UNSUBSCRIBED] %u", params->value_handle);
@@ -471,45 +474,45 @@
return BT_GATT_ITER_CONTINUE;
}
- csis_inst = lookup_instance_by_handle(conn, handle);
+ csip_inst = lookup_instance_by_handle(conn, handle);
- if (csis_inst != NULL) {
- if (length == sizeof(csis_inst->cli.set_lock)) {
- struct bt_csis_client_inst *client;
- struct bt_csis_client_csis_inst *inst;
+ if (csip_inst != NULL) {
+ if (length == sizeof(csip_inst->cli.set_lock)) {
+ struct bt_csip_set_coordinator_inst *client;
+ struct bt_csip_set_coordinator_csis_inst *inst;
bool locked;
(void)memcpy(&value, data, length);
- if (value != BT_CSIS_RELEASE_VALUE &&
- value != BT_CSIS_LOCK_VALUE) {
+ if (value != BT_CSIP_RELEASE_VALUE &&
+ value != BT_CSIP_LOCK_VALUE) {
BT_DBG("Invalid value %u", value);
return BT_GATT_ITER_STOP;
}
- (void)memcpy(&csis_inst->cli.set_lock, data, length);
+ (void)memcpy(&csip_inst->cli.set_lock, data, length);
- locked = csis_inst->cli.set_lock == BT_CSIS_LOCK_VALUE;
+ locked = csip_inst->cli.set_lock == BT_CSIP_LOCK_VALUE;
BT_DBG("Instance %u lock was %s",
- csis_inst->cli.idx,
+ csip_inst->cli.idx,
locked ? "locked" : "released");
client = &client_insts[bt_conn_index(conn)];
- inst = &client->set_member.insts[csis_inst->cli.idx];
+ inst = &client->set_member.insts[csip_inst->cli.idx];
lock_changed(inst, locked);
} else {
BT_DBG("Invalid length %u", length);
}
} else {
- BT_DBG("Notification/Indication on unknown CSIS inst");
+ BT_DBG("Notification/Indication on unknown CSIP inst");
}
LOG_HEXDUMP_DBG(data, length, "Value");
return BT_GATT_ITER_CONTINUE;
}
-static int csis_client_write_set_lock(struct bt_csis *inst,
- bool lock, bt_gatt_write_func_t cb)
+static int csip_set_coordinator_write_set_lock(struct bt_csip *inst, bool lock,
+ bt_gatt_write_func_t cb)
{
if (inst->cli.set_lock_handle == 0) {
BT_DBG("Handle not set");
@@ -518,7 +521,7 @@
}
/* Write to call control point */
- gatt_write_buf[0] = lock ? BT_CSIS_LOCK_VALUE : BT_CSIS_RELEASE_VALUE;
+ gatt_write_buf[0] = lock ? BT_CSIP_LOCK_VALUE : BT_CSIP_RELEASE_VALUE;
write_params.data = gatt_write_buf;
write_params.length = sizeof(lock);
write_params.func = cb;
@@ -527,33 +530,34 @@
return bt_gatt_write(inst->cli.conn, &write_params);
}
-static int read_set_sirk(struct bt_csis *csis)
+static int read_set_sirk(struct bt_csip *csip)
{
if (cur_inst != NULL) {
- if (cur_inst != csis) {
+ if (cur_inst != csip) {
return -EBUSY;
}
} else {
- cur_inst = csis;
+ cur_inst = csip;
}
- if (csis->cli.set_sirk_handle == 0) {
+ if (csip->cli.set_sirk_handle == 0) {
BT_DBG("Handle not set");
return -EINVAL;
}
- read_params.func = csis_client_discover_insts_read_set_sirk_cb;
+ read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb;
read_params.handle_count = 1;
- read_params.single.handle = csis->cli.set_sirk_handle;
+ read_params.single.handle = csip->cli.set_sirk_handle;
read_params.single.offset = 0U;
- return bt_gatt_read(csis->cli.conn, &read_params);
+ return bt_gatt_read(csip->cli.conn, &read_params);
}
-static int csis_client_read_set_size(struct bt_conn *conn, uint8_t inst_idx,
- bt_gatt_read_func_t cb)
+static int csip_set_coordinator_read_set_size(struct bt_conn *conn,
+ uint8_t inst_idx,
+ bt_gatt_read_func_t cb)
{
- if (inst_idx >= CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES) {
+ if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) {
return -EINVAL;
} else if (cur_inst != NULL) {
if (cur_inst != lookup_instance_by_index(conn, inst_idx)) {
@@ -581,10 +585,11 @@
return bt_gatt_read(conn, &read_params);
}
-static int csis_client_read_rank(struct bt_conn *conn, uint8_t inst_idx,
- bt_gatt_read_func_t cb)
+static int csip_set_coordinator_read_rank(struct bt_conn *conn,
+ uint8_t inst_idx,
+ bt_gatt_read_func_t cb)
{
- if (inst_idx >= CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES) {
+ if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) {
return -EINVAL;
} else if (cur_inst != NULL) {
if (cur_inst != lookup_instance_by_index(conn, inst_idx)) {
@@ -612,12 +617,12 @@
return bt_gatt_read(conn, &read_params);
}
-static int csis_client_discover_sets(struct bt_csis_client_set_member *member)
+static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_set_member *member)
{
int err;
/* Start reading values and call CB when done */
- err = read_set_sirk(member->insts[0].csis);
+ err = read_set_sirk(member->insts[0].csip);
if (err == 0) {
busy = true;
}
@@ -630,7 +635,7 @@
struct bt_gatt_discover_params *params)
{
struct bt_gatt_chrc *chrc;
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
struct bt_gatt_subscribe_params *sub_params = NULL;
void *notify_handler = NULL;
@@ -642,7 +647,7 @@
if ((cur_inst->cli.idx + 1) < client->inst_count) {
int err;
- cur_inst = &client->csis_insts[cur_inst->cli.idx + 1];
+ cur_inst = &client->csip_insts[cur_inst->cli.idx + 1];
discover_params.uuid = NULL;
discover_params.start_handle = cur_inst->cli.start_handle;
discover_params.end_handle = cur_inst->cli.end_handle;
@@ -660,7 +665,7 @@
cur_inst = NULL;
busy = false;
- err = csis_client_discover_sets(&client->set_member);
+ err = csip_set_coordinator_discover_sets(&client->set_member);
if (err != 0) {
BT_DBG("Discover sets failed (err %d)", err);
discover_complete(client, err);
@@ -724,10 +729,10 @@
struct bt_gatt_discover_params *params)
{
struct bt_gatt_service_val *prim_service;
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
if (attr == NULL ||
- client->inst_count == CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES) {
+ client->inst_count == CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) {
BT_DBG("Discover complete, found %u instances",
client->inst_count);
(void)memset(params, 0, sizeof(*params));
@@ -735,7 +740,7 @@
if (client->inst_count != 0) {
int err;
- cur_inst = &client->csis_insts[0];
+ cur_inst = &client->csip_insts[0];
discover_params.uuid = NULL;
discover_params.start_handle = cur_inst->cli.start_handle;
discover_params.end_handle = cur_inst->cli.end_handle;
@@ -760,7 +765,7 @@
prim_service = (struct bt_gatt_service_val *)attr->user_data;
discover_params.start_handle = attr->handle + 1;
- cur_inst = &client->csis_insts[client->inst_count];
+ cur_inst = &client->csip_insts[client->inst_count];
cur_inst->cli.idx = client->inst_count;
cur_inst->cli.start_handle = attr->handle;
cur_inst->cli.end_handle = prim_service->end_handle;
@@ -771,11 +776,11 @@
return BT_GATT_ITER_CONTINUE;
}
-bool bt_csis_client_is_set_member(const uint8_t set_sirk[BT_CSIS_SET_SIRK_SIZE],
+bool bt_csip_set_coordinator_is_set_member(const uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE],
struct bt_data *data)
{
if (data->type == BT_DATA_CSIS_RSI &&
- data->data_len == BT_CSIS_RSI_SIZE) {
+ data->data_len == BT_CSIP_RSI_SIZE) {
uint8_t err;
uint32_t hash = sys_get_le24(data->data);
@@ -783,7 +788,7 @@
uint32_t calculated_hash;
BT_DBG("hash: 0x%06x, prand 0x%06x", hash, prand);
- err = bt_csis_sih(set_sirk, prand, &calculated_hash);
+ err = bt_csip_sih(set_sirk, prand, &calculated_hash);
if (err != 0) {
return false;
}
@@ -799,13 +804,13 @@
return false;
}
-static uint8_t csis_client_discover_insts_read_rank_cb(struct bt_conn *conn,
- uint8_t err,
- struct bt_gatt_read_params *params,
- const void *data,
- uint16_t length)
+static uint8_t csip_set_coordinator_discover_insts_read_rank_cb(struct bt_conn *conn,
+ uint8_t err,
+ struct bt_gatt_read_params *params,
+ const void *data,
+ uint16_t length)
{
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
__ASSERT(cur_inst != NULL, "cur_inst must not be NULL");
@@ -819,10 +824,10 @@
LOG_HEXDUMP_DBG(data, length, "Data read");
if (length == 1) {
- (void)memcpy(&client->csis_insts[cur_inst->cli.idx].cli.rank,
+ (void)memcpy(&client->csip_insts[cur_inst->cli.idx].cli.rank,
data, length);
BT_DBG("%u",
- client->csis_insts[cur_inst->cli.idx].cli.rank);
+ client->csip_insts[cur_inst->cli.idx].cli.rank);
} else {
BT_DBG("Invalid length, continuing to next member");
}
@@ -833,13 +838,11 @@
return BT_GATT_ITER_STOP;
}
-static uint8_t csis_client_discover_insts_read_set_size_cb(struct bt_conn *conn,
- uint8_t err,
- struct bt_gatt_read_params *params,
- const void *data,
- uint16_t length)
+static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb(
+ struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params,
+ const void *data, uint16_t length)
{
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
__ASSERT(cur_inst != NULL, "cur_inst must not be NULL");
@@ -850,7 +853,7 @@
discover_complete(client, err);
} else if (data != NULL) {
- struct bt_csis_client_set_info *set_info;
+ struct bt_csip_set_coordinator_set_info *set_info;
LOG_HEXDUMP_DBG(data, length, "Data read");
@@ -869,22 +872,22 @@
return BT_GATT_ITER_STOP;
}
-static int parse_sirk(struct bt_csis_client_inst *client,
+static int parse_sirk(struct bt_csip_set_coordinator_inst *client,
const void *data, uint16_t length)
{
uint8_t *set_sirk;
set_sirk = client->set_member.insts[cur_inst->cli.idx].info.set_sirk;
- if (length == sizeof(struct bt_csis_set_sirk)) {
- struct bt_csis_set_sirk *sirk =
- (struct bt_csis_set_sirk *)data;
+ if (length == sizeof(struct bt_csip_set_sirk)) {
+ struct bt_csip_set_sirk *sirk =
+ (struct bt_csip_set_sirk *)data;
BT_DBG("Set SIRK %sencrypted",
- sirk->type == BT_CSIS_SIRK_TYPE_PLAIN ? "not " : "");
+ sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
/* Assuming not connected to other set devices */
- if (sirk->type == BT_CSIS_SIRK_TYPE_ENCRYPTED) {
- if (IS_ENABLED(CONFIG_BT_CSIS_CLIENT_ENC_SIRK_SUPPORT)) {
+ if (sirk->type == BT_CSIP_SIRK_TYPE_ENCRYPTED) {
+ if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR_ENC_SIRK_SUPPORT)) {
int err;
LOG_HEXDUMP_DBG(sirk->value, sizeof(sirk->value),
@@ -906,7 +909,8 @@
}
if (set_sirk != NULL) {
- LOG_HEXDUMP_DBG(set_sirk, BT_CSIS_SET_SIRK_SIZE, "Set SIRK");
+ LOG_HEXDUMP_DBG(set_sirk, BT_CSIP_SET_SIRK_SIZE,
+ "Set SIRK");
}
} else {
BT_DBG("Invalid length");
@@ -916,13 +920,11 @@
return 0;
}
-static uint8_t csis_client_discover_insts_read_set_sirk_cb(struct bt_conn *conn,
- uint8_t err,
- struct bt_gatt_read_params *params,
- const void *data,
- uint16_t length)
+static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb(
+ struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params,
+ const void *data, uint16_t length)
{
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
int cb_err = err;
__ASSERT(cur_inst != NULL, "cur_inst must not be NULL");
@@ -954,7 +956,7 @@
*
* It skips all handles that are 0.
*
- * @param conn Connection to a CSIS device.
+ * @param conn Connection to a CSIP device.
* @param sirk_handle 0, or the handle for the SIRK characteristic.
* @param size_handle 0, or the handle for the size characteristic.
* @param rank_handle 0, or the handle for the rank characteristic.
@@ -963,19 +965,19 @@
uint16_t size_handle, uint16_t rank_handle)
{
int cb_err = 0;
- struct bt_csis_client_inst *client = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
if (size_handle != 0) {
- cb_err = csis_client_read_set_size(
+ cb_err = csip_set_coordinator_read_set_size(
conn, cur_inst->cli.idx,
- csis_client_discover_insts_read_set_size_cb);
+ csip_set_coordinator_discover_insts_read_set_size_cb);
if (cb_err != 0) {
BT_DBG("Could not read set size: %d", cb_err);
}
} else if (rank_handle != 0) {
- cb_err = csis_client_read_rank(
+ cb_err = csip_set_coordinator_read_rank(
conn, cur_inst->cli.idx,
- csis_client_discover_insts_read_rank_cb);
+ csip_set_coordinator_discover_insts_read_rank_cb);
if (cb_err != 0) {
BT_DBG("Could not read set rank: %d", cb_err);
}
@@ -1002,8 +1004,9 @@
}
}
-static void csis_client_write_restore_cb(struct bt_conn *conn, uint8_t err,
- struct bt_gatt_write_params *params)
+static void csip_set_coordinator_write_restore_cb(struct bt_conn *conn,
+ uint8_t err,
+ struct bt_gatt_write_params *params)
{
busy = false;
@@ -1020,8 +1023,8 @@
if (active.members_restored < active.members_handled &&
CONFIG_BT_MAX_CONN > 1) {
- struct bt_csis_client_set_member *member;
- int csis_client_err;
+ struct bt_csip_set_coordinator_set_member *member;
+ int csip_err;
member = active.members[active.members_handled - active.members_restored - 1];
cur_inst = lookup_instance_by_set_info(member, active.info);
@@ -1031,31 +1034,34 @@
return;
}
- csis_client_err = csis_client_write_set_lock(cur_inst, false,
- csis_client_write_restore_cb);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_write_set_lock(
+ cur_inst, false,
+ csip_set_coordinator_write_restore_cb);
+ if (csip_err == 0) {
busy = true;
} else {
BT_DBG("Failed to release next member[%u]: %d",
- active.members_handled, csis_client_err);
+ active.members_handled,
+ csip_err);
- release_set_complete(csis_client_err);
+ release_set_complete(csip_err);
}
} else {
release_set_complete(0);
}
}
-static void csis_client_write_lock_cb(struct bt_conn *conn, uint8_t err,
- struct bt_gatt_write_params *params)
+static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn,
+ uint8_t err,
+ struct bt_gatt_write_params *params)
{
busy = false;
if (err != 0) {
BT_DBG("Could not lock (0x%X)", err);
if (active.members_handled > 0 && CONFIG_BT_MAX_CONN > 1) {
- struct bt_csis_client_set_member *member;
- int csis_client_err;
+ struct bt_csip_set_coordinator_set_member *member;
+ int csip_err;
active.members_restored = 0;
@@ -1069,14 +1075,14 @@
lock_set_complete(-ENOENT);
}
- csis_client_err = csis_client_write_set_lock(cur_inst,
- false,
- csis_client_write_restore_cb);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_write_set_lock(
+ cur_inst, false,
+ csip_set_coordinator_write_restore_cb);
+ if (csip_err == 0) {
busy = true;
} else {
BT_WARN("Could not release lock of previous locked member: %d",
- csis_client_err);
+ csip_err);
active_members_reset();
return;
}
@@ -1092,8 +1098,8 @@
active.members_handled, active.members_count);
if (active.members_handled < active.members_count) {
- struct bt_csis *prev_inst = cur_inst;
- int csis_client_err;
+ struct bt_csip *prev_inst = cur_inst;
+ int csip_err;
cur_inst = get_next_active_instance();
if (cur_inst == NULL) {
@@ -1102,24 +1108,25 @@
return;
}
- csis_client_err = csis_client_write_set_lock(cur_inst, true,
- csis_client_write_lock_cb);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_write_set_lock(
+ cur_inst, true,
+ csip_set_coordinator_write_lock_cb);
+ if (csip_err == 0) {
busy = true;
} else {
BT_DBG("Failed to lock next member[%u]: %d",
- active.members_handled, csis_client_err);
+ active.members_handled, csip_err);
active.members_restored = 0;
- csis_client_err = csis_client_write_set_lock(prev_inst,
- false,
- csis_client_write_restore_cb);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_write_set_lock(
+ prev_inst, false,
+ csip_set_coordinator_write_restore_cb);
+ if (csip_err == 0) {
busy = true;
} else {
BT_WARN("Could not release lock of previous locked member: %d",
- csis_client_err);
+ csip_err);
active_members_reset();
return;
}
@@ -1129,8 +1136,8 @@
}
}
-static void csis_client_write_release_cb(struct bt_conn *conn, uint8_t err,
- struct bt_gatt_write_params *params)
+static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t err,
+ struct bt_gatt_write_params *params)
{
busy = false;
@@ -1146,7 +1153,7 @@
active.members_handled, active.members_count);
if (active.members_handled < active.members_count) {
- int csis_client_err;
+ int csip_err;
cur_inst = get_next_active_instance();
if (cur_inst == NULL) {
@@ -1155,25 +1162,26 @@
return;
}
- csis_client_err = csis_client_write_set_lock(cur_inst, false,
- csis_client_write_release_cb);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_write_set_lock(
+ cur_inst, false,
+ csip_set_coordinator_write_release_cb);
+ if (csip_err == 0) {
busy = true;
} else {
BT_DBG("Failed to release next member[%u]: %d",
- active.members_handled, csis_client_err);
+ active.members_handled, csip_err);
- release_set_complete(csis_client_err);
+ release_set_complete(csip_err);
}
} else {
release_set_complete(0);
}
}
-static void csis_client_lock_state_read_cb(int err, bool locked)
+static void csip_set_coordinator_lock_state_read_cb(int err, bool locked)
{
- const struct bt_csis_client_set_info *info = active.info;
- struct bt_csis_client_set_member *cur_member = NULL;
+ const struct bt_csip_set_coordinator_set_info *info = active.info;
+ struct bt_csip_set_coordinator_set_member *cur_member = NULL;
if (err || locked) {
cur_member = active.members[active.members_handled];
@@ -1184,9 +1192,11 @@
ordered_access_complete(info, err, locked, cur_member);
}
-static uint8_t csis_client_read_lock_cb(struct bt_conn *conn, uint8_t err,
- struct bt_gatt_read_params *params,
- const void *data, uint16_t length)
+static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn,
+ uint8_t err,
+ struct bt_gatt_read_params *params,
+ const void *data,
+ uint16_t length)
{
uint8_t value = 0;
@@ -1195,7 +1205,7 @@
if (err != 0) {
BT_DBG("Could not read lock value (0x%X)", err);
- csis_client_lock_state_read_cb(err, false);
+ csip_set_coordinator_lock_state_read_cb(err, false);
return BT_GATT_ITER_STOP;
}
@@ -1207,58 +1217,58 @@
if (data == NULL || length != sizeof(cur_inst->cli.set_lock)) {
BT_DBG("Invalid data %p or length %u", data, length);
- csis_client_lock_state_read_cb(err, false);
+ csip_set_coordinator_lock_state_read_cb(err, false);
return BT_GATT_ITER_STOP;
}
value = ((uint8_t *)data)[0];
- if (value != BT_CSIS_RELEASE_VALUE && value != BT_CSIS_LOCK_VALUE) {
+ if (value != BT_CSIP_RELEASE_VALUE && value != BT_CSIP_LOCK_VALUE) {
BT_DBG("Invalid value %u read", value);
err = BT_ATT_ERR_UNLIKELY;
- csis_client_lock_state_read_cb(err, false);
+ csip_set_coordinator_lock_state_read_cb(err, false);
return BT_GATT_ITER_STOP;
}
cur_inst->cli.set_lock = value;
- if (value != BT_CSIS_RELEASE_VALUE) {
+ if (value != BT_CSIP_RELEASE_VALUE) {
BT_DBG("Set member not unlocked");
- csis_client_lock_state_read_cb(0, true);
+ csip_set_coordinator_lock_state_read_cb(0, true);
return BT_GATT_ITER_STOP;
}
if (active.members_handled < active.members_count) {
- int csis_client_err;
+ int csip_err;
cur_inst = get_next_active_instance();
if (cur_inst == NULL) {
- csis_client_lock_state_read_cb(-ENOENT, false);
+ csip_set_coordinator_lock_state_read_cb(-ENOENT, false);
return BT_GATT_ITER_STOP;
}
- csis_client_err = csis_client_read_set_lock(cur_inst);
- if (csis_client_err == 0) {
+ csip_err = csip_set_coordinator_read_set_lock(cur_inst);
+ if (csip_err == 0) {
busy = true;
} else {
BT_DBG("Failed to read next member[%u]: %d",
- active.members_handled, csis_client_err);
+ active.members_handled, csip_err);
- csis_client_lock_state_read_cb(err, false);
+ csip_set_coordinator_lock_state_read_cb(err, false);
}
} else {
- csis_client_lock_state_read_cb(0, false);
+ csip_set_coordinator_lock_state_read_cb(0, false);
}
return BT_GATT_ITER_STOP;
}
-static int csis_client_read_set_lock(struct bt_csis *inst)
+static int csip_set_coordinator_read_set_lock(struct bt_csip *inst)
{
if (inst->cli.set_lock_handle == 0) {
BT_DBG("Handle not set");
@@ -1266,7 +1276,7 @@
return -EINVAL;
}
- read_params.func = csis_client_read_lock_cb;
+ read_params.func = csip_set_coordinator_read_lock_cb;
read_params.handle_count = 1;
read_params.single.handle = inst->cli.set_lock_handle;
read_params.single.offset = 0;
@@ -1274,10 +1284,10 @@
return bt_gatt_read(inst->cli.conn, &read_params);
}
-static void csis_client_reset(struct bt_csis_client_inst *inst)
+static void csip_set_coordinator_reset(struct bt_csip_set_coordinator_inst *inst)
{
- for (size_t i = 0; i < ARRAY_SIZE(inst->csis_insts); i++) {
- struct bt_csis_client_svc_inst *cli = &inst->csis_insts[i].cli;
+ for (size_t i = 0; i < ARRAY_SIZE(inst->csip_insts); i++) {
+ struct bt_csip_set_coordinator_svc_inst *cli = &inst->csip_insts[i].cli;
cli->idx = 0;
cli->rank = 0;
@@ -1316,10 +1326,10 @@
static void disconnected(struct bt_conn *conn, uint8_t reason)
{
- struct bt_csis_client_inst *inst = &client_insts[bt_conn_index(conn)];
+ struct bt_csip_set_coordinator_inst *inst = &client_insts[bt_conn_index(conn)];
if (inst->conn == conn) {
- csis_client_reset(inst);
+ csip_set_coordinator_reset(inst);
}
}
@@ -1327,24 +1337,24 @@
.disconnected = disconnected,
};
-struct bt_csis_client_csis_inst *bt_csis_client_csis_inst_by_handle(struct bt_conn *conn,
- uint16_t start_handle)
+struct bt_csip_set_coordinator_csis_inst *bt_csip_set_coordinator_csis_inst_by_handle(
+ struct bt_conn *conn, uint16_t start_handle)
{
- const struct bt_csis *csis_inst = lookup_instance_by_handle(conn, start_handle);
+ const struct bt_csip *csip_inst = lookup_instance_by_handle(conn, start_handle);
- if (csis_inst != NULL) {
- struct bt_csis_client_inst *client;
+ if (csip_inst != NULL) {
+ struct bt_csip_set_coordinator_inst *client;
client = &client_insts[bt_conn_index(conn)];
- return &client->set_member.insts[csis_inst->cli.idx];
+ return &client->set_member.insts[csip_inst->cli.idx];
}
return NULL;
}
/*************************** PUBLIC FUNCTIONS ***************************/
-int bt_csis_client_register_cb(struct bt_csis_client_cb *cb)
+int bt_csip_set_coordinator_register_cb(struct bt_csip_set_coordinator_cb *cb)
{
CHECKIF(cb == NULL) {
BT_DBG("cb is NULL");
@@ -1352,15 +1362,15 @@
return -EINVAL;
}
- sys_slist_append(&csis_client_cbs, &cb->_node);
+ sys_slist_append(&csip_set_coordinator_cbs, &cb->_node);
return 0;
}
-int bt_csis_client_discover(struct bt_conn *conn)
+int bt_csip_set_coordinator_discover(struct bt_conn *conn)
{
int err;
- struct bt_csis_client_inst *client;
+ struct bt_csip_set_coordinator_inst *client;
CHECKIF(conn == NULL) {
BT_DBG("NULL conn");
@@ -1387,7 +1397,7 @@
err = bt_gatt_discover(conn, &discover_params);
if (err == 0) {
for (size_t i = 0; i < ARRAY_SIZE(client->set_member.insts); i++) {
- client->set_member.insts[i].csis = &client->csis_insts[i];
+ client->set_member.insts[i].csip = &client->csip_insts[i];
}
busy = true;
client->conn = bt_conn_ref(conn);
@@ -1396,9 +1406,9 @@
return err;
}
-static int verify_members(const struct bt_csis_client_set_member **members,
+static int verify_members(const struct bt_csip_set_coordinator_set_member **members,
uint8_t count,
- const struct bt_csis_client_set_info *set_info)
+ const struct bt_csip_set_coordinator_set_info *set_info)
{
bool zero_rank;
uint8_t ranks[CONFIG_BT_MAX_CONN];
@@ -1411,11 +1421,10 @@
zero_rank = false;
for (int i = 0; i < count; i++) {
- const struct bt_csis_client_set_member *member = members[i];
- struct bt_csis_client_inst *client_inst = CONTAINER_OF(member,
- struct bt_csis_client_inst,
- set_member);
- struct bt_csis *inst;
+ const struct bt_csip_set_coordinator_set_member *member = members[i];
+ struct bt_csip_set_coordinator_inst *client_inst =
+ CONTAINER_OF(member, struct bt_csip_set_coordinator_inst, set_member);
+ struct bt_csip *inst;
struct bt_conn *conn;
CHECKIF(member == NULL) {
@@ -1467,14 +1476,15 @@
return 0;
}
-static 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)
+static int bt_csip_set_coordinator_get_lock_state(
+ const struct bt_csip_set_coordinator_set_member **members,
+ uint8_t count,
+ const struct bt_csip_set_coordinator_set_info *set_info)
{
int err;
if (busy) {
- BT_DBG("csis_client busy");
+ BT_DBG("csip_set_coordinator busy");
return -EBUSY;
}
@@ -1494,7 +1504,7 @@
return -ENOENT;
}
- err = csis_client_read_set_lock(cur_inst);
+ err = csip_set_coordinator_read_set_lock(cur_inst);
if (err == 0) {
busy = true;
} else {
@@ -1504,14 +1514,15 @@
return err;
}
-int bt_csis_client_ordered_access(const struct bt_csis_client_set_member *members[],
- uint8_t count,
- const struct bt_csis_client_set_info *set_info,
- bt_csis_client_ordered_access_t cb)
+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)
{
int err;
- err = bt_csis_client_get_lock_state(members, count, set_info);
+ err = bt_csip_set_coordinator_get_lock_state(members, count, set_info);
if (err != 0) {
return err;
}
@@ -1522,14 +1533,15 @@
return 0;
}
-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)
+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)
{
int err;
CHECKIF(busy) {
- BT_DBG("csis_client busy");
+ BT_DBG("csip_set_coordinator busy");
return -EBUSY;
}
@@ -1549,8 +1561,8 @@
return -ENOENT;
}
- err = csis_client_write_set_lock(cur_inst, true,
- csis_client_write_lock_cb);
+ err = csip_set_coordinator_write_set_lock(cur_inst, true,
+ csip_set_coordinator_write_lock_cb);
if (err == 0) {
busy = true;
}
@@ -1558,14 +1570,14 @@
return err;
}
-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)
+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)
{
int err;
CHECKIF(busy) {
- BT_DBG("csis_client busy");
+ BT_DBG("csip_set_coordinator busy");
return -EBUSY;
}
@@ -1585,8 +1597,8 @@
return -ENOENT;
}
- err = csis_client_write_set_lock(cur_inst, false,
- csis_client_write_release_cb);
+ err = csip_set_coordinator_write_set_lock(cur_inst, false,
+ csip_set_coordinator_write_release_cb);
if (err == 0) {
busy = true;
}
diff --git a/subsys/bluetooth/audio/csis.c b/subsys/bluetooth/audio/csis.c
deleted file mode 100644
index 8ed835f..0000000
--- a/subsys/bluetooth/audio/csis.c
+++ /dev/null
@@ -1,766 +0,0 @@
-/* Bluetooth CSIS - Coordinated Set Identification Service */
-
-/*
- * Copyright (c) 2019 Bose Corporation
- * Copyright (c) 2020-2021 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <zephyr/kernel.h>
-#include <zephyr/types.h>
-
-#include <zephyr/device.h>
-#include <zephyr/init.h>
-#include <stdlib.h>
-
-#include <zephyr/bluetooth/bluetooth.h>
-#include <zephyr/bluetooth/conn.h>
-#include <zephyr/bluetooth/gatt.h>
-#include <zephyr/bluetooth/buf.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/sys/check.h>
-
-#include "audio_internal.h"
-#include "csis_internal.h"
-#include "csis_crypto.h"
-#include "../host/conn_internal.h"
-#include "../host/hci_core.h"
-#include "../host/keys.h"
-
-#define BT_CSIS_SIH_PRAND_SIZE 3
-#define BT_CSIS_SIH_HASH_SIZE 3
-#define CSIS_SET_LOCK_TIMER_VALUE K_SECONDS(60)
-
-#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CSIS)
-#define LOG_MODULE_NAME bt_csis
-#include "common/log.h"
-#include "common/bt_str.h"
-
-static struct bt_csis csis_insts[CONFIG_BT_CSIS_MAX_INSTANCE_COUNT];
-static bt_addr_le_t server_dummy_addr; /* 0'ed address */
-
-struct csis_notify_foreach {
- struct bt_conn *excluded_client;
- struct bt_csis *csis;
-};
-
-static bool is_last_client_to_write(const struct bt_csis *csis,
- const struct bt_conn *conn)
-{
- if (conn != NULL) {
- return bt_addr_le_eq(bt_conn_get_dst(conn),
- &csis->srv.lock_client_addr);
- } else {
- return bt_addr_le_eq(&server_dummy_addr,
- &csis->srv.lock_client_addr);
- }
-}
-
-static void notify_lock_value(const struct bt_csis *csis, struct bt_conn *conn)
-{
- bt_gatt_notify_uuid(conn, BT_UUID_CSIS_SET_LOCK,
- csis->srv.service_p->attrs,
- &csis->srv.set_lock,
- sizeof(csis->srv.set_lock));
-}
-
-static void notify_client(struct bt_conn *conn, void *data)
-{
- struct csis_notify_foreach *csis_data = (struct csis_notify_foreach *)data;
- struct bt_csis *csis = csis_data->csis;
- struct bt_conn *excluded_conn = csis_data->excluded_client;
-
- if (excluded_conn != NULL && conn == excluded_conn) {
- return;
- }
-
- notify_lock_value(csis, conn);
-
- for (int i = 0; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (pend_notify->pending &&
- bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
- pend_notify->pending = false;
- break;
- }
- }
-}
-
-static void notify_clients(struct bt_csis *csis,
- struct bt_conn *excluded_client)
-{
- struct csis_notify_foreach data = {
- .excluded_client = excluded_client,
- .csis = csis,
- };
-
- /* Mark all bonded devices as pending notifications, and clear those
- * that are notified in `notify_client`
- */
- for (int i = 0; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (pend_notify->active) {
- if (excluded_client != NULL &&
- bt_addr_le_eq(bt_conn_get_dst(excluded_client), &pend_notify->addr)) {
- continue;
- }
-
- pend_notify->pending = true;
- }
- }
-
- bt_conn_foreach(BT_CONN_TYPE_LE, notify_client, &data);
-}
-
-static int sirk_encrypt(struct bt_conn *conn,
- const struct bt_csis_set_sirk *sirk,
- struct bt_csis_set_sirk *enc_sirk)
-{
- int err;
- uint8_t *k;
-
- if (IS_ENABLED(CONFIG_BT_CSIS_TEST_SAMPLE_DATA)) {
- /* test_k is from the sample data from A.2 in the CSIS spec */
- static uint8_t test_k[] = {0x67, 0x6e, 0x1b, 0x9b,
- 0xd4, 0x48, 0x69, 0x6f,
- 0x06, 0x1e, 0xc6, 0x22,
- 0x3c, 0xe5, 0xce, 0xd9};
- static bool swapped;
-
- if (!swapped && IS_ENABLED(CONFIG_LITTLE_ENDIAN)) {
- /* Swap test_k to little endian */
- sys_mem_swap(test_k, 16);
- swapped = true;
- }
- BT_DBG("Encrypting test SIRK");
- k = test_k;
- } else {
- k = conn->le.keys->ltk.val;
- }
-
- err = bt_csis_sef(k, sirk->value, enc_sirk->value);
-
- if (err != 0) {
- return err;
- }
-
- enc_sirk->type = BT_CSIS_SIRK_TYPE_ENCRYPTED;
-
- return 0;
-}
-
-static int generate_prand(uint32_t *dest)
-{
- bool valid = false;
-
- do {
- int res;
-
- *dest = 0;
- res = bt_rand(dest, BT_CSIS_SIH_PRAND_SIZE);
- if (res != 0) {
- return res;
- }
-
- /* Validate Prand: Must contain both a 1 and a 0 */
- if (*dest != 0 && *dest != 0x3FFFFF) {
- valid = true;
- }
- } while (!valid);
-
- *dest &= 0x3FFFFF;
- *dest |= BIT(22); /* bit 23 shall be 0, and bit 22 shall be 1 */
-
- return 0;
-}
-
-int bt_csis_generate_rsi(const struct bt_csis *csis, uint8_t rsi[BT_CSIS_RSI_SIZE])
-{
- int res = 0;
- uint32_t prand;
- uint32_t hash;
-
- if (IS_ENABLED(CONFIG_BT_CSIS_TEST_SAMPLE_DATA)) {
- /* prand is from the sample data from A.2 in the CSIS spec */
- prand = 0x69f563;
- } else {
- res = generate_prand(&prand);
-
- if (res != 0) {
- BT_WARN("Could not generate new prand");
- return res;
- }
- }
-
- res = bt_csis_sih(csis->srv.set_sirk.value, prand, &hash);
- if (res != 0) {
- BT_WARN("Could not generate new RSI");
- return res;
- }
-
- (void)memcpy(rsi, &hash, BT_CSIS_SIH_HASH_SIZE);
- (void)memcpy(rsi + BT_CSIS_SIH_HASH_SIZE, &prand, BT_CSIS_SIH_PRAND_SIZE);
-
- return res;
-}
-
-static ssize_t read_set_sirk(struct bt_conn *conn,
- const struct bt_gatt_attr *attr,
- void *buf, uint16_t len, uint16_t offset)
-{
- struct bt_csis_set_sirk enc_sirk;
- struct bt_csis_set_sirk *sirk;
- struct bt_csis *csis = BT_AUDIO_CHRC_USER_DATA(attr);
-
- if (csis->srv.cb != NULL && csis->srv.cb->sirk_read_req != NULL) {
- uint8_t cb_rsp;
-
- /* Ask higher layer for what SIRK to return, if any */
- cb_rsp = csis->srv.cb->sirk_read_req(conn, &csis_insts[0]);
-
- if (cb_rsp == BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT) {
- sirk = &csis->srv.set_sirk;
- } else if (IS_ENABLED(CONFIG_BT_CSIS_ENC_SIRK_SUPPORT) &&
- cb_rsp == BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC) {
- int err;
-
- err = sirk_encrypt(conn, &csis->srv.set_sirk,
- &enc_sirk);
- if (err != 0) {
- BT_ERR("Could not encrypt SIRK: %d",
- err);
- return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
- }
-
- sirk = &enc_sirk;
- LOG_HEXDUMP_DBG(enc_sirk.value, sizeof(enc_sirk.value),
- "Encrypted Set SIRK");
- } else if (cb_rsp == BT_CSIS_READ_SIRK_REQ_RSP_REJECT) {
- return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION);
- } else if (cb_rsp == BT_CSIS_READ_SIRK_REQ_RSP_OOB_ONLY) {
- return BT_GATT_ERR(BT_CSIS_ERROR_SIRK_OOB_ONLY);
- } else {
- BT_ERR("Invalid callback response: %u", cb_rsp);
- return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
- }
- } else {
- sirk = &csis->srv.set_sirk;
- }
-
-
- BT_DBG("Set sirk %sencrypted",
- sirk->type == BT_CSIS_SIRK_TYPE_PLAIN ? "not " : "");
- LOG_HEXDUMP_DBG(csis->srv.set_sirk.value, sizeof(csis->srv.set_sirk.value), "Set SIRK");
- return bt_gatt_attr_read(conn, attr, buf, len, offset,
- sirk, sizeof(*sirk));
-}
-
-static void set_sirk_cfg_changed(const struct bt_gatt_attr *attr,
- uint16_t value)
-{
- BT_DBG("value 0x%04x", value);
-}
-
-static ssize_t read_set_size(struct bt_conn *conn,
- const struct bt_gatt_attr *attr,
- void *buf, uint16_t len, uint16_t offset)
-{
- struct bt_csis *csis = BT_AUDIO_CHRC_USER_DATA(attr);
-
- BT_DBG("%u", csis->srv.set_size);
-
- return bt_gatt_attr_read(conn, attr, buf, len, offset,
- &csis->srv.set_size,
- sizeof(csis->srv.set_size));
-}
-
-static void set_size_cfg_changed(const struct bt_gatt_attr *attr,
- uint16_t value)
-{
- BT_DBG("value 0x%04x", value);
-}
-
-static ssize_t read_set_lock(struct bt_conn *conn,
- const struct bt_gatt_attr *attr,
- void *buf, uint16_t len, uint16_t offset)
-{
- struct bt_csis *csis = BT_AUDIO_CHRC_USER_DATA(attr);
-
- BT_DBG("%u", csis->srv.set_lock);
-
- return bt_gatt_attr_read(conn, attr, buf, len, offset,
- &csis->srv.set_lock,
- sizeof(csis->srv.set_lock));
-}
-
-/**
- * @brief Set the lock value of a CSIS instance.
- *
- * @param conn The connection locking the instance.
- * Will be NULL if the server locally sets the lock.
- * @param csis The CSIS instance to change the lock value of
- * @param val The lock value (BT_CSIS_LOCK_VALUE or BT_CSIS_RELEASE_VALUE)
- *
- * @return BT_CSIS_ERROR_* on failure or 0 if success
- */
-static uint8_t set_lock(struct bt_conn *conn, struct bt_csis *csis, uint8_t val)
-{
- bool notify;
-
- if (val != BT_CSIS_RELEASE_VALUE && val != BT_CSIS_LOCK_VALUE) {
- return BT_CSIS_ERROR_LOCK_INVAL_VALUE;
- }
-
- if (csis->srv.set_lock == BT_CSIS_LOCK_VALUE) {
- if (val == BT_CSIS_LOCK_VALUE) {
- if (is_last_client_to_write(csis, conn)) {
- return BT_CSIS_ERROR_LOCK_ALREADY_GRANTED;
- } else {
- return BT_CSIS_ERROR_LOCK_DENIED;
- }
- } else if (!is_last_client_to_write(csis, conn)) {
- return BT_CSIS_ERROR_LOCK_RELEASE_DENIED;
- }
- }
-
- notify = csis->srv.set_lock != val;
-
- csis->srv.set_lock = val;
- if (csis->srv.set_lock == BT_CSIS_LOCK_VALUE) {
- if (conn != NULL) {
- bt_addr_le_copy(&csis->srv.lock_client_addr,
- bt_conn_get_dst(conn));
- }
- (void)k_work_reschedule(&csis->srv.set_lock_timer,
- CSIS_SET_LOCK_TIMER_VALUE);
- } else {
- (void)memset(&csis->srv.lock_client_addr, 0,
- sizeof(csis->srv.lock_client_addr));
- (void)k_work_cancel_delayable(&csis->srv.set_lock_timer);
- }
-
- BT_DBG("%u", csis->srv.set_lock);
-
- if (notify) {
- /*
- * The Spec states that all clients, except for the
- * client writing the value, shall be notified
- * (if subscribed)
- */
- notify_clients(csis, conn);
-
- if (csis->srv.cb != NULL && csis->srv.cb->lock_changed != NULL) {
- bool locked = csis->srv.set_lock == BT_CSIS_LOCK_VALUE;
-
- csis->srv.cb->lock_changed(conn, csis, locked);
- }
- }
-
- return 0;
-}
-
-static ssize_t write_set_lock(struct bt_conn *conn,
- const struct bt_gatt_attr *attr,
- const void *buf, uint16_t len,
- uint16_t offset, uint8_t flags)
-{
- ssize_t res;
- uint8_t val;
- struct bt_csis *csis = BT_AUDIO_CHRC_USER_DATA(attr);
-
- if (offset != 0) {
- return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
- } else if (len != sizeof(val)) {
- return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
- }
-
- (void)memcpy(&val, buf, len);
-
- res = set_lock(conn, csis, val);
- if (res != BT_ATT_ERR_SUCCESS) {
- return BT_GATT_ERR(res);
- }
-
- return len;
-}
-
-static void set_lock_cfg_changed(const struct bt_gatt_attr *attr,
- uint16_t value)
-{
- BT_DBG("value 0x%04x", value);
-}
-
-static ssize_t read_rank(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- void *buf, uint16_t len, uint16_t offset)
-{
- struct bt_csis *csis = BT_AUDIO_CHRC_USER_DATA(attr);
-
- BT_DBG("%u", csis->srv.rank);
-
- return bt_gatt_attr_read(conn, attr, buf, len, offset,
- &csis->srv.rank,
- sizeof(csis->srv.rank));
-
-}
-
-static void set_lock_timer_handler(struct k_work *work)
-{
- struct k_work_delayable *delayable;
- struct bt_csis_server *server;
- struct bt_csis *csis;
-
- delayable = CONTAINER_OF(work, struct k_work_delayable, work);
- server = CONTAINER_OF(delayable, struct bt_csis_server, set_lock_timer);
- csis = CONTAINER_OF(server, struct bt_csis, srv);
-
- BT_DBG("Lock timeout, releasing");
- csis->srv.set_lock = BT_CSIS_RELEASE_VALUE;
- notify_clients(csis, NULL);
-
- if (csis->srv.cb != NULL && csis->srv.cb->lock_changed != NULL) {
- bool locked = csis->srv.set_lock == BT_CSIS_LOCK_VALUE;
-
- csis->srv.cb->lock_changed(NULL, csis, locked);
- }
-}
-
-static void csis_security_changed(struct bt_conn *conn, bt_security_t level,
- enum bt_security_err err)
-{
- if (err != 0 || conn->encrypt == 0) {
- return;
- }
-
- if (!bt_addr_le_is_bonded(conn->id, &conn->le.dst)) {
- return;
- }
-
- for (int i = 0; i < ARRAY_SIZE(csis_insts); i++) {
- struct bt_csis *csis = &csis_insts[i];
-
- for (int j = 0; j < ARRAY_SIZE(csis->srv.pend_notify); j++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[j];
-
- if (pend_notify->pending &&
- bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
- notify_lock_value(csis, conn);
- pend_notify->pending = false;
- break;
- }
- }
- }
-}
-
-static void handle_csis_disconnect(struct bt_csis *csis, struct bt_conn *conn)
-{
- BT_DBG("Non-bonded device");
- if (is_last_client_to_write(csis, conn)) {
- (void)memset(&csis->srv.lock_client_addr, 0,
- sizeof(csis->srv.lock_client_addr));
- csis->srv.set_lock = BT_CSIS_RELEASE_VALUE;
- notify_clients(csis, NULL);
-
- if (csis->srv.cb != NULL && csis->srv.cb->lock_changed != NULL) {
- bool locked = csis->srv.set_lock == BT_CSIS_LOCK_VALUE;
-
- csis->srv.cb->lock_changed(conn, csis, locked);
- }
- }
-
- /* Check if the disconnected device once was bonded and stored
- * here as a bonded device
- */
- for (int i = 0; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
- (void)memset(pend_notify, 0, sizeof(*pend_notify));
- break;
- }
- }
-}
-
-static void csis_disconnected(struct bt_conn *conn, uint8_t reason)
-{
- BT_DBG("Disconnected: %s (reason %u)",
- bt_addr_le_str(bt_conn_get_dst(conn)), reason);
-
- for (int i = 0; i < ARRAY_SIZE(csis_insts); i++) {
- handle_csis_disconnect(&csis_insts[i], conn);
- }
-}
-
-static void handle_csis_auth_complete(struct bt_csis *csis,
- struct bt_conn *conn)
-{
- /* Check if already in list, and do nothing if it is */
- for (int i = 0; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (pend_notify->active &&
- bt_addr_le_eq(bt_conn_get_dst(conn), &pend_notify->addr)) {
-#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
- pend_notify->age = csis->srv.age_counter++;
-#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
- return;
- }
- }
-
- /* Copy addr to list over devices to save notifications for */
- for (int i = 0; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (!pend_notify->active) {
- bt_addr_le_copy(&pend_notify->addr,
- bt_conn_get_dst(conn));
- pend_notify->active = true;
-#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
- pend_notify->age = csis->srv.age_counter++;
-#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
- return;
- }
- }
-
-#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
- struct csis_pending_notifications *oldest;
-
- oldest = &csis->srv.pend_notify[0];
-
- for (int i = 1; i < ARRAY_SIZE(csis->srv.pend_notify); i++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[i];
-
- if (pend_notify->age < oldest->age) {
- oldest = pend_notify;
- }
- }
- (void)memset(oldest, 0, sizeof(*oldest));
- bt_addr_le_copy(&oldest->addr, &conn->le.dst);
- oldest->active = true;
- oldest->age = csis->srv.age_counter++;
-#else
- BT_WARN("Could not add device to pending notification list");
-#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
-
-}
-
-static void auth_pairing_complete(struct bt_conn *conn, bool bonded)
-{
- /**
- * If a pairing is complete for a bonded device, then we
- * 1) Store the connection pointer to later validate SIRK encryption
- * 2) Check if the device is already in the `pend_notify`, and if it is
- * not, then we
- * 3) Check if there's room for another device in the `pend_notify`
- * array. If there are no more room for a new device, then
- * 4) Either we ignore this new device (bad luck), or we overwrite
- * the oldest entry, following the behavior of the key storage.
- */
-
- BT_DBG("%s paired (%sbonded)",
- bt_addr_le_str(bt_conn_get_dst(conn)), bonded ? "" : "not ");
-
- if (!bonded) {
- return;
- }
-
- for (int i = 0; i < ARRAY_SIZE(csis_insts); i++) {
- handle_csis_auth_complete(&csis_insts[i], conn);
- }
-}
-
-static void csis_bond_deleted(uint8_t id, const bt_addr_le_t *peer)
-{
- for (int i = 0; i < ARRAY_SIZE(csis_insts); i++) {
- struct bt_csis *csis = &csis_insts[i];
-
- for (int j = 0; j < ARRAY_SIZE(csis->srv.pend_notify); j++) {
- struct csis_pending_notifications *pend_notify;
-
- pend_notify = &csis->srv.pend_notify[j];
-
- if (pend_notify->active &&
- bt_addr_le_eq(peer, &pend_notify->addr)) {
- (void)memset(pend_notify, 0,
- sizeof(*pend_notify));
- break;
- }
- }
- }
-}
-
-static struct bt_conn_cb conn_callbacks = {
- .disconnected = csis_disconnected,
- .security_changed = csis_security_changed,
-};
-
-static struct bt_conn_auth_info_cb auth_callbacks = {
- .pairing_complete = auth_pairing_complete,
- .bond_deleted = csis_bond_deleted
-};
-
-#define BT_CSIS_SERVICE_DEFINITION(_csis) {\
- BT_GATT_PRIMARY_SERVICE(BT_UUID_CSIS), \
- BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIRK, \
- BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
- BT_GATT_PERM_READ_ENCRYPT, \
- read_set_sirk, NULL, &_csis), \
- BT_AUDIO_CCC(set_sirk_cfg_changed), \
- BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIZE, \
- BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
- BT_GATT_PERM_READ_ENCRYPT, \
- read_set_size, NULL, &_csis), \
- BT_AUDIO_CCC(set_size_cfg_changed), \
- BT_AUDIO_CHRC(BT_UUID_CSIS_SET_LOCK, \
- BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY | BT_GATT_CHRC_WRITE, \
- BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, \
- read_set_lock, write_set_lock, &_csis), \
- BT_AUDIO_CCC(set_lock_cfg_changed), \
- BT_AUDIO_CHRC(BT_UUID_CSIS_RANK, \
- BT_GATT_CHRC_READ, \
- BT_GATT_PERM_READ_ENCRYPT, \
- read_rank, NULL, &_csis) \
- }
-
-BT_GATT_SERVICE_INSTANCE_DEFINE(csis_service_list, csis_insts,
- CONFIG_BT_CSIS_MAX_INSTANCE_COUNT,
- BT_CSIS_SERVICE_DEFINITION);
-
-/****************************** Public API ******************************/
-void *bt_csis_svc_decl_get(const struct bt_csis *csis)
-{
- return csis->srv.service_p->attrs;
-}
-
-static bool valid_register_param(const struct bt_csis_register_param *param)
-{
- if (param->lockable && param->rank == 0) {
- BT_DBG("Rank cannot be 0 if service is lockable");
- return false;
- }
-
- if (param->rank > 0 && param->rank > param->set_size) {
- BT_DBG("Invalid rank: %u (shall be less than set_size: %u)",
- param->set_size, param->set_size);
- return false;
- }
-
-#if CONFIG_BT_CSIS_MAX_INSTANCE_COUNT > 1
- if (param->parent == NULL) {
- BT_DBG("Parent service not provided");
- return false;
- }
-#endif /* CONFIG_BT_CSIS_MAX_INSTANCE_COUNT > 1 */
-
- return true;
-}
-
-int bt_csis_register(const struct bt_csis_register_param *param,
- struct bt_csis **csis)
-{
- static uint8_t instance_cnt;
- struct bt_csis *inst;
- int err;
-
- if (instance_cnt == ARRAY_SIZE(csis_insts)) {
- return -ENOMEM;
- }
-
- CHECKIF(param == NULL) {
- BT_DBG("NULL param");
- return -EINVAL;
- }
-
- CHECKIF(!valid_register_param(param)) {
- BT_DBG("Invalid parameters");
- return -EINVAL;
- }
-
- inst = &csis_insts[instance_cnt];
- inst->srv.service_p = &csis_service_list[instance_cnt];
- instance_cnt++;
-
- bt_conn_cb_register(&conn_callbacks);
- bt_conn_auth_info_cb_register(&auth_callbacks);
-
- err = bt_gatt_service_register(inst->srv.service_p);
- if (err != 0) {
- BT_DBG("CSIS service register failed: %d", err);
- return err;
- }
-
- k_work_init_delayable(&inst->srv.set_lock_timer,
- set_lock_timer_handler);
- inst->srv.rank = param->rank;
- inst->srv.set_size = param->set_size;
- inst->srv.set_lock = BT_CSIS_RELEASE_VALUE;
- inst->srv.set_sirk.type = BT_CSIS_SIRK_TYPE_PLAIN;
- inst->srv.cb = param->cb;
-
- if (IS_ENABLED(CONFIG_BT_CSIS_TEST_SAMPLE_DATA)) {
- uint8_t test_sirk[] = {
- 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
- 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45,
- };
-
- (void)memcpy(inst->srv.set_sirk.value, test_sirk,
- sizeof(test_sirk));
- BT_DBG("CSIS SIRK was overwritten by sample data SIRK");
- } else {
- (void)memcpy(inst->srv.set_sirk.value, param->set_sirk,
- sizeof(inst->srv.set_sirk.value));
- }
-
- *csis = inst;
- return 0;
-}
-
-int bt_csis_lock(struct bt_csis *csis, bool lock, bool force)
-{
- uint8_t lock_val;
- int err = 0;
-
- if (lock) {
- lock_val = BT_CSIS_LOCK_VALUE;
- } else {
- lock_val = BT_CSIS_RELEASE_VALUE;
- }
-
- if (!lock && force) {
- csis->srv.set_lock = BT_CSIS_RELEASE_VALUE;
- notify_clients(csis, NULL);
-
- if (csis->srv.cb != NULL && csis->srv.cb->lock_changed != NULL) {
- csis->srv.cb->lock_changed(NULL, &csis_insts[0], false);
- }
- } else {
- err = set_lock(NULL, csis, lock_val);
- }
-
- if (err < 0) {
- return BT_GATT_ERR(err);
- } else {
- return 0;
- }
-}
-
-void bt_csis_print_sirk(const struct bt_csis *csis)
-{
- LOG_HEXDUMP_DBG(&csis->srv.set_sirk, sizeof(csis->srv.set_sirk), "Set SIRK");
-}
diff --git a/subsys/bluetooth/audio/csis_internal.h b/subsys/bluetooth/audio/csis_internal.h
deleted file mode 100644
index 7cd3090..0000000
--- a/subsys/bluetooth/audio/csis_internal.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * @file
- * @brief Internal APIs for Bluetooth CSIS
- *
- * Copyright (c) 2021 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <zephyr/bluetooth/audio/csis.h>
-
-
-#define BT_CSIS_SIRK_TYPE_ENCRYPTED 0x00
-#define BT_CSIS_SIRK_TYPE_PLAIN 0x01
-
-#define BT_CSIS_RELEASE_VALUE 0x01
-#define BT_CSIS_LOCK_VALUE 0x02
-
-struct csis_pending_notifications {
- bt_addr_le_t addr;
- bool pending;
- bool active;
-
-/* Since there's a 1-to-1 connection between bonded devices, and devices in
- * the array containing this struct, if the security manager overwrites
- * the oldest keys, we also overwrite the oldest entry
- */
-#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
- uint32_t age;
-#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
-};
-
-struct bt_csis_set_sirk {
- uint8_t type;
- uint8_t value[BT_CSIS_SET_SIRK_SIZE];
-} __packed;
-
-struct bt_csis_client_svc_inst {
- uint8_t rank;
- uint8_t set_lock;
-
- uint16_t start_handle;
- uint16_t end_handle;
- uint16_t set_sirk_handle;
- uint16_t set_size_handle;
- uint16_t set_lock_handle;
- uint16_t rank_handle;
-
- uint8_t idx;
- struct bt_gatt_subscribe_params sirk_sub_params;
- struct bt_gatt_discover_params sirk_sub_disc_params;
- struct bt_gatt_subscribe_params size_sub_params;
- struct bt_gatt_discover_params size_sub_disc_params;
- struct bt_gatt_subscribe_params lock_sub_params;
- struct bt_gatt_discover_params lock_sub_disc_params;
-
- struct bt_conn *conn;
- struct bt_csis_client_set_member *member;
-};
-
-/* TODO: Rename to bt_csis_svc_inst */
-struct bt_csis_server {
- struct bt_csis_set_sirk set_sirk;
- uint8_t set_size;
- uint8_t set_lock;
- uint8_t rank;
- struct bt_csis_cb *cb;
- struct k_work_delayable set_lock_timer;
- bt_addr_le_t lock_client_addr;
- struct bt_gatt_service *service_p;
- struct csis_pending_notifications pend_notify[CONFIG_BT_MAX_PAIRED];
-#if IS_ENABLED(CONFIG_BT_KEYS_OVERWRITE_OLDEST)
- uint32_t age_counter;
-#endif /* CONFIG_BT_KEYS_OVERWRITE_OLDEST */
-};
-
-struct bt_csis {
- bool client_instance;
- union {
-#if defined(CONFIG_BT_CSIS)
- struct bt_csis_server srv;
-#endif /* CONFIG_BT_CSIS */
-#if defined(CONFIG_BT_CSIS_CLIENT)
- struct bt_csis_client_svc_inst cli;
-#endif /* CONFIG_BT_CSIS_CLIENT */
- };
-};
-
-struct bt_csis_client_csis_inst *bt_csis_client_csis_inst_by_handle(struct bt_conn *conn,
- uint16_t start_handle);
diff --git a/subsys/bluetooth/shell/CMakeLists.txt b/subsys/bluetooth/shell/CMakeLists.txt
index b8d1bb2..4bd1f40 100644
--- a/subsys/bluetooth/shell/CMakeLists.txt
+++ b/subsys/bluetooth/shell/CMakeLists.txt
@@ -42,12 +42,12 @@
micp_mic_ctlr.c
)
zephyr_library_sources_ifdef(
- CONFIG_BT_CSIS
- csis.c
+ CONFIG_BT_CSIP
+ csip.c
)
zephyr_library_sources_ifdef(
- CONFIG_BT_CSIS_CLIENT
- csis_client.c
+ CONFIG_BT_CSIP_SET_COORDINATOR
+ csip_set_coordinator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_TBS
diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c
index 6c85324..e37aa89 100644
--- a/subsys/bluetooth/shell/bt.c
+++ b/subsys/bluetooth/shell/bt.c
@@ -33,7 +33,7 @@
#include <zephyr/bluetooth/iso.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/pacs.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include <zephyr/shell/shell.h>
@@ -1245,7 +1245,7 @@
/* A privacy-enabled Set Member should advertise RSI values only when in
* the GAP Limited Discoverable mode.
*/
- if (IS_ENABLED(CONFIG_BT_PRIVACY) && IS_ENABLED(CONFIG_BT_CSIS) && csis != NULL) {
+ if (IS_ENABLED(CONFIG_BT_PRIVACY) && IS_ENABLED(CONFIG_BT_CSIP) && csip != NULL) {
ad_flags |= BT_LE_AD_LIMITED;
} else {
ad_flags |= BT_LE_AD_GENERAL;
@@ -1272,7 +1272,7 @@
ad_len++;
}
- if (IS_ENABLED(CONFIG_BT_CSIS)) {
+ if (IS_ENABLED(CONFIG_BT_CSIP)) {
ssize_t csis_ad_len;
csis_ad_len = csis_ad_data_add(&data_array[ad_len],
diff --git a/subsys/bluetooth/shell/bt.h b/subsys/bluetooth/shell/bt.h
index bcda373..e1d722c 100644
--- a/subsys/bluetooth/shell/bt.h
+++ b/subsys/bluetooth/shell/bt.h
@@ -18,7 +18,7 @@
extern const struct shell *ctx_shell;
extern struct bt_conn *default_conn;
-extern struct bt_csis *csis;
+extern struct bt_csip *csip;
#if defined(CONFIG_BT_ISO)
extern struct bt_iso_chan iso_chan;
diff --git a/subsys/bluetooth/shell/cap_acceptor.c b/subsys/bluetooth/shell/cap_acceptor.c
index 757226b..4e69e24 100644
--- a/subsys/bluetooth/shell/cap_acceptor.c
+++ b/subsys/bluetooth/shell/cap_acceptor.c
@@ -16,10 +16,10 @@
#include "bt.h"
extern const struct shell *ctx_shell;
-static struct bt_csis *cap_csis;
-static uint8_t sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
+static struct bt_csip *cap_csip;
+static uint8_t sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
-static void locked_cb(struct bt_conn *conn, struct bt_csis *csis, bool locked)
+static void locked_cb(struct bt_conn *conn, struct bt_csip *csip, bool locked)
{
if (conn == NULL) {
shell_error(ctx_shell, "Server %s the device",
@@ -34,7 +34,7 @@
}
}
-static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csis *csis)
+static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csip *csip)
{
char addr[BT_ADDR_LE_STR_LEN];
static const char *const rsp_strings[] = {
@@ -49,7 +49,7 @@
return sirk_read_rsp;
}
-static struct bt_csis_cb csis_cbs = {
+static struct bt_csip_cb csip_cbs = {
.lock_changed = locked_cb,
.sirk_read_req = sirk_read_req_cb,
};
@@ -58,14 +58,14 @@
char **argv)
{
int err;
- struct bt_csis_register_param param = {
+ struct bt_csip_register_param param = {
.set_size = 2,
.rank = 1,
.lockable = true,
/* Using the CSIS test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
- .cb = &csis_cbs
+ .cb = &csip_cbs
};
for (size_t argn = 1; argn < argc; argn++) {
@@ -95,7 +95,7 @@
}
}
- err = bt_cap_acceptor_register(¶m, &cap_csis);
+ err = bt_cap_acceptor_register(¶m, &cap_csip);
if (err != 0) {
shell_error(sh, "Could not register CAS: %d", err);
@@ -108,7 +108,7 @@
static int cmd_cap_acceptor_print_sirk(const struct shell *sh, size_t argc,
char *argv[])
{
- bt_csis_print_sirk(cap_csis);
+ bt_csip_print_sirk(cap_csip);
return 0;
}
@@ -118,7 +118,7 @@
{
int err;
- err = bt_csis_lock(cap_csis, true, false);
+ err = bt_csip_lock(cap_csip, true, false);
if (err != 0) {
shell_error(sh, "Failed to set lock: %d", err);
@@ -146,7 +146,7 @@
}
}
- err = bt_csis_lock(cap_csis, false, force);
+ err = bt_csip_lock(cap_csip, false, force);
if (err != 0) {
shell_error(sh, "Failed to release lock: %d", err);
@@ -163,13 +163,13 @@
char *argv[])
{
if (strcmp(argv[1], "accept") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
} else if (strcmp(argv[1], "accept_enc") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC;
} else if (strcmp(argv[1], "reject") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_REJECT;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_REJECT;
} else if (strcmp(argv[1], "oob") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_OOB_ONLY;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY;
} else {
shell_error(sh, "Unknown parameter: %s", argv[1]);
return -ENOEXEC;
diff --git a/subsys/bluetooth/shell/cap_initiator.c b/subsys/bluetooth/shell/cap_initiator.c
index 5e5c05d..b0eb2ee 100644
--- a/subsys/bluetooth/shell/cap_initiator.c
+++ b/subsys/bluetooth/shell/cap_initiator.c
@@ -20,7 +20,7 @@
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
static void cap_discover_cb(struct bt_conn *conn, int err,
- const struct bt_csis_client_csis_inst *csis_inst)
+ const struct bt_csip_set_coordinator_csis_inst *csis_inst)
{
if (err != 0) {
shell_error(ctx_shell, "discover failed (%d)", err);
diff --git a/subsys/bluetooth/shell/csis.c b/subsys/bluetooth/shell/csip.c
similarity index 73%
rename from subsys/bluetooth/shell/csis.c
rename to subsys/bluetooth/shell/csip.c
index 0eb0593..364be39 100644
--- a/subsys/bluetooth/shell/csis.c
+++ b/subsys/bluetooth/shell/csip.c
@@ -1,6 +1,6 @@
/**
* @file
- * @brief Shell APIs for Bluetooth CSIS
+ * @brief Shell APIs for Bluetooth CSIP
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2021 Nordic Semiconductor ASA
@@ -16,14 +16,14 @@
#include <stdlib.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include "bt.h"
extern const struct shell *ctx_shell;
-struct bt_csis *csis;
-static uint8_t sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
+struct bt_csip *csip;
+static uint8_t sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
-static void locked_cb(struct bt_conn *conn, struct bt_csis *csis, bool locked)
+static void locked_cb(struct bt_conn *conn, struct bt_csip *csip, bool locked)
{
if (conn == NULL) {
shell_error(ctx_shell, "Server %s the device",
@@ -38,7 +38,7 @@
}
}
-static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csis *csis)
+static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csip *csip)
{
char addr[BT_ADDR_LE_STR_LEN];
static const char *const rsp_strings[] = {
@@ -53,22 +53,22 @@
return sirk_read_rsp;
}
-static struct bt_csis_cb csis_cbs = {
+static struct bt_csip_cb csip_cbs = {
.lock_changed = locked_cb,
.sirk_read_req = sirk_read_req_cb,
};
-static int cmd_csis_register(const struct shell *sh, size_t argc, char **argv)
+static int cmd_csip_register(const struct shell *sh, size_t argc, char **argv)
{
int err;
- struct bt_csis_register_param param = {
+ struct bt_csip_register_param param = {
.set_size = 2,
.rank = 1,
.lockable = true,
/* Using the CSIS test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
- .cb = &csis_cbs
+ .cb = &csip_cbs
};
for (size_t argn = 1; argn < argc; argn++) {
@@ -96,27 +96,27 @@
}
}
- err = bt_csis_register(¶m, &csis);
+ err = bt_csip_register(¶m, &csip);
if (err != 0) {
- shell_error(sh, "Could not register CSIS: %d", err);
+ shell_error(sh, "Could not register CSIP: %d", err);
return err;
}
return 0;
}
-static int cmd_csis_print_sirk(const struct shell *sh, size_t argc,
+static int cmd_csip_print_sirk(const struct shell *sh, size_t argc,
char *argv[])
{
- bt_csis_print_sirk(csis);
+ bt_csip_print_sirk(csip);
return 0;
}
-static int cmd_csis_lock(const struct shell *sh, size_t argc, char *argv[])
+static int cmd_csip_lock(const struct shell *sh, size_t argc, char *argv[])
{
int err;
- err = bt_csis_lock(csis, true, false);
+ err = bt_csip_lock(csip, true, false);
if (err != 0) {
shell_error(sh, "Failed to set lock: %d", err);
return -ENOEXEC;
@@ -127,7 +127,7 @@
return 0;
}
-static int cmd_csis_release(const struct shell *sh, size_t argc,
+static int cmd_csip_release(const struct shell *sh, size_t argc,
char *argv[])
{
bool force = false;
@@ -142,7 +142,7 @@
}
}
- err = bt_csis_lock(csis, false, force);
+ err = bt_csip_lock(csip, false, force);
if (err != 0) {
shell_error(sh, "Failed to release lock: %d", err);
@@ -154,17 +154,17 @@
return 0;
}
-static int cmd_csis_set_sirk_rsp(const struct shell *sh, size_t argc,
+static int cmd_csip_set_sirk_rsp(const struct shell *sh, size_t argc,
char *argv[])
{
if (strcmp(argv[1], "accept") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
} else if (strcmp(argv[1], "accept_enc") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC;
} else if (strcmp(argv[1], "reject") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_REJECT;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_REJECT;
} else if (strcmp(argv[1], "oob") == 0) {
- sirk_read_rsp = BT_CSIS_READ_SIRK_REQ_RSP_OOB_ONLY;
+ sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY;
} else {
shell_error(sh, "Unknown parameter: %s", argv[1]);
return -ENOEXEC;
@@ -173,36 +173,36 @@
return 0;
}
-static int cmd_csis(const struct shell *sh, size_t argc, char **argv)
+static int cmd_csip(const struct shell *sh, size_t argc, char **argv)
{
shell_error(sh, "%s unknown parameter: %s", argv[0], argv[1]);
return -ENOEXEC;
}
-SHELL_STATIC_SUBCMD_SET_CREATE(csis_cmds,
+SHELL_STATIC_SUBCMD_SET_CREATE(csip_cmds,
SHELL_CMD_ARG(register, NULL,
"Initialize the service and register callbacks "
"[size <int>] [rank <int>] [not-lockable] [sirk <data>]",
- cmd_csis_register, 1, 4),
+ cmd_csip_register, 1, 4),
SHELL_CMD_ARG(lock, NULL,
"Lock the set",
- cmd_csis_lock, 1, 0),
+ cmd_csip_lock, 1, 0),
SHELL_CMD_ARG(release, NULL,
"Release the set [force]",
- cmd_csis_release, 1, 1),
+ cmd_csip_release, 1, 1),
SHELL_CMD_ARG(print_sirk, NULL,
"Print the currently used SIRK",
- cmd_csis_print_sirk, 1, 0),
+ cmd_csip_print_sirk, 1, 0),
SHELL_CMD_ARG(set_sirk_rsp, NULL,
"Set the response used in SIRK requests "
"<accept, accept_enc, reject, oob>",
- cmd_csis_set_sirk_rsp, 2, 0),
+ cmd_csip_set_sirk_rsp, 2, 0),
SHELL_SUBCMD_SET_END
);
-SHELL_CMD_ARG_REGISTER(csis, &csis_cmds, "Bluetooth CSIS shell commands",
- cmd_csis, 1, 1);
+SHELL_CMD_ARG_REGISTER(csip, &csip_cmds, "Bluetooth CSIP shell commands",
+ cmd_csip, 1, 1);
ssize_t csis_ad_data_add(struct bt_data *data_array, const size_t data_array_size,
const bool discoverable)
@@ -210,19 +210,19 @@
size_t ad_len = 0;
/* Advertise RSI in discoverable mode only */
- if (csis != NULL && discoverable) {
- static uint8_t ad_rsi[BT_CSIS_RSI_SIZE];
+ if (csip != NULL && discoverable) {
+ static uint8_t ad_rsi[BT_CSIP_RSI_SIZE];
int err;
/* A privacy-enabled Set Member should only advertise RSI values derived
* from a SIRK that is exposed in encrypted form.
*/
if (IS_ENABLED(CONFIG_BT_PRIVACY) &&
- !IS_ENABLED(CONFIG_BT_CSIS_ENC_SIRK_SUPPORT)) {
+ !IS_ENABLED(CONFIG_BT_CSIP_ENC_SIRK_SUPPORT)) {
shell_warn(ctx_shell, "RSI derived from unencrypted SIRK");
}
- err = bt_csis_generate_rsi(csis, ad_rsi);
+ err = bt_csip_generate_rsi(csip, ad_rsi);
if (err != 0) {
shell_error(ctx_shell, "Failed to generate RSI (err %d)", err);
return err;
diff --git a/subsys/bluetooth/shell/csis_client.c b/subsys/bluetooth/shell/csip_set_coordinator.c
similarity index 66%
rename from subsys/bluetooth/shell/csis_client.c
rename to subsys/bluetooth/shell/csip_set_coordinator.c
index 4e8f2f9..654d674 100644
--- a/subsys/bluetooth/shell/csis_client.c
+++ b/subsys/bluetooth/shell/csip_set_coordinator.c
@@ -1,9 +1,9 @@
/**
* @file
- * @brief Shell APIs for Bluetooth CSIS client
+ * @brief Shell APIs for Bluetooth CSIP set coordinator
*
* Copyright (c) 2020 Bose Corporation
- * Copyright (c) 2021 Nordic Semiconductor ASA
+ * Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -20,15 +20,15 @@
#include "bt.h"
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
static uint8_t members_found;
static struct k_work_delayable discover_members_timer;
static struct bt_conn *conns[CONFIG_BT_MAX_CONN];
-static const struct bt_csis_client_set_member *set_members[CONFIG_BT_MAX_CONN];
-struct bt_csis_client_csis_inst *cur_inst;
+static const struct bt_csip_set_coordinator_set_member *set_members[CONFIG_BT_MAX_CONN];
+struct bt_csip_set_coordinator_csis_inst *cur_inst;
static bt_addr_le_t addr_found[CONFIG_BT_MAX_CONN];
-static const struct bt_csis_client_set_member *locked_members[CONFIG_BT_MAX_CONN];
+static const struct bt_csip_set_coordinator_set_member *locked_members[CONFIG_BT_MAX_CONN];
static bool is_discovered(const bt_addr_le_t *addr)
{
@@ -76,8 +76,8 @@
.disconnected = disconnected_cb
};
-static void csis_discover_cb(struct bt_conn *conn,
- const struct bt_csis_client_set_member *member,
+static void csip_discover_cb(struct bt_conn *conn,
+ const struct bt_csip_set_coordinator_set_member *member,
int err, size_t set_count)
{
uint8_t conn_index;
@@ -104,7 +104,7 @@
set_members[conn_index] = member;
}
-static void csis_client_lock_set_cb(int err)
+static void csip_set_coordinator_lock_set_cb(int err)
{
if (err != 0) {
shell_error(ctx_shell, "Lock sets failed (%d)", err);
@@ -114,7 +114,7 @@
shell_print(ctx_shell, "Set locked");
}
-static void csis_client_release_set_cb(int err)
+static void csip_set_coordinator_release_set_cb(int err)
{
if (err != 0) {
shell_error(ctx_shell, "Lock sets failed (%d)", err);
@@ -124,9 +124,9 @@
shell_print(ctx_shell, "Set released");
}
-static void csis_client_ordered_access_cb(const struct bt_csis_client_set_info *set_info,
- int err, bool locked,
- struct bt_csis_client_set_member *member)
+static void csip_set_coordinator_ordered_access_cb(
+ const struct bt_csip_set_coordinator_set_info *set_info, int err,
+ bool locked, struct bt_csip_set_coordinator_set_member *member)
{
if (err) {
printk("Ordered access failed with err %d\n", err);
@@ -138,16 +138,16 @@
}
}
-static struct bt_csis_client_cb cbs = {
- .lock_set = csis_client_lock_set_cb,
- .release_set = csis_client_release_set_cb,
- .discover = csis_discover_cb,
- .ordered_access = csis_client_ordered_access_cb
+static struct bt_csip_set_coordinator_cb cbs = {
+ .lock_set = csip_set_coordinator_lock_set_cb,
+ .release_set = csip_set_coordinator_release_set_cb,
+ .discover = csip_discover_cb,
+ .ordered_access = csip_set_coordinator_ordered_access_cb
};
-static bool csis_client_oap_cb(const struct bt_csis_client_set_info *set_info,
- struct bt_csis_client_set_member *members[],
- size_t count)
+static bool csip_set_coordinator_oap_cb(const struct bt_csip_set_coordinator_set_info *set_info,
+ struct bt_csip_set_coordinator_set_member *members[],
+ size_t count)
{
for (size_t i = 0; i < count; i++) {
printk("Ordered access for members[%zu]: %p\n", i, members[i]);
@@ -156,14 +156,14 @@
return true;
}
-static bool csis_found(struct bt_data *data, void *user_data)
+static bool csip_found(struct bt_data *data, void *user_data)
{
- if (bt_csis_client_is_set_member(cur_inst->info.set_sirk, data)) {
+ if (bt_csip_set_coordinator_is_set_member(cur_inst->info.set_sirk, data)) {
bt_addr_le_t *addr = user_data;
char addr_str[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
- shell_print(ctx_shell, "Found CSIS advertiser with address %s",
+ shell_print(ctx_shell, "Found CSIP advertiser with address %s",
addr_str);
if (is_discovered(addr)) {
@@ -197,19 +197,19 @@
return true;
}
-static void csis_client_scan_recv(const struct bt_le_scan_recv_info *info,
- struct net_buf_simple *ad)
+static void csip_set_coordinator_scan_recv(const struct bt_le_scan_recv_info *info,
+ struct net_buf_simple *ad)
{
/* We're only interested in connectable events */
if (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) {
if (cur_inst != NULL) {
- bt_data_parse(ad, csis_found, (void *)info->addr);
+ bt_data_parse(ad, csip_found, (void *)info->addr);
}
}
}
-static struct bt_le_scan_cb csis_client_scan_callbacks = {
- .recv = csis_client_scan_recv
+static struct bt_le_scan_cb csip_set_coordinator_scan_callbacks = {
+ .recv = csip_set_coordinator_scan_recv
};
static void discover_members_timer_handler(struct k_work *work)
@@ -225,8 +225,8 @@
}
}
-static int cmd_csis_client_init(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_init(const struct shell *sh, size_t argc,
+ char *argv[])
{
static bool initialized;
@@ -236,8 +236,8 @@
k_work_init_delayable(&discover_members_timer,
discover_members_timer_handler);
- bt_le_scan_cb_register(&csis_client_scan_callbacks);
- bt_csis_client_register_cb(&cbs);
+ bt_le_scan_cb_register(&csip_set_coordinator_scan_callbacks);
+ bt_csip_set_coordinator_register_cb(&cbs);
bt_conn_cb_register(&conn_callbacks);
initialized = true;
@@ -245,8 +245,8 @@
return 0;
}
-static int cmd_csis_client_discover(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_discover(const struct shell *sh,
+ size_t argc, char *argv[])
{
char addr[BT_ADDR_LE_STR_LEN];
long member_index = 0;
@@ -270,9 +270,10 @@
conn = conns[member_index];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
+
shell_print(sh, "Discovering for member[%u] (%s)",
(uint8_t)member_index, addr);
- err = bt_csis_client_discover(conn);
+ err = bt_csip_set_coordinator_discover(conn);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -280,12 +281,12 @@
return err;
}
-static int cmd_csis_client_discover_members(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_discover_members(const struct shell *sh,
+ size_t argc, char *argv[])
{
int err;
- cur_inst = (struct bt_csis_client_csis_inst *)strtol(argv[1], NULL, 0);
+ cur_inst = (struct bt_csip_set_coordinator_csis_inst *)strtol(argv[1], NULL, 0);
if (cur_inst == NULL) {
shell_error(sh, "NULL set");
@@ -308,7 +309,7 @@
}
err = k_work_reschedule(&discover_members_timer,
- CSIS_CLIENT_DISCOVER_TIMER_VALUE);
+ BT_CSIP_SET_COORDINATOR_DISCOVER_TIMER_VALUE);
if (err < 0) { /* Can return 0, 1 and 2 for success */
shell_error(sh,
"Could not schedule discover_members_timer %d",
@@ -324,8 +325,8 @@
return err;
}
-static int cmd_csis_client_lock_set(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_lock_set(const struct shell *sh,
+ size_t argc, char *argv[])
{
int err;
int conn_count = 0;
@@ -341,7 +342,8 @@
}
}
- err = bt_csis_client_lock(locked_members, conn_count, &cur_inst->info);
+ err = bt_csip_set_coordinator_lock(locked_members, conn_count,
+ &cur_inst->info);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -349,8 +351,8 @@
return err;
}
-static int cmd_csis_client_release_set(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_release_set(const struct shell *sh,
+ size_t argc, char *argv[])
{
int err;
int conn_count = 0;
@@ -366,7 +368,8 @@
}
}
- err = bt_csis_client_release(locked_members, conn_count, &cur_inst->info);
+ err = bt_csip_set_coordinator_release(locked_members, conn_count,
+ &cur_inst->info);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -374,12 +377,12 @@
return err;
}
-static int cmd_csis_client_ordered_access(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_ordered_access(const struct shell *sh,
+ size_t argc, char *argv[])
{
int err;
long member_count = (long)ARRAY_SIZE(set_members);
- const struct bt_csis_client_set_member *members[ARRAY_SIZE(set_members)];
+ const struct bt_csip_set_coordinator_set_member *members[ARRAY_SIZE(set_members)];
if (argc > 1) {
member_count = strtol(argv[1], NULL, 0);
@@ -395,9 +398,10 @@
members[i] = set_members[i];
}
- err = bt_csis_client_ordered_access(members, ARRAY_SIZE(members),
- &cur_inst->info,
- csis_client_oap_cb);
+ err = bt_csip_set_coordinator_ordered_access(members,
+ ARRAY_SIZE(members),
+ &cur_inst->info,
+ csip_set_coordinator_oap_cb);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -405,12 +409,12 @@
return err;
}
-static int cmd_csis_client_lock(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_lock(const struct shell *sh, size_t argc,
+ char *argv[])
{
int err;
long member_index = 0;
- const struct bt_csis_client_set_member *lock_member[1];
+ const struct bt_csip_set_coordinator_set_member *lock_member[1];
if (cur_inst == NULL) {
shell_error(sh, "No set selected");
@@ -430,7 +434,7 @@
lock_member[0] = set_members[member_index];
- err = bt_csis_client_lock(lock_member, 1, &cur_inst->info);
+ err = bt_csip_set_coordinator_lock(lock_member, 1, &cur_inst->info);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -438,12 +442,12 @@
return err;
}
-static int cmd_csis_client_release(const struct shell *sh, size_t argc,
- char *argv[])
+static int cmd_csip_set_coordinator_release(const struct shell *sh, size_t argc,
+ char *argv[])
{
int err;
long member_index = 0;
- const struct bt_csis_client_set_member *lock_member[1];
+ const struct bt_csip_set_coordinator_set_member *lock_member[1];
if (cur_inst == NULL) {
shell_error(sh, "No set selected");
@@ -463,7 +467,7 @@
lock_member[0] = set_members[member_index];
- err = bt_csis_client_release(lock_member, 1, &cur_inst->info);
+ err = bt_csip_set_coordinator_release(lock_member, 1, &cur_inst->info);
if (err != 0) {
shell_error(sh, "Fail: %d", err);
}
@@ -471,7 +475,8 @@
return err;
}
-static int cmd_csis_client(const struct shell *sh, size_t argc, char **argv)
+static int cmd_csip_set_coordinator(const struct shell *sh, size_t argc,
+ char **argv)
{
if (argc > 1) {
shell_error(sh, "%s unknown parameter: %s",
@@ -483,34 +488,34 @@
return -ENOEXEC;
}
-SHELL_STATIC_SUBCMD_SET_CREATE(csis_client_cmds,
+SHELL_STATIC_SUBCMD_SET_CREATE(csip_set_coordinator_cmds,
SHELL_CMD_ARG(init, NULL,
- "Initialize CSIS_CLIENT",
- cmd_csis_client_init, 1, 1),
+ "Initialize csip_set_coordinator",
+ cmd_csip_set_coordinator_init, 1, 1),
SHELL_CMD_ARG(discover, NULL,
"Run discover for CSIS on peer device [member_index]",
- cmd_csis_client_discover, 1, 1),
+ cmd_csip_set_coordinator_discover, 1, 1),
SHELL_CMD_ARG(discover_members, NULL,
"Scan for set members <set_pointer>",
- cmd_csis_client_discover_members, 2, 0),
+ cmd_csip_set_coordinator_discover_members, 2, 0),
SHELL_CMD_ARG(lock_set, NULL,
"Lock set",
- cmd_csis_client_lock_set, 1, 0),
+ cmd_csip_set_coordinator_lock_set, 1, 0),
SHELL_CMD_ARG(release_set, NULL,
"Release set",
- cmd_csis_client_release_set, 1, 0),
+ cmd_csip_set_coordinator_release_set, 1, 0),
SHELL_CMD_ARG(lock, NULL,
"Lock specific member [member_index]",
- cmd_csis_client_lock, 1, 1),
+ cmd_csip_set_coordinator_lock, 1, 1),
SHELL_CMD_ARG(release, NULL,
"Release specific member [member_index]",
- cmd_csis_client_release, 1, 1),
+ cmd_csip_set_coordinator_release, 1, 1),
SHELL_CMD_ARG(ordered_access, NULL,
"Perform dummy ordered access procedure [member_count]",
- cmd_csis_client_ordered_access, 1, 1),
+ cmd_csip_set_coordinator_ordered_access, 1, 1),
SHELL_SUBCMD_SET_END
);
-SHELL_CMD_ARG_REGISTER(csis_client, &csis_client_cmds,
- "Bluetooth CSIS_CLIENT shell commands",
- cmd_csis_client, 1, 1);
+SHELL_CMD_ARG_REGISTER(csip_set_coordinator, &csip_set_coordinator_cmds,
+ "Bluetooth csip_set_coordinator shell commands",
+ cmd_csip_set_coordinator, 1, 1);
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
index 5bf7020..bad8960 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf
@@ -60,10 +60,10 @@
CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=2
# Coordinated Set Identification
-CONFIG_BT_CSIS=y
-CONFIG_BT_CSIS_TEST_SAMPLE_DATA=y
-CONFIG_BT_CSIS_CLIENT=y
-CONFIG_BT_CSIS_CLIENT_TEST_SAMPLE_DATA=y
+CONFIG_BT_CSIP=y
+CONFIG_BT_CSIP_TEST_SAMPLE_DATA=y
+CONFIG_BT_CSIP_SET_COORDINATOR=y
+CONFIG_BT_CSIP_SET_COORDINATOR_TEST_SAMPLE_DATA=y
# Telephone bearer service
CONFIG_BT_TBS=y
@@ -132,9 +132,9 @@
CONFIG_BT_OTS_LOG_LEVEL_DBG=y
CONFIG_BT_DEBUG_OTS_CLIENT=y
CONFIG_MCTL_DEBUG=y
-CONFIG_BT_DEBUG_CSIS=y
-CONFIG_BT_DEBUG_CSIS_CLIENT=y
-CONFIG_BT_DEBUG_CSIS_CRYPTO=y
+CONFIG_BT_DEBUG_CSIP=y
+CONFIG_BT_DEBUG_CSIP_SET_COORDINATOR=y
+CONFIG_BT_DEBUG_CSIP_CRYPTO=y
CONFIG_BT_AUDIO_DEBUG_UNICAST_CLIENT=y
CONFIG_BT_AUDIO_DEBUG_UNICAST_SERVER=y
CONFIG_BT_AUDIO_DEBUG_BROADCAST_SINK=y
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_acceptor_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_acceptor_test.c
index 80a0e5d..8cd9e54 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_acceptor_test.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_acceptor_test.c
@@ -19,7 +19,7 @@
BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_CAS_VAL)),
};
-static struct bt_csis *csis;
+static struct bt_csip *csis;
CREATE_FLAG(flag_connected);
@@ -45,7 +45,7 @@
static void init(void)
{
- struct bt_csis_register_param csis_param = {
+ struct bt_csip_register_param csis_param = {
.set_size = 3,
.rank = 1,
.lockable = true,
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_initiator_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_initiator_test.c
index 14b1d45..bd1a1c3 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_initiator_test.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/cap_initiator_test.c
@@ -18,7 +18,7 @@
CREATE_FLAG(flag_mtu_exchanged);
static void cap_discovery_complete_cb(struct bt_conn *conn, int err,
- const struct bt_csis_client_csis_inst *csis_inst)
+ const struct bt_csip_set_coordinator_csis_inst *csis_inst)
{
if (err != 0) {
FAIL("Failed to discover CAS: %d", err);
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_client_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_set_coordinator_test.c
similarity index 68%
rename from tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_client_test.c
rename to tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_set_coordinator_test.c
index 8f9389a..467a53a 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_client_test.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_set_coordinator_test.c
@@ -1,12 +1,12 @@
/*
* Copyright (c) 2019 Bose Corporation
- * Copyright (c) 2020-2021 Nordic Semiconductor ASA
+ * Copyright (c) 2020-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
-#ifdef CONFIG_BT_CSIS_CLIENT
+#ifdef CONFIG_BT_CSIP_SET_COORDINATOR
#include <zephyr/bluetooth/addr.h>
-#include <zephyr/bluetooth/audio/csis.h>
+#include <zephyr/bluetooth/audio/csip.h>
#include "common.h"
extern enum bst_result_t bst_result;
@@ -17,17 +17,17 @@
static volatile bool set_unlocked;
static volatile bool ordered_access_locked;
static volatile bool ordered_access_unlocked;
-static const struct bt_csis_client_csis_inst *inst;
+static const struct bt_csip_set_coordinator_csis_inst *inst;
static uint8_t members_found;
static struct k_work_delayable discover_members_timer;
static bt_addr_le_t addr_found[CONFIG_BT_MAX_CONN];
static struct bt_conn *conns[CONFIG_BT_MAX_CONN];
-static const struct bt_csis_client_set_member *set_members[CONFIG_BT_MAX_CONN];
+static const struct bt_csip_set_coordinator_set_member *set_members[CONFIG_BT_MAX_CONN];
-static void csis_client_lock_set_cb(int err);
+static void csip_set_coordinator_lock_set_cb(int err);
-static void csis_client_lock_release_cb(int err)
+static void csip_set_coordinator_lock_release_cb(int err)
{
printk("%s\n", __func__);
@@ -39,7 +39,7 @@
set_unlocked = true;
}
-static void csis_client_lock_set_cb(int err)
+static void csip_set_coordinator_lock_set_cb(int err)
{
printk("%s\n", __func__);
@@ -51,8 +51,8 @@
set_locked = true;
}
-static void csis_discover_cb(struct bt_conn *conn,
- const struct bt_csis_client_set_member *member,
+static void csip_discover_cb(struct bt_conn *conn,
+ const struct bt_csip_set_coordinator_set_member *member,
int err, size_t set_count)
{
uint8_t conn_index;
@@ -71,15 +71,15 @@
discovered = true;
}
-static void csis_lock_changed_cb(struct bt_csis_client_csis_inst *inst,
+static void csip_lock_changed_cb(struct bt_csip_set_coordinator_csis_inst *inst,
bool locked)
{
printk("Inst %p %s\n", inst, locked ? "locked" : "released");
}
-static void csis_client_ordered_access_cb(const struct bt_csis_client_set_info *set_info,
- int err, bool locked,
- struct bt_csis_client_set_member *member)
+static void csip_set_coordinator_ordered_access_cb(
+ const struct bt_csip_set_coordinator_set_info *set_info, int err,
+ bool locked, struct bt_csip_set_coordinator_set_member *member)
{
if (err) {
FAIL("Ordered access failed with err %d\n", err);
@@ -117,17 +117,17 @@
.connected = connected,
};
-static struct bt_csis_client_cb cbs = {
- .lock_set = csis_client_lock_set_cb,
- .release_set = csis_client_lock_release_cb,
- .discover = csis_discover_cb,
- .lock_changed = csis_lock_changed_cb,
- .ordered_access = csis_client_ordered_access_cb
+static struct bt_csip_set_coordinator_cb cbs = {
+ .lock_set = csip_set_coordinator_lock_set_cb,
+ .release_set = csip_set_coordinator_lock_release_cb,
+ .discover = csip_discover_cb,
+ .lock_changed = csip_lock_changed_cb,
+ .ordered_access = csip_set_coordinator_ordered_access_cb
};
-static bool csis_client_oap_cb(const struct bt_csis_client_set_info *set_info,
- struct bt_csis_client_set_member *members[],
- size_t count)
+static bool csip_set_coordinator_oap_cb(const struct bt_csip_set_coordinator_set_info *set_info,
+ struct bt_csip_set_coordinator_set_member *members[],
+ size_t count)
{
for (size_t i = 0; i < count; i++) {
printk("Ordered access for members[%zu]: %p\n", i, members[i]);
@@ -146,14 +146,14 @@
return false;
}
-static bool csis_found(struct bt_data *data, void *user_data)
+static bool csip_found(struct bt_data *data, void *user_data)
{
- if (bt_csis_client_is_set_member(inst->info.set_sirk, data)) {
+ if (bt_csip_set_coordinator_is_set_member(inst->info.set_sirk, data)) {
const bt_addr_le_t *addr = user_data;
char addr_str[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
- printk("Found CSIS advertiser with address %s\n", addr_str);
+ printk("Found CSIP advertiser with address %s\n", addr_str);
if (is_discovered(addr)) {
printk("Set member already found\n");
@@ -173,8 +173,8 @@
return true;
}
-static void csis_client_scan_recv(const struct bt_le_scan_recv_info *info,
- struct net_buf_simple *ad)
+static void csip_set_coordinator_scan_recv(const struct bt_le_scan_recv_info *info,
+ struct net_buf_simple *ad)
{
/* We're only interested in connectable events */
if (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) {
@@ -185,13 +185,13 @@
info->addr);
}
} else { /* Scanning for set members */
- bt_data_parse(ad, csis_found, (void *)info->addr);
+ bt_data_parse(ad, csip_found, (void *)info->addr);
}
}
}
-static struct bt_le_scan_cb csis_client_scan_callbacks = {
- .recv = csis_client_scan_recv
+static struct bt_le_scan_cb csip_set_coordinator_scan_callbacks = {
+ .recv = csip_set_coordinator_scan_recv
};
static void discover_members_timer_handler(struct k_work *work)
@@ -200,7 +200,7 @@
members_found, inst->info.set_size);
}
-static void ordered_access(const struct bt_csis_client_set_member **members,
+static void ordered_access(const struct bt_csip_set_coordinator_set_member **members,
size_t count, bool expect_locked)
{
int err;
@@ -214,10 +214,12 @@
ordered_access_unlocked = false;
}
- err = bt_csis_client_ordered_access(members, count, &inst->info,
- csis_client_oap_cb);
+ err = bt_csip_set_coordinator_ordered_access(members, count,
+ &inst->info,
+ csip_set_coordinator_oap_cb);
if (err != 0) {
- FAIL("Failed to do CSIS client ordered access (%d)", err);
+ FAIL("Failed to do CSIP set coordinator ordered access (%d)",
+ err);
return;
}
@@ -232,7 +234,7 @@
{
int err;
char addr[BT_ADDR_LE_STR_LEN];
- const struct bt_csis_client_set_member *locked_members[CONFIG_BT_MAX_CONN];
+ const struct bt_csip_set_coordinator_set_member *locked_members[CONFIG_BT_MAX_CONN];
uint8_t connected_member_count = 0;
err = bt_enable(NULL);
@@ -244,10 +246,10 @@
printk("Audio Client: Bluetooth initialized\n");
bt_conn_cb_register(&conn_callbacks);
- bt_csis_client_register_cb(&cbs);
+ bt_csip_set_coordinator_register_cb(&cbs);
k_work_init_delayable(&discover_members_timer,
discover_members_timer_handler);
- bt_le_scan_cb_register(&csis_client_scan_callbacks);
+ bt_le_scan_cb_register(&csip_set_coordinator_scan_callbacks);
err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, NULL);
if (err != 0) {
@@ -278,9 +280,9 @@
WAIT_FOR_COND(is_connected);
connected_member_count++;
- err = bt_csis_client_discover(conns[0]);
+ err = bt_csip_set_coordinator_discover(conns[0]);
if (err != 0) {
- FAIL("Failed to initialize CSIS client for connection %d\n",
+ FAIL("Failed to initialize set coordinator for connection %d\n",
err);
return;
}
@@ -294,7 +296,7 @@
}
err = k_work_reschedule(&discover_members_timer,
- CSIS_CLIENT_DISCOVER_TIMER_VALUE);
+ BT_CSIP_SET_COORDINATOR_DISCOVER_TIMER_VALUE);
if (err < 0) { /* Can return 0, 1 and 2 for success */
FAIL("Could not schedule discover_members_timer %d", err);
return;
@@ -329,9 +331,9 @@
discovered = false;
printk("Doing discovery on member[%u]", i);
- err = bt_csis_client_discover(conns[i]);
+ err = bt_csip_set_coordinator_discover(conns[i]);
if (err != 0) {
- FAIL("Failed to initialize CSIS client for connection %d\n",
+ FAIL("Failed to initialize set coordinator for connection %d\n",
err);
return;
}
@@ -346,10 +348,10 @@
ordered_access(locked_members, connected_member_count, false);
printk("Locking set\n");
- err = bt_csis_client_lock(locked_members, connected_member_count,
- &inst->info);
+ err = bt_csip_set_coordinator_lock(locked_members, connected_member_count,
+ &inst->info);
if (err != 0) {
- FAIL("Failed to do CSIS client lock (%d)", err);
+ FAIL("Failed to do set coordinator lock (%d)", err);
return;
}
@@ -360,10 +362,10 @@
k_sleep(K_MSEC(1000)); /* Simulate doing stuff */
printk("Releasing set\n");
- err = bt_csis_client_release(locked_members, connected_member_count,
- &inst->info);
+ err = bt_csip_set_coordinator_release(locked_members, connected_member_count,
+ &inst->info);
if (err != 0) {
- FAIL("Failed to do CSIS client release (%d)", err);
+ FAIL("Failed to do set coordinator release (%d)", err);
return;
}
@@ -376,10 +378,10 @@
set_unlocked = false;
printk("Locking set\n");
- err = bt_csis_client_lock(locked_members, connected_member_count,
- &inst->info);
+ err = bt_csip_set_coordinator_lock(locked_members, connected_member_count,
+ &inst->info);
if (err != 0) {
- FAIL("Failed to do CSIS client lock (%d)", err);
+ FAIL("Failed to do set coordinator lock (%d)", err);
return;
}
@@ -388,10 +390,10 @@
k_sleep(K_MSEC(1000)); /* Simulate doing stuff */
printk("Releasing set\n");
- err = bt_csis_client_release(locked_members, connected_member_count,
- &inst->info);
+ err = bt_csip_set_coordinator_release(locked_members, connected_member_count,
+ &inst->info);
if (err != 0) {
- FAIL("Failed to do CSIS client release (%d)", err);
+ FAIL("Failed to do set coordinator release (%d)", err);
return;
}
@@ -414,7 +416,7 @@
static const struct bst_test_instance test_connect[] = {
{
- .test_id = "csis_client",
+ .test_id = "csip_set_coordinator",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
@@ -423,14 +425,14 @@
BSTEST_END_MARKER
};
-struct bst_test_list *test_csis_client_install(struct bst_test_list *tests)
+struct bst_test_list *test_csip_set_coordinator_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_connect);
}
#else
-struct bst_test_list *test_csis_client_install(struct bst_test_list *tests)
+struct bst_test_list *test_csip_set_coordinator_install(struct bst_test_list *tests)
{
return tests;
}
-#endif /* CONFIG_BT_CSIS_CLIENT */
+#endif /* CONFIG_BT_CSIP_SET_COORDINATOR */
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_test.c
similarity index 75%
rename from tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_test.c
rename to tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_test.c
index 7ad60db..2e79f49 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/csis_test.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/csip_test.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2019 Bose Corporation
- * Copyright (c) 2020-2021 Nordic Semiconductor ASA
+ * Copyright (c) 2020-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
-#ifdef CONFIG_BT_CSIS
-#include <zephyr/bluetooth/audio/csis.h>
+#ifdef CONFIG_BT_CSIP
+#include <zephyr/bluetooth/audio/csip.h>
#include "common.h"
-static struct bt_csis *csis;
+static struct bt_csip *csip;
static struct bt_conn_cb conn_callbacks;
extern enum bst_result_t bst_result;
static volatile bool g_locked;
-static uint8_t sirk_read_req_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT;
-struct bt_csis_register_param param = {
+static uint8_t sirk_read_req_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
+struct bt_csip_register_param param = {
.set_size = 3,
.rank = 1,
.lockable = true,
@@ -36,7 +36,7 @@
printk("Connected\n");
}
-static void csis_disconnected(struct bt_conn *conn, uint8_t reason)
+static void csip_disconnected(struct bt_conn *conn, uint8_t reason)
{
printk("Disconnected (reason %u)\n", reason);
@@ -47,29 +47,29 @@
}
}
-static void csis_lock_changed_cb(struct bt_conn *conn, struct bt_csis *csis,
+static void csip_lock_changed_cb(struct bt_conn *conn, struct bt_csip *csip,
bool locked)
{
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
g_locked = locked;
}
-static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csis *csis)
+static uint8_t sirk_read_req_cb(struct bt_conn *conn, struct bt_csip *csip)
{
return sirk_read_req_rsp;
}
-static struct bt_csis_cb csis_cbs = {
- .lock_changed = csis_lock_changed_cb,
+static struct bt_csip_cb csip_cbs = {
+ .lock_changed = csip_lock_changed_cb,
.sirk_read_req = sirk_read_req_cb,
};
static void bt_ready(int err)
{
- uint8_t rsi[BT_CSIS_RSI_SIZE];
+ uint8_t rsi[BT_CSIP_RSI_SIZE];
struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
- BT_CSIS_DATA_RSI(rsi),
+ BT_CSIP_DATA_RSI(rsi),
};
if (err != 0) {
@@ -79,15 +79,15 @@
printk("Audio Server: Bluetooth initialized\n");
- param.cb = &csis_cbs;
+ param.cb = &csip_cbs;
- err = bt_csis_register(¶m, &csis);
+ err = bt_csip_register(¶m, &csip);
if (err != 0) {
- FAIL("Could not register CSIS (err %d)\n", err);
+ FAIL("Could not register CSIP (err %d)\n", err);
return;
}
- err = bt_csis_generate_rsi(csis, rsi);
+ err = bt_csip_generate_rsi(csip, rsi);
if (err != 0) {
FAIL("Failed to generate RSI (err %d)\n", err);
return;
@@ -101,7 +101,7 @@
static struct bt_conn_cb conn_callbacks = {
.connected = connected,
- .disconnected = csis_disconnected,
+ .disconnected = csip_disconnected,
};
static void test_main(void)
@@ -133,13 +133,13 @@
WAIT_FOR_COND(g_locked);
printk("Force releasing set\n");
- bt_csis_lock(csis, false, true);
+ bt_csip_lock(csip, false, true);
}
-static void test_csis_enc(void)
+static void test_csip_enc(void)
{
printk("Running %s\n", __func__);
- sirk_read_req_rsp = BT_CSIS_READ_SIRK_REQ_RSP_ACCEPT_ENC;
+ sirk_read_req_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC;
test_main();
}
@@ -173,39 +173,39 @@
static const struct bst_test_instance test_connect[] = {
{
- .test_id = "csis",
+ .test_id = "csip",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
.test_args_f = test_args,
},
{
- .test_id = "csis_release",
+ .test_id = "csip_release",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_force_release,
.test_args_f = test_args,
},
{
- .test_id = "csis_enc",
+ .test_id = "csip_enc",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
- .test_main_f = test_csis_enc,
+ .test_main_f = test_csip_enc,
.test_args_f = test_args,
},
BSTEST_END_MARKER
};
-struct bst_test_list *test_csis_install(struct bst_test_list *tests)
+struct bst_test_list *test_csip_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_connect);
}
#else
-struct bst_test_list *test_csis_install(struct bst_test_list *tests)
+struct bst_test_list *test_csip_install(struct bst_test_list *tests)
{
return tests;
}
-#endif /* CONFIG_BT_CSIS */
+#endif /* CONFIG_BT_CSIP */
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
index dc84f05..cb67257 100644
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/main.c
@@ -10,8 +10,8 @@
extern struct bst_test_list *test_vcs_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_micp_install(struct bst_test_list *tests);
extern struct bst_test_list *test_micp_mic_ctlr_install(struct bst_test_list *tests);
-extern struct bst_test_list *test_csis_install(struct bst_test_list *tests);
-extern struct bst_test_list *test_csis_client_install(struct bst_test_list *tests);
+extern struct bst_test_list *test_csip_install(struct bst_test_list *tests);
+extern struct bst_test_list *test_csip_set_coordinator_install(struct bst_test_list *tests);
extern struct bst_test_list *test_tbs_install(struct bst_test_list *tests);
extern struct bst_test_list *test_tbs_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_mcs_install(struct bst_test_list *tests);
@@ -36,8 +36,8 @@
test_vcs_client_install,
test_micp_install,
test_micp_mic_ctlr_install,
- test_csis_install,
- test_csis_client_install,
+ test_csip_install,
+ test_csip_set_coordinator_install,
test_tbs_install,
test_tbs_client_install,
test_mcs_install,
diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csis.sh b/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csip.sh
similarity index 74%
rename from tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csis.sh
rename to tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csip.sh
index c4b71d3..f1049da 100755
--- a/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csis.sh
+++ b/tests/bluetooth/bsim_bt/bsim_test_audio/test_scripts/csip.sh
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2020-2021 Nordic Semiconductor ASA
+# Copyright (c) 2020-2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
-# Basic CSIS test. A set coordinator (CSIS client) connects to multiple set
-# devices (CSIS), lock thems, unlocks them and disconnects.
-SIMULATION_ID="csis_csip"
+# Basic CSIP test. A set coordinator connects to multiple set members
+# lock thems, unlocks them and disconnects.
+SIMULATION_ID="csip"
VERBOSITY_LEVEL=2
PROCESS_IDS=""; EXIT_CODE=0
@@ -29,19 +29,19 @@
# NORMAL TEST
printf "\n\n======== Running normal test ========\n\n"
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csis_client \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csip_set_coordinator \
-RealEncryption=1 -rs=1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csis \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csip \
-RealEncryption=1 -rs=2 -argstest rank 1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csis \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csip \
-RealEncryption=1 -rs=3 -argstest rank 2
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csis \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csip \
-RealEncryption=1 -rs=4 -argstest rank 3
# Simulation time should be larger than the WAIT_TIME in common.h
@@ -57,19 +57,19 @@
# TEST WITH FORCE RELEASE
printf "\n\n======== Running test with forced release of lock ========\n\n"
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csis_client \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csip_set_coordinator \
-RealEncryption=1 -rs=1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csis \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csip \
-RealEncryption=1 -rs=2 -argstest rank 1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csis \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csip \
-RealEncryption=1 -rs=3 -argstest rank 2
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csis_release \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csip_release \
-RealEncryption=1 -rs=4 -argstest rank 3
# Simulation time should be larger than the WAIT_TIME in common.h
@@ -83,19 +83,19 @@
# TEST WITH SIRK ENC
printf "\n\n======== Running test with SIRK encrypted ========\n\n"
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csis_client \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=csip_set_coordinator \
-RealEncryption=1 -rs=1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csis_enc \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=csip_enc \
-RealEncryption=1 -rs=2 -argstest rank 1
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csis_enc \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=csip_enc \
-RealEncryption=1 -rs=3 -argstest rank 2
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
- -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csis_enc \
+ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=csip_enc \
-RealEncryption=1 -rs=4 -argstest rank 3
# Simulation time should be larger than the WAIT_TIME in common.h
diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf
index d977977..7142437 100644
--- a/tests/bluetooth/shell/audio.conf
+++ b/tests/bluetooth/shell/audio.conf
@@ -83,9 +83,9 @@
CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=1
# Coordinated Set Identification
-CONFIG_BT_CSIS=y
-CONFIG_BT_CSIS_CLIENT=y
-CONFIG_BT_CSIS_CLIENT_MAX_CSIS_INSTANCES=2
+CONFIG_BT_CSIP=y
+CONFIG_BT_CSIP_SET_COORDINATOR=y
+CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES=2
CONFIG_MCTL=y
CONFIG_MCTL_LOCAL_PLAYER_CONTROL=y
@@ -162,4 +162,4 @@
CONFIG_BT_DEBUG_AICS=y
CONFIG_BT_DEBUG_VOCS=y
CONFIG_BT_AUDIO_DEBUG_STREAM=y
-CONFIG_BT_DEBUG_CSIS_CLIENT=y
+CONFIG_BT_DEBUG_CSIP_SET_COORDINATOR=y