1.. _bluetooth_le_audio_arch:
2
3LE Audio Stack
4##############
5
6.. graphviz::
7   :caption: Bluetooth Audio Architecture
8
9   digraph bluetooth_audio_arch {
10      r [shape=record, width=5, height=3
11         label="{{TMAP | HAP | PBP | GMAP | ...} |
12                  GAF |
13                  {{{ GATT | GAP } | Low-level protocols (L2CAP, ATT, etc.)} | GAP | ISO}
14                  | HCI Driver (USB, UART, SPI, virtual, etc.)}"
15         ];
16   }
17
18Overall design
19**************
20
21The overall design of the LE Audio stack is that the implementation follows the specifications
22as closely as possible,
23both in terms of structure but also naming.
24Most API functions are prefixed by the specification acronym
25(e.g. ``bt_bap`` for the Basic Audio Profile (BAP) and ``bt_vcp`` for the Volume Control Profile
26(VCP)). The functions are then further prefixed with the specific role from each profile where
27applicable (e.g. :c:func:`bt_bap_unicast_client_discover` and :c:func:`bt_vcp_vol_rend_set_vol`).
28There are usually a function per procedure defined by the profile or service specifications,
29and additional helper or meta functions that do not correspond to procedures.
30
31The structure of the files generally also follow this,
32where BAP related files are prefixed with ``bap`` and VCP related files are prefixed with ``vcp``.
33If the file is specific for a profile role, the role is also embedded in the file name.
34
35Generic Audio Framework (GAF)
36*****************************
37The Generic Audio Framework (GAF) is considered the middleware of the Bluetooth
38LE Audio architecture. The GAF contains the profiles and services that allows
39higher layer applications and profiles to set up streams, change volume, control
40media and telephony and more. The GAF builds on GATT, GAP and isochronous
41channels (ISO).
42
43GAF uses GAP to connect, advertise and synchronize to other devices.
44GAF uses GATT to configure streams, associate streams with content
45(e.g. media or telephony), control volume and more.
46GAF uses ISO for the audio streams themselves, both as unicast (connected)
47audio streams or broadcast (unconnected) audio streams.
48
49GAF mandates the use of the LC3 codec, but also supports other codecs.
50
51.. graphviz::
52   :caption: Generic Audio Framework (GAF)
53
54   digraph gaf {
55      node [shape=record];
56      edge [style=invis];
57      compound=true;
58      nodesep=0.1;
59
60      subgraph hap_layer {
61         cluster=true;
62         label="HAP";
63         HAS;
64         BAS [style=dashed];
65         IAS [style=dashed];
66      }
67
68      subgraph pbp_layer {
69         cluster=true;
70         label="PBP";
71         PBS[style=invis]; // Make it possible to treat PBP like the others
72      }
73
74      subgraph tmap_layer {
75         cluster=true;
76         label="TMAP";
77         TMAS;
78      }
79
80      subgraph gmap_layer {
81         cluster=true;
82         label="GMAP";
83         GMAS;
84      }
85
86      subgraph gaf_layer {
87         cluster=true;
88         label="Generic Audio Framework";
89
90         subgraph transition_and_coordination_control_layer {
91            cluster=true;
92            label="Transition and Coordination Control";
93            style=dashed;
94
95            subgraph cap_layer {
96               cluster=true;
97               style=solid;
98               label="CAP";
99               CAS;
100            }
101
102            subgraph csip_layer {
103               cluster=true;
104               style=solid;
105               label="CSIP";
106               CSIS;
107            }
108         }
109
110         subgraph stream_control_layer {
111            cluster=true;
112            label="Stream Control";
113            style=dashed;
114
115            subgraph bap_layer {
116               cluster=true;
117               label="BAP";
118               style=solid;
119               PACS [style=dashed];
120               ASCS [style=dashed];
121               BASS [style=dashed];
122            }
123         }
124
125         subgraph content_control_layer {
126            cluster=true;
127            label="Content Control";
128            style=dashed;
129
130            subgraph mcp_layer {
131               cluster=true;
132               label="MCP";
133               style=solid;
134               MCS;
135            }
136
137            subgraph ccp_layer {
138               cluster=true;
139               label="CCP";
140               style=solid;
141               TBS;
142            }
143         }
144
145         subgraph rendering_and_capture_control_layer {
146            cluster=true;
147            label="Rendering and Capture Control";
148            style=dashed;
149
150            subgraph micp_layer {
151               cluster=true;
152               label="MICP";
153               style=solid;
154               MICS;
155               MICP_AICS [style=dashed];
156            }
157
158            subgraph vcp_layer {
159               cluster=true;
160               label="VCP";
161               style=solid;
162               VCS;
163               VOCS [style=dashed];
164               VCP_AICS [style=dashed];
165            }
166         }
167      }
168
169      HAS -> CAS;
170      PBS -> CAS;
171      TMAS -> CAS;
172      GMAS -> CAS;
173
174      CAS -> MCS;
175      CAS -> TBS;
176      CAS -> ASCS;
177      CAS -> PACS;
178      CAS -> BASS;
179      CAS -> MICS;
180      CAS -> MICP_AICS;
181      CAS -> VCS;
182      CAS -> VOCS;
183      CAS -> VCP_AICS;
184
185      CSIS -> MCS;
186      CSIS -> TBS;
187      CSIS -> ASCS;
188      CSIS -> PACS;
189      CSIS -> BASS;
190      CSIS -> MICS;
191      CSIS -> MICP_AICS;
192      CSIS -> VCS;
193      CSIS -> VOCS;
194      CSIS -> VCP_AICS;
195   }
196
197The top-level profiles TMAP and HAP are not part of the GAF, but rather provide
198top-level requirements for how to use the GAF.
199
200GAF and the top layer profiles gave been implemented in Zephyr with the following structure.
201
202.. graphviz::
203   :caption: Zephyr Generic Audio Framework
204
205   digraph gaf {
206      node [shape=record];
207      edge [style=invis];
208      compound=true;
209      nodesep=0.1;
210
211      subgraph hap_layer {
212         cluster=true;
213         label="HAP";
214         HAS_H [label="has.h"];
215         BAS_H [label="bas.h"];
216         IAS_H [label="ias.h"];
217      }
218
219      subgraph pbp_layer {
220         cluster=true;
221         label="PBP";
222         PBP_H [label="pbp.h"]; // Make it possible to treat PBP like the others
223      }
224
225      subgraph tmap_layer {
226         cluster=true;
227         label="TMAP";
228         TMAP_H [label="tmap.h"];
229      }
230
231      subgraph gmap_layer {
232         cluster=true;
233         label="GMAP";
234         GMAP_H [label="gmap.h"];
235         GMAP_PRESET_H [label="gmap_lc3_preset.h"];
236      }
237
238      subgraph gaf_layer {
239         cluster=true;
240         label="Generic Audio Framework";
241         AUDIO_H [label="audio.h"];
242         LC3_H [label="lc3.h"];
243
244         subgraph transition_and_coordination_control_layer {
245            cluster=true;
246            label="Transition and Coordination Control";
247            style=dashed;
248
249            subgraph cap_layer {
250               cluster=true;
251               style=solid;
252               label="CAP";
253               CAP_H [label="cap.h"];
254            }
255
256            subgraph csip_layer {
257               cluster=true;
258               style=solid;
259               label="CSIP";
260               CSIP_H [label="csip.h"];
261            }
262         }
263
264         subgraph stream_control_layer {
265            cluster=true;
266            label="Stream Control";
267            style=dashed;
268
269            subgraph bap_layer {
270               cluster=true;
271               label="BAP";
272               style=solid;
273               PACS_H [label="pacs.h"];
274               BAP_H [label="bap.h"];
275               BAP_PRESET_H [label="bap_lc3_preset.h"];
276            }
277         }
278
279         subgraph content_control_layer {
280            cluster=true;
281            label="Content Control";
282            style=dashed;
283
284            subgraph mcp_layer {
285               cluster=true;
286               label="MCP";
287               style=solid;
288               MCS_H [label="mcs.h"];
289               MCC_H [label="mcc.h"];
290               MP_H [label="media_proxy.h"];
291            }
292
293            subgraph ccp_layer {
294               cluster=true;
295               label="CCP";
296               style=solid;
297               TBS_H [label="tbs.h"];
298            }
299         }
300
301         subgraph rendering_and_capture_control_layer {
302            cluster=true;
303            label="Rendering and Capture Control";
304            style=dashed;
305
306            subgraph micp_layer {
307               cluster=true;
308               label="MICP";
309               style=solid;
310               MICP_H [label="micp.h"];
311               AICS_H [label="aics.h"];
312            }
313
314            subgraph vcp_layer {
315               cluster=true;
316               label="VCP";
317               style=solid;
318               VCP_H [label="vcp.h"];
319               VOCS_H [label="vocs.h"];
320               AICS_H [label="aics.h"];
321            }
322         }
323      }
324
325      HAS_H -> CAP_H;
326      PBP_H -> CAP_H;
327      TMAP_H -> CAP_H;
328      GMAP_H -> CAP_H;
329      GMAP_PRESET_H -> CAP_H;
330
331      CAP_H -> MCS_H;
332      CAP_H -> MCC_H;
333      CAP_H -> MP_H;
334      CAP_H -> TBS_H;
335      CAP_H -> BAP_H;
336      CAP_H -> BAP_PRESET_H;
337      CAP_H -> PACS_H;
338      CAP_H -> MICP_H;
339      CAP_H -> VCP_H;
340
341      CSIP_H -> MCS_H;
342      CSIP_H -> MCC_H;
343      CSIP_H -> MP_H;
344      CSIP_H -> TBS_H;
345      CSIP_H -> BAP_H;
346      CSIP_H -> BAP_PRESET_H;
347      CSIP_H -> PACS_H;
348      CSIP_H -> MICP_H;
349      CSIP_H -> VCP_H;
350   }
351
352Profile Dependencies
353====================
354
355The LE Audio profiles depend on other profiles and services, as outlined in the following tables.
356In these tables 'Server' refers to acting in the GATT server role, and 'Client' refers to acting in the GATT client role for the specific
357service.
358If a profile role depends on another profile that depends on a service, then that dependency is implicitly also applied to that profile.
359For example, if the CAP Acceptor uses the BAP Unicast Server role, then the requirements on the ASCS Server and PACS Server also apply to the CAP Acceptor.
360
361The dependencies for Stream Control (BAP) are in the following table.
362
363.. table:: BAP dependencies
364   :widths: auto
365   :align: center
366
367   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
368   |                    | Unicast Server | Unicast Client | Broadcast Source | Broadcast Sink | Scan Delegator | Broadcast Assistant |
369   +====================+================+================+==================+================+================+=====================+
370   | BAP Scan Delegator |                |                |                  | M              |                |                     |
371   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
372   | ASCS Client        |                | M              |                  |                |                |                     |
373   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
374   | ASCS Server        | M              |                |                  |                |                |                     |
375   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
376   | PACS Client        |                | M              |                  |                |                | O                   |
377   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
378   | PACS Server        | M              |                |                  | M              |                |                     |
379   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
380   | BASS Client        |                |                |                  |                |                | M                   |
381   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
382   | BASS Server        |                |                |                  |                | M              |                     |
383   +--------------------+----------------+----------------+------------------+----------------+----------------+---------------------+
384
385Note:
386
387* As the table shows, the Broadcast Source role has no dependencies on other LE Audio profiles or services
388
389The dependencies for Content Control (MCP and CCP) are in the following tables.
390
391.. table:: MCP dependencies
392   :widths: auto
393   :align: center
394
395   +-------------+----------------------+----------------------+
396   |             | Media Control Server | Media Control Client |
397   +=============+======================+======================+
398   | GMCS Server | M                    |                      |
399   +-------------+----------------------+----------------------+
400   | GMCS Client |                      | M                    |
401   +-------------+----------------------+----------------------+
402   | MCS Server  | O                    |                      |
403   +-------------+----------------------+----------------------+
404   | MCS Client  |                      | O                    |
405   +-------------+----------------------+----------------------+
406   | OTS Server  | O                    |                      |
407   +-------------+----------------------+----------------------+
408   | OTS Client  |                      | O                    |
409   +-------------+----------------------+----------------------+
410
411.. table:: CCP dependencies
412   :widths: auto
413   :align: center
414
415   +--------------+---------------------+---------------------+
416   |              | Call Control Server | Call Control Client |
417   +==============+=====================+=====================+
418   | GTBS Server  | M                   |                     |
419   +--------------+---------------------+---------------------+
420   | GTBS Client  |                     | M                   |
421   +--------------+---------------------+---------------------+
422   | TBS Server   | M                   |                     |
423   +--------------+---------------------+---------------------+
424   | TBS Client   |                     | M                   |
425   +--------------+---------------------+---------------------+
426
427
428The dependencies for Rendering Control (MICP and VCP) are in the following tables.
429
430.. table:: MICP dependencies
431   :widths: auto
432   :align: center
433
434   +-------------+-----------------------+-------------------+
435   |             | Microphone Controller | Microphone Device |
436   +=============+=======================+===================+
437   | MICS Server | M                     |                   |
438   +-------------+-----------------------+-------------------+
439   | MICS Client |                       | M                 |
440   +-------------+-----------------------+-------------------+
441   | AICS Server | O                     |                   |
442   +-------------+-----------------------+-------------------+
443   | AICS Client |                       | O                 |
444   +-------------+-----------------------+-------------------+
445
446.. table:: VCP dependencies
447   :widths: auto
448   :align: center
449
450   +-------------+------------------+-------------------+
451   |             | Volume Renderer  | Volume Controller |
452   +=============+==================+===================+
453   | VCS Server  | M                |                   |
454   +-------------+------------------+-------------------+
455   | VCS Client  |                  | M                 |
456   +-------------+------------------+-------------------+
457   | VOCS Server | O                |                   |
458   +-------------+------------------+-------------------+
459   | VOCS Client |                  | O                 |
460   +-------------+------------------+-------------------+
461   | AICS Server | O                |                   |
462   +-------------+------------------+-------------------+
463   | AICS Client |                  | O                 |
464   +-------------+------------------+-------------------+
465
466The last element in GAF is Transition and Coordination Control (CAP and CSIP) with the dependencies from the following tables.
467
468.. table:: CAP dependencies
469   :widths: auto
470   :align: center
471
472   +----------------------------+----------+-----------+-----------+
473   |                            | Acceptor | Initiator | Commander |
474   +============================+==========+===========+===========+
475   | CAS Server                 | M        |           | C.8       |
476   +----------------------------+----------+-----------+-----------+
477   | CAS Client                 |          | M         | M         |
478   +----------------------------+----------+-----------+-----------+
479   | BAP Unicast Client         |          | C.1       |           |
480   +----------------------------+----------+-----------+-----------+
481   | BAP Unicast Server         | C.2      |           |           |
482   +----------------------------+----------+-----------+-----------+
483   | BAP Broadcast Source       |          | C.1       |           |
484   +----------------------------+----------+-----------+-----------+
485   | BAP Broadcast Sink         | C.2      |           |           |
486   +----------------------------+----------+-----------+-----------+
487   | BAP Broadcast Assistant    |          |           | C.4, C.6  |
488   +----------------------------+----------+-----------+-----------+
489   | BAP Scan Delegator         | C.3      |           | C.6       |
490   +----------------------------+----------+-----------+-----------+
491   | VCP Volume Controller      |          |           | C.6       |
492   +----------------------------+----------+-----------+-----------+
493   | VCP Volume Renderer        | O        |           |           |
494   +----------------------------+----------+-----------+-----------+
495   | MICP Microphone Controller |          |           | C.6       |
496   +----------------------------+----------+-----------+-----------+
497   | MICP Microphone Device     | O        |           |           |
498   +----------------------------+----------+-----------+-----------+
499   | CCP Call Control Server    |          | O         |           |
500   +----------------------------+----------+-----------+-----------+
501   | CCP Call Control Client    | O        |           | C.6       |
502   +----------------------------+----------+-----------+-----------+
503   | MCP Media Control Server   |          | O         |           |
504   +----------------------------+----------+-----------+-----------+
505   | MCP Media Control Client   | O        |           | C.6       |
506   +----------------------------+----------+-----------+-----------+
507   | CSIP Set Coordinator       |          | C.5       | M         |
508   +----------------------------+----------+-----------+-----------+
509   | CSIP Set Member            | C.7      |           |           |
510   +----------------------------+----------+-----------+-----------+
511
512Notes:
513
514* C.1: Support at least one of BAP Unicast Client or BAP Broadcast Source
515* C.2: Support at least one of BAP Unicast Server or BAP Broadcast Sink
516* C.3: Mandatory if BAP Broadcast Sink
517* C.4: Mandatory if BAP Scan Delegator
518* C.5: Mandatory if BAP Unicast Client
519* C.6: Support at least one
520* C.7: Mandatory if part of a coordinated set
521* C.8: Mandatory if the Commander transmits CAP announcements
522
523
524.. table:: CSIP dependencies
525   :widths: auto
526   :align: center
527
528   +------------+------------+-----------------+
529   |            | Set Member | Set Coordinator |
530   +============+============+=================+
531   | CSIS Server| M          |                 |
532   +------------+------------+-----------------+
533   | CSIS Client|            | M               |
534   +------------+------------+-----------------+
535
536
537The dependencies of the higher level profiles (GMAP, HAP, PBP and TMAP) are listed in the following tables.
538
539.. table:: GMAP dependencies
540   :widths: auto
541   :align: center
542
543   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
544   |                            | Unicast Game Gateway | Unicast Game Terminal | Broadcast Game Sender | Broadcast Game Receiver |
545   +============================+======================+=======================+=======================+=========================+
546   | GMAS Server                | M                    | M                     | O                     | M                       |
547   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
548   | GMAS Client                | M                    | O                     | O                     | O                       |
549   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
550   | CAP Initiator              | M                    |                       | M                     |                         |
551   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
552   | CAP Acceptor               |                      | M                     |                       | M                       |
553   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
554   | CAP Commander              | M                    |                       | M                     |                         |
555   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
556   | BAP Broadcast Source       |                      |                       | M                     |                         |
557   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
558   | BAP Broadcast Sink         |                      |                       |                       | M                       |
559   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
560   | BAP Unicast Client         | M                    |                       |                       |                         |
561   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
562   | BAP Unicast Server         |                      | M                     |                       |                         |
563   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
564   | VCP Volume Controller      | M                    |                       |                       |                         |
565   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
566   | VCP Volume Renderer        |                      | C.1                   |                       | M                       |
567   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
568   | MICP Microphone Controller | O                    |                       |                       |                         |
569   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
570   | MICP Microphone Device     |                      | C.2                   |                       |                         |
571   +----------------------------+----------------------+-----------------------+-----------------------+-------------------------+
572
573Notes:
574
575* C.1 Mandatory if the UGT supports the UGT Sink feature
576* C.2 Optional if the UGT supports the UGT Source feature
577
578.. table:: HAP dependencies
579   :widths: auto
580   :align: center
581
582   +----------------------------+-------------+----------------------------+-------------------------------+
583   |                            | Hearing Aid | Hearing Aid Unicast Client | Hearing Aid Remote Controller |
584   +============================+=============+============================+===============================+
585   | HAS Client                 |             |                            | M                             |
586   +----------------------------+-------------+----------------------------+-------------------------------+
587   | HAS Server                 | M           |                            |                               |
588   +----------------------------+-------------+----------------------------+-------------------------------+
589   | CAP Initiator              |             | M                          |                               |
590   +----------------------------+-------------+----------------------------+-------------------------------+
591   | CAP Acceptor               | M           |                            |                               |
592   +----------------------------+-------------+----------------------------+-------------------------------+
593   | CAP Commander              |             |                            | M                             |
594   +----------------------------+-------------+----------------------------+-------------------------------+
595   | BAP Unicast Client         |             | M                          |                               |
596   +----------------------------+-------------+----------------------------+-------------------------------+
597   | BAP Unicast Server         | M           |                            |                               |
598   +----------------------------+-------------+----------------------------+-------------------------------+
599   | VCP Volume Controller      |             |                            | M                             |
600   +----------------------------+-------------+----------------------------+-------------------------------+
601   | VCP Volume Renderer        | M           |                            |                               |
602   +----------------------------+-------------+----------------------------+-------------------------------+
603   | VOCS Server                | C.1         |                            |                               |
604   +----------------------------+-------------+----------------------------+-------------------------------+
605   | AICS Server                | O           |                            |                               |
606   +----------------------------+-------------+----------------------------+-------------------------------+
607   | MICP Microphone Controller |             |                            | O                             |
608   +----------------------------+-------------+----------------------------+-------------------------------+
609   | MICP Microphone Device     | C.2         |                            |                               |
610   +----------------------------+-------------+----------------------------+-------------------------------+
611   | CCP Call Control Client    | O           |                            |                               |
612   +----------------------------+-------------+----------------------------+-------------------------------+
613   | CCP Call Control Server    |             | O                          |                               |
614   +----------------------------+-------------+----------------------------+-------------------------------+
615   | CSIP Set Coordinator       |             | M                          | M                             |
616   +----------------------------+-------------+----------------------------+-------------------------------+
617   | CSIP Set Member            | C.3         |                            |                               |
618   +----------------------------+-------------+----------------------------+-------------------------------+
619   | BAS Server                 | C.4         |                            |                               |
620   +----------------------------+-------------+----------------------------+-------------------------------+
621   | IAS Server                 | O           |                            |                               |
622   +----------------------------+-------------+----------------------------+-------------------------------+
623
624Notes:
625
626* C.1 Mandatory if the HA supports the Volume Baslance feature and is part of a Binaural Hearing Aid Set
627* C.2 Mandatory if the HA supports the BAP Audio Source Role
628* C.3 Mandatory if the HA is capable of being part of a Binaural Hearing Aid set
629* C.4 If equipped with batteries
630* C.5 If CCP Call Control Server is supported
631
632.. table:: PBP dependencies
633   :widths: auto
634   :align: center
635
636   +-------------------------+-------------------------+-----------------------+----------------------------+
637   |                         | Public Broadcast Source | Public Broadcast sink | Public Broadcast Assistant |
638   +=========================+=========================+=======================+============================+
639   | CAP Initiator           | M                       |                       |                            |
640   +-------------------------+-------------------------+-----------------------+----------------------------+
641   | CAP Acceptor            |                         | M                     |                            |
642   +-------------------------+-------------------------+-----------------------+----------------------------+
643   | CAP Commander           |                         |                       | M                          |
644   +-------------------------+-------------------------+-----------------------+----------------------------+
645   | BAP Broadcast Assistant |                         |                       | M                          |
646   +-------------------------+-------------------------+-----------------------+----------------------------+
647
648.. table:: TMAP dependencies
649   :widths: auto
650   :align: center
651
652   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
653   |                                   | Call Gateway | Call Terminal | Unicast Media Sender | Unicast Media Receiver | Broadcast Media Sender | Broadcast Media Receiver |
654   +===================================+==============+===============+======================+========================+========================+==========================+
655   | TMAS Server                       | M            | M             | M                    | M                      | O                      | M                        |
656   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
657   | TMAS Client                       | O            | O             | O                    | O                      | O                      | O                        |
658   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
659   | CAP Initiator                     | M            |               | M                    |                        | M                      |                          |
660   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
661   | CAP Acceptor                      |              | M             |                      | M                      |                        | M                        |
662   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
663   | CAP Commander                     | M            | O             | M                    | O                      | O                      | O                        |
664   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
665   | BAP Broadcast Source              |              |               |                      |                        | M                      |                          |
666   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
667   | BAP Broadcast Sink                |              |               |                      |                        |                        | M                        |
668   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
669   | BAP Unicast Client                | M            |               | M                    |                        |                        |                          |
670   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
671   | BAP Unicast Server                |              | M             |                      | M                      |                        |                          |
672   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
673   | VCP Volume Controller             | M            |               | M                    |                        |                        |                          |
674   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
675   | VCP Volume Renderer               |              | C.1           |                      | M                      |                        | M                        |
676   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
677   | MCP Media Control Server          |              |               | M                    |                        |                        |                          |
678   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
679   | CCP Call Control Server           | M            |               |                      |                        |                        |                          |
680   +-----------------------------------+--------------+---------------+----------------------+------------------------+------------------------+--------------------------+
681
682Notes:
683
684* C.1 Mandatory to support if the BAP Unicast Server is acting as an Audio Sink
685
686Bluetooth Audio Stack Status
687============================
688
689The following table shows the current status and support of the profiles in the
690Bluetooth Audio Stack.
691
692.. table:: Bluetooth Audio Profile status
693   :widths: auto
694
695   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
696   | Module | Role                          | Version | Added in Release | Status                | Remaining                                        |
697   +========+===============================+=========+==================+=======================+==================================================+
698   | VCP    | Volume Renderer               | 1.0     | 2.6              | - Feature complete    | - Sample Application                             |
699   |        |                               |         |                  | - Shell Module        |                                                  |
700   |        |                               |         |                  | - BSIM test           |                                                  |
701   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
702   |        | Volume Controller             | 1.0     | 2.6              | - Feature complete    | - Sample Application                             |
703   |        |                               |         |                  | - Shell Module        |                                                  |
704   |        |                               |         |                  | - BSIM test           |                                                  |
705   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
706   | MICP   | Microphone Device             | 1.0     | 2.7              | - Feature complete    | - Sample Application                             |
707   |        |                               |         |                  | - Shell Module        |                                                  |
708   |        |                               |         |                  | - BSIM test           |                                                  |
709   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
710   |        | Microphone Controller         | 1.0     | 2.7              | - Feature complete    | - Sample Application                             |
711   |        |                               |         |                  | - Shell Module        |                                                  |
712   |        |                               |         |                  | - BSIM test           |                                                  |
713   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
714   | CSIP   | Set Member                    | 1.0.1   | 3.0              | - Feature complete    | - Sample Application                             |
715   |        |                               |         |                  | - Shell Module        |                                                  |
716   |        |                               |         |                  | - BSIM test           |                                                  |
717   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
718   |        | Set Coordinator               | 1.0.1   | 3.0              | - Feature complete    | - Sample Application                             |
719   |        |                               |         |                  | - Shell Module        |                                                  |
720   |        |                               |         |                  | - BSIM test           |                                                  |
721   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
722   | CCP    | Call Control Server           | 1.0     | 3.0              | - Feature complete    | - API refactor                                   |
723   |        |                               |         |                  | - Shell Module        | - Sample Application                             |
724   |        |                               |         |                  | - BSIM test           |                                                  |
725   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
726   |        | Call Control Client           | 1.0     | 3.0              | - Feature complete    | - API refactor                                   |
727   |        |                               |         |                  | - Shell Module        | - Sample Application                             |
728   |        |                               |         |                  | - BSIM test           |                                                  |
729   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
730   | MCP    | Media Control Server          | 1.0     | 3.0              | - Feature complete    | - API refactor                                   |
731   |        |                               |         |                  | - Shell Module        | - Support for multiple instances and connections |
732   |        |                               |         |                  | - BSIM test           | - Sample Application                             |
733   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
734   |        | Media Control Client          | 1.0     | 3.0              | - Feature complete    | - API refactor                                   |
735   |        |                               |         |                  | - Shell Module        | - Sample Application                             |
736   |        |                               |         |                  | - BSIM test           |                                                  |
737   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
738   | BAP    | Unicast Server                | 1.0.1   | 3.0              | - Feature complete    |                                                  |
739   |        |                               |         |                  | - Shell Module        |                                                  |
740   |        |                               |         |                  | - BSIM test           |                                                  |
741   |        |                               |         |                  | - Sample Application  |                                                  |
742   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
743   |        | Unicast Client                | 1.0.1   | 3.0              | - Feature complete    |                                                  |
744   |        |                               |         |                  | - Shell Module        |                                                  |
745   |        |                               |         |                  | - BSIM test           |                                                  |
746   |        |                               |         |                  | - Sample Application  |                                                  |
747   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
748   |        | Broadcast Source              | 1.0.1   | 3.0              | - Feature complete    |                                                  |
749   |        |                               |         |                  | - Shell Module        |                                                  |
750   |        |                               |         |                  | - BSIM test           |                                                  |
751   |        |                               |         |                  | - Sample Application  |                                                  |
752   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
753   |        | Broadcast Sink                | 1.0.1   | 3.0              | - Feature complete    |                                                  |
754   |        |                               |         |                  | - Shell Module        |                                                  |
755   |        |                               |         |                  | - BSIM test           |                                                  |
756   |        |                               |         |                  | - Sample Application  |                                                  |
757   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
758   |        | Scan Delegator                | 1.0.1   | 3.3              | - Feature complete    |                                                  |
759   |        |                               |         |                  | - Shell Module        |                                                  |
760   |        |                               |         |                  | - BSIM test           |                                                  |
761   |        |                               |         |                  | - Sample Application  |                                                  |
762   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
763   |        | Broadcast Assistant           | 1.0.1   | 3.3              | - Feature complete    |                                                  |
764   |        |                               |         |                  | - Shell Module        |                                                  |
765   |        |                               |         |                  | - BSIM test           |                                                  |
766   |        |                               |         |                  | - Sample Application  |                                                  |
767   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
768   | CAP    | Acceptor                      | 1.0     | 3.2              | - Feature complete    |                                                  |
769   |        |                               |         |                  | - Shell Module        |                                                  |
770   |        |                               |         |                  | - BSIM test           |                                                  |
771   |        |                               |         |                  | - Sample Application  |                                                  |
772   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
773   |        | Initiator                     | 1.0     | 3.3              | - Feature complete    |                                                  |
774   |        |                               |         |                  | - Shell Module        |                                                  |
775   |        |                               |         |                  | - BSIM test           |                                                  |
776   |        |                               |         |                  | - Sample Application  |                                                  |
777   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
778   |        | Commander                     |         |                  | - WIP                 | - Feature complete                               |
779   |        |                               |         |                  |                       | - Shell Module                                   |
780   |        |                               |         |                  |                       | - BSIM test                                      |
781   |        |                               |         |                  |                       | - Sample Application                             |
782   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
783   | HAP    | Hearing Aid                   | 1.0     | 3.1              | - Feature complete    |                                                  |
784   |        |                               |         |                  | - Shell Module        |                                                  |
785   |        |                               |         |                  | - BSIM test           |                                                  |
786   |        |                               |         |                  | - Sample Application  |                                                  |
787   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
788   |        | Hearing Aid Unicast Client    | 1.0     | 3.1              | - Feature complete    |                                                  |
789   |        |                               |         |                  | - Shell Module        |                                                  |
790   |        |                               |         |                  | - BSIM test           |                                                  |
791   |        |                               |         |                  | - Sample Application  |                                                  |
792   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
793   |        | Hearing Aid Remote Controller |         |                  | - WIP                 | - Feature complete                               |
794   |        |                               |         |                  |                       | - Shell Module                                   |
795   |        |                               |         |                  |                       | - BSIM test                                      |
796   |        |                               |         |                  |                       | - Sample Application                             |
797   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
798   | TMAP   | Call Gateway                  | 1.0     | 3.4              | - Feature complete    |                                                  |
799   |        |                               |         |                  | - Shell Module        |                                                  |
800   |        |                               |         |                  | - BSIM test           |                                                  |
801   |        |                               |         |                  | - Sample Application  |                                                  |
802   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
803   |        | Call Terminal                 | 1.0     | 3.4              | - Feature complete    |                                                  |
804   |        |                               |         |                  | - Shell Module        |                                                  |
805   |        |                               |         |                  | - BSIM test           |                                                  |
806   |        |                               |         |                  | - Sample Application  |                                                  |
807   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
808   |        | Unicast Media Sender          | 1.0     | 3.4              | - Feature complete    |                                                  |
809   |        |                               |         |                  | - Shell Module        |                                                  |
810   |        |                               |         |                  | - BSIM test           |                                                  |
811   |        |                               |         |                  | - Sample Application  |                                                  |
812   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
813   |        | Unicast Media Receiver        | 1.0     | 3.4              | - Feature complete    |                                                  |
814   |        |                               |         |                  | - Shell Module        |                                                  |
815   |        |                               |         |                  | - BSIM test           |                                                  |
816   |        |                               |         |                  | - Sample Application  |                                                  |
817   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
818   |        | Broadcast Media Sender        | 1.0     | 3.4              | - Feature complete    |                                                  |
819   |        |                               |         |                  | - Shell Module        |                                                  |
820   |        |                               |         |                  | - BSIM test           |                                                  |
821   |        |                               |         |                  | - Sample Application  |                                                  |
822   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
823   |        | Broadcast Media Receiver      | 1.0     | 3.4              | - Feature complete    |                                                  |
824   |        |                               |         |                  | - Shell Module        |                                                  |
825   |        |                               |         |                  | - BSIM test           |                                                  |
826   |        |                               |         |                  | - Sample Application  |                                                  |
827   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
828   | PBP    | Public Broadcast Source       |         | 3.5              | - Feature complete    |                                                  |
829   |        |                               |         |                  | - Shell Module        |                                                  |
830   |        |                               |         |                  | - BSIM test           |                                                  |
831   |        |                               |         |                  | - Sample Application  |                                                  |
832   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
833   |        | Public Broadcast Sink         |         | 3.5              | - Feature complete    |                                                  |
834   |        |                               |         |                  | - Shell Module        |                                                  |
835   |        |                               |         |                  | - BSIM test           |                                                  |
836   |        |                               |         |                  | - Sample Application  |                                                  |
837   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
838   |        | Public Broadcast Assistant    |         |                  |                       | - Feature complete                               |
839   |        |                               |         |                  |                       | - Shell Module                                   |
840   |        |                               |         |                  |                       | - BSIM test                                      |
841   |        |                               |         |                  |                       | - Sample Application                             |
842   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
843   | GMAP   | Unicast Game Gateway          |         | 3.5              | - Feature complete    | - Sample Application                             |
844   |        |                               |         |                  | - Shell Module        |                                                  |
845   |        |                               |         |                  | - BSIM test           |                                                  |
846   |        |                               |         |                  |                       |                                                  |
847   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
848   |        | Unicast Game Terminal         |         | 3.5              | - Feature complete    | - Sample Application                             |
849   |        |                               |         |                  | - Shell Module        |                                                  |
850   |        |                               |         |                  | - BSIM test           |                                                  |
851   |        |                               |         |                  |                       |                                                  |
852   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
853   |        | Broadcast Game Sender         |         | 3.5              | - Feature complete    | - Sample Application                             |
854   |        |                               |         |                  | - Shell Module        |                                                  |
855   |        |                               |         |                  | - BSIM test           |                                                  |
856   |        |                               |         |                  |                       |                                                  |
857   |        +-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
858   |        | Broadcast Game Receiver       |         | 3.5              | - Feature complete    | - Sample Application                             |
859   |        |                               |         |                  | - Shell Module        |                                                  |
860   |        |                               |         |                  | - BSIM test           |                                                  |
861   |        |                               |         |                  |                       |                                                  |
862   +--------+-------------------------------+---------+------------------+-----------------------+--------------------------------------------------+
863
864Using the Bluetooth Audio Stack
865===============================
866
867To use any of the profiles in the Bluetooth Audio Stack, including the top-level
868profiles outside of GAF, :kconfig:option:`CONFIG_BT_AUDIO` shall be enabled.
869This Kconfig option allows the enabling of the individual profiles inside of the
870Bluetooth Audio Stack. Each profile can generally be enabled on its own, but
871enabling higher-layer profiles (such as CAP, TMAP and HAP) will typically
872require enabling some of the lower layer profiles.
873
874It is, however, possible to create a device that uses e.g. only Stream Control
875(with just the BAP), without using any of the content control or
876rendering/capture control profiles, or vice versa. Using the higher layer
877profiles will however typically provide a better user experience and better
878interoperability with other devices.
879
880Common Audio Profile (CAP)
881--------------------------
882
883The Common Audio Profile introduces restrictions and requirements on the lower layer profiles.
884The procedures in CAP works on one or more streams for one or more devices. Is it thus possible via
885CAP to do a single function call to setup multiple streams across multiple devices.
886
887The figure below shows a complete structure of the procedures in CAP and
888how they correspond to procedures from the other profiles. The circles with I, A and C show whether
889the procedure has active involvement or requirements from the CAP Initiator, CAP Accept and CAP
890Commander roles respectively.
891
892.. figure:: img/cap_proc.svg
893   :align: center
894   :alt: Common Audio Profile Procedures
895
896   Common Audio Profile Procedures
897
898The API reference for CAP can be found in :ref:`Common Audio Profile <bluetooth_cap>`.
899
900Stream Control (BAP)
901--------------------
902
903Stream control is implemented by the Basic Audio Profile. This profile
904defines multiple roles:
905
906* Unicast Client
907* Unicast Server
908* Broadcast Source
909* Broadcast Sink
910* Scan Delegator
911* Broadcast Assistant
912
913Each role can be enabled individually, and it is possible to support more than
914one role.
915
916Notes about the stream control services
917~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
918
919There are 3 services primarily used by stream control using the Basic Audio Profile.
920
921Audio Stream Control Service (ASCS)
922^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923
924ASCS is a service used exclusively for setting up unicast streams,
925and is located on the BAP Unicast Server device.
926The service exposes one or more endpoints that can either be a sink or source endpoint,
927from the perspective of the Unicast Server.
928That means a sink endpoint is always audio from the Unicast Client to the Unicast Server,
929and a source endpoint is always from the Unicast Server to the Unicast Client.
930
931Unlike most other GATT services,
932ASCS require that each characteristic in the service has unique data per client.
933This means that if a Unicast Server is connected to multiple Unicast Clients,
934the Unicast Clients are not able to see or control the endpoints configured by the other clients.
935For example if a person's smartphone is streaming audio to a headset,
936then the same person will not be able to see or control that stream from their smartwatch.
937
938Broadcast Audio Scan Service (BASS)
939^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
940
941BASS is a service that is exclusively used by the Scan Delegator and Broadcast Assistant.
942The main purpose of the service is to offload scanning from low power peripherals to e.g. phones
943and PCs.
944Unlike ASCS where the data is required to be unique per client,
945the data in BASS (called receive states) are (usually) shared among all connected clients.
946That means it is possible for a person to tell their headphones to synchronize to a
947Broadcast Source using their phone,
948and then later tell their headphones to stop synchronizing using their smartwatch.
949
950A Broadcast Assistant can be any device,
951and may only support this one role without any audio capabilities.
952This allows legacy devices that do not support periodic advertisements or isochronous channels to
953still provide an interface and scan offloading for peripherals.
954The Bluetooth SIG have provided a guide on how to develop such legacy Broadcast Assistants that can
955be found at
956https://www.bluetooth.com/bluetooth-resources/developing-auracast-receivers-with-an-assistant-application-for-legacy-smartphones/.
957An important note about this guide is that many operating systems (especially on phones),
958do not allow generic usage of the BASS UUID,
959effectively making it impossible to implement your own Broadcast Assistant,
960because you cannot access the BASS.
961
962Published Audio Capabilities Service (PACS)
963^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
964
965PACS is used to expose a device's audio capabilities in Published Audio Capabilities (PAC) records.
966PACS is used by nearly all roles,
967where the Unicast Client and Broadcast Assistant will act as PACS clients,
968and Unicast Server and Broadcast Sink will act as PACS servers.
969These records contain information about the codec, and which values are supported by each codec.
970The values for the LC3 codec are defined by the Bluetooth Assigned numbers
971(https://www.bluetooth.com/specifications/assigned-numbers/), and the values for other codecs such
972as SBC are left undefined/implementation specific for BAP.
973
974PACS also usually share the same data between each connected client,
975but by using functions such as :c:func:`bt_pacs_conn_set_available_contexts_for_conn`,
976it is possible to set specific values for specific clients.
977
978The API reference for stream control can be found in
979:ref:`Bluetooth Audio <bluetooth_audio>`.
980
981
982Rendering and Capture Control
983-----------------------------
984
985Rendering and capture control is implemented by the Volume Control Profile
986(VCP) and Microphone Control Profile (MICP).
987
988The VCP implementation supports the following roles
989
990* Volume Control Service (VCS) Server
991* Volume Control Service (VCS) Client
992
993The MICP implementation supports the following roles
994
995* Microphone Control Profile (MICP) Microphone Device (server)
996* Microphone Control Profile (MICP) Microphone Controller (client)
997
998The API reference for volume control can be found in
999:ref:`Bluetooth Volume Control <bluetooth_volume>`.
1000
1001The API reference for Microphone Control can be found in
1002:ref:`Bluetooth Microphone Control <bluetooth_microphone>`.
1003
1004
1005Content Control
1006---------------
1007
1008Content control is implemented by the Call Control Profile (CCP) and
1009Media Control Profile (MCP).
1010
1011The CCP implementation is not yet implemented in Zephyr.
1012
1013The MCP implementation supports the following roles
1014
1015* Media Control Service (MCS) Server via the Media Proxy module
1016* Media Control Client (MCC)
1017
1018The API reference for media control can be found in
1019:ref:`Bluetooth Media Control <bluetooth_media>`.
1020
1021Generic TBS and Generic MCS
1022~~~~~~~~~~~~~~~~~~~~~~~~~~~
1023
1024Both the Telephone Bearer Service (TBS) used by CCP and the Media Control Service (MCS) used by MCP
1025have the concept of generic instances of the services called Generic TBS (GTBS) and
1026Generic MCS (GMCS).
1027
1028While these share a common name prefix, the behavior of these two may be significantly different.
1029
1030Generic TBS
1031^^^^^^^^^^^
1032
1033The TBS spec defines GTBS as
1034
1035   GTBS provides a single point of access and exposes a representation of its internal telephone
1036   bearers into a single telephone bearer.
1037   This service provides telephone status and control of the device as a single unit with a
1038   single set of characteristics.
1039   It is left up to the implementation to determine what telephone bearer a characteristic of
1040   GTBS represents at any time.
1041   There is no specified manner of representing a characteristic from each individual TBS that
1042   resides on the device to the same characteristic of the GTBS.
1043
1044   For example, if there is more than one TBS on a device and each has a unique telephone bearer
1045   name (e.g., Name1 and Name2),
1046   the way the GTBS represents the telephone bearer name is left up to the implementation.
1047   GTBS is suited for clients that do not need to access or control all the
1048   information available on specific telephone bearers.
1049
1050This means that a GTBS instance represents one or more telephone bearers.
1051A telephone bearer could be any application on a device that can handle (telephone) calls,
1052such as the default Call application on a smartphone,
1053but also other applications such as Signal, Discord, Teams, Slack, etc.
1054
1055GTBS may be standalone (i.e.the device only has a GTBS instance without any TBS instances),
1056and the behavior of the GTBS is mostly left up to the implementation.
1057In Zephyr the implementation of GBTS is that it contains some generic information,
1058such as the provider name which is defined to  simply be "Generic TBS",
1059but the majority of the information in the GTBS instance in Zephyr has been implemented to be a
1060union of the data of the other bearers.
1061For example if you have a bearer for regular phone calls and
1062Teams and have an active call in both bearers,
1063then each of those bearers will report a single call,
1064but the GTBS instance will report 2 calls,
1065making it possible for a simple Call Control Client to control all calls from a single bearer.
1066Similarly the supported URIs for each bearer are also made into a union in GTBS, and when placing
1067a call using the GTBS the server will pick the most suited bearer depending on the URI.
1068For example calls with URI ``tel`` would go to the regular phone application,
1069and calls with the URI ``skype`` would go to the Teams application.
1070
1071In conclusion the GTBS implementation in Zephyr is a union of the non-generic telephone bearers.
1072
1073Generic MCS
1074^^^^^^^^^^^
1075
1076The MCS spec defines GMCS as
1077
1078   The GMCS provides status and control of media playback for the device as a single unit.
1079   An MCS instance describes and controls the media playback for a
1080   specific media player within the device.
1081   A device implements MCS instances to allow clients to access the
1082   separate internal media player entities.
1083
1084and where the behavior of GMCS is defined as
1085
1086   ... the behavior of MCS and GMCS is identical,
1087   and all the characteristics and the characteristics' behaviors are the same.
1088   The term “MCS” is used throughout the document.
1089   Unless otherwise specifically stated in this specification,
1090   the same meaning applies to GMCS as well.
1091
1092This means that a GMCS instance works the same way as an MCS instance,
1093and it follows that GMCS
1094
1095   controls the media playback for a specific media player within the device
1096
1097A media player on a device could be anything that plays media,
1098such as a Spotify or Youtube application on a smartphone.
1099Thus if a device has multiple MCS instances,
1100then each of these control media for that specific application,
1101but the GMCS also controls media playback for a specific media player.
1102GMCS can thus be considered a pointer to a specific MCS instance,
1103and control either e.g. Spotify or Youtube, but not both.
1104
1105The MCS spec does however provide an example of GMCS where a device can
1106
1107   Implement a GMCS that provides status and control of media playback for the device as a whole.
1108
1109Which may indicate that an implementation may use GMCS to represent all media players with GMCS and
1110not a specific media player as stated above. In the case where a device does not have any MCS
1111instances and only GMCS, then GMCS will point to a generic instance.
1112
1113The Zephyr implementation of MCS and GMCS is incomplete,
1114and currently only supports instantiating a single instance that can either be an MCS or GMCS.
1115This means that the implementation is neither complete nor spec-compliant.
1116
1117Difference between GTBS and GMCS
1118^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1119
1120The definitions and implementations of GTBS and GMCS as stated above are notably different.
1121GTBS works as a union between the other TBS instances (if any),
1122and GMCS works as a pointer to a specific MCS instance (if any).
1123This effectively means that a simple Call Control Client can control all calls just using GTBS,
1124but a Media Control Client may only be able to control a single player using GMCS.
1125
1126Coordinated Sets
1127----------------
1128
1129Coordinated Sets is implemented by the Coordinated Sets Identification Profile
1130(CSIP).
1131
1132The CSIP implementation supports the following roles
1133
1134* Coordinated Set Identification Service (CSIP) Set Member
1135* Coordinated Set Identification Service (CSIP) Set Coordinator
1136
1137The API reference for media control can be found in
1138:ref:`Bluetooth Coordinated Sets <bluetooth_coordinated_sets>`.
1139
1140Specification correctness and data location
1141-------------------------------------------
1142
1143The implementations are designed to ensure specification compliance as much as possible.
1144When a specification introduces a requirement with e.g. a **shall** then the implementation should
1145attempt to ensure that this requirement is always followed.
1146Depending on the context of this,
1147the implementation ensures this by rejecting invalid parameters from the application,
1148or from the remote devices.
1149
1150Some requirements from the specifications are not or can not be handled by the stack itself for
1151various reasons.
1152One reason when the stack cannot handle a requirement is if the data related to the requirement is
1153exclusively controlled by the application.
1154An example of this is the advertising data,
1155where multiple service have requirements for what to advertise and when,
1156but where both the advertising state and data is exclusively controlled by the application.
1157
1158Oppositely there are also requirements from the specification,
1159where the data related to the requirement is exclusively controlled by the stack.
1160An example of this is the Volume Control Service (VCS) state,
1161where the specifications mandata that the VCP Volume Renderer (VCS server) modify the values
1162without a choice,
1163e.g. when setting the absolutely volume.
1164In cases like this the application is only notified about the change with a callback,
1165but cannot reject the request (the stack will reject any invalid requests).
1166
1167Generally when the data is simple (like the VCS state which only take up a few bytes),
1168the data is kept in and controlled by the stack,
1169as this can ensure that the requirements can be handled by the stack,
1170making it easier to use a profile role correctly.
1171When the data is more complex (e.g. the PAC records),
1172the data may be kept by the application and the stack only contains a reference to it.
1173When the data is very application specific (e.g. advertising data),
1174the data is kept in and controlled by the application.
1175
1176As a rule of thumb, the return types of the callbacks for each profile implementation indicate
1177whether the data is controlled by the stack or the application.
1178For example all the callbacks for the VCP Volume Renderer have the return type of ``void``,
1179but the return type of the BAP Unicast Server callbacks are ``int``,
1180indicating that the application not only controls a lot of the Unicast Server data,
1181but can also reject the requests.
1182The choice of what the return type of the callbacks often depend on the specifications,
1183and how much control the role has in a given context.
1184
1185Things worth knowing or considering when using LE Audio
1186=======================================================
1187
1188This section describes a few tings to consider when contributing to or using LE Audio in Zephyr.
1189The things described by this section are not unique to Zephyr as they are defined by the
1190specifications.
1191
1192Security requirements
1193---------------------
1194
1195All LE Audio services require Security Level 2 but where the key must be 128-bit and derived via an
1196OOB method or via LE Secure connections.
1197There is no Core-spec defined way of reporting this in GATT,
1198as ATT does not have a specific error code for missing OOB method or LE Secure Connections
1199(although there is a way to report wrong key size).
1200
1201In Zephyr we do not force the device to always use these, as a device that uses LE Audio may also
1202use other profiles and services that do not require such security.
1203We guard all access to services using a custom security check implemented in
1204:zephyr_file:`subsys/bluetooth/audio/audio.c`, where all LE Audio services must use the
1205internal :c:macro:`BT_AUDIO_CHRC` macro for proper security verification.
1206
1207Access to the LTK for encrypted SIRKs in CSIS
1208---------------------------------------------
1209
1210The Coordinated Set Identification Service (CSIS) may encrypt the SIRK (set identity resolving key).
1211The process of encrypting the SIRK requires the LTK as the encryption key,
1212which is typically not exposed to higher layer implementations such as CSIS.
1213This does not have any effect on the security though.
1214
1215MTU requirements
1216----------------
1217
1218The Basic Audio Profile (BAP) has a requirement that both sides shall support a minimum ATT_MTU of
1219at least 64 on the unenhanced ATT bearer or at least one enhanced ATT bearer.
1220The requirement comes from the preferred (or sometimes mandatory) use of GATT Write Without
1221Response, and where support for Write Long Characteristic Value is optional in most cases.
1222
1223If a ASCS device supports values larger than the minimum ATT_MTU of 64 octets, then it shall support
1224Read long Characteristic Value by setting :kconfig:option:`CONFIG_BT_ATT_PREPARE_COUNT` to a
1225non-zero value.
1226
1227LE Audio resources
1228##################
1229
1230This section contains some links and reference to resources that are useful for either contributors
1231to the LE Audio Stack in Zephyr, LE Audio application developers or both.
1232
1233The LE audio channel on Discord
1234*******************************
1235
1236Zephyr has a specific Discord channel for LE Audio development, which is open to all.
1237Find it here at https://discordapp.com/channels/720317445772017664/1207326649591271434 or simply
1238search for "ble-audio" from within Discord.
1239Since the ``#ble-audio`` channel is open for all,
1240we cannot discuss any specifications that are in development in that channel.
1241For discussions that require a Bluetooth SIG membership we refer to the ``#bluetooth-sig``
1242Discord channel found at https://discordapp.com/channels/720317445772017664/869172014018097162.
1243
1244Zephyr weekly meetings
1245**********************
1246
1247Anyone who is a Bluetooth SIG member and a Zephyr member can join the weekly meetings where we
1248discuss and plan the development of LE Audio in Zephyr. You can find the time of the meetings by
1249joining the Bluetooth-sig group at https://lists.zephyrproject.org/g/Bluetooth-sig.
1250
1251Github project
1252**************
1253
1254LE Audio in Zephyr has its own Github project available at
1255https://github.com/orgs/zephyrproject-rtos/projects/26.
1256The project is mostly automated,
1257and the LE Audio contributors almost only rely on the automated workflows
1258to present the state of development.
1259Anyone is able to pick any of the open issues and work on it.
1260If you cannot assign the issue to yourself,
1261please leave a comment in the issue itself or ping the Discord channel for help.
1262
1263Bluetooth SIG errata for LE Audio
1264*********************************
1265
1266There are many specifications for LE Audio,
1267and several of them are still being updated and developed.
1268To get an overview of the errata for the LE Audio specifications you can visit
1269
1270* Generic Audio (GA) errata https://bluetooth.atlassian.net/wiki/spaces/GA/pages/1634402349/GAWG+Errata+Lists
1271* Hearing Aid (HA) errata https://bluetooth.atlassian.net/wiki/spaces/HA/pages/1634140216/HA+WG+Errata+List
1272* Audio, Telephony and Automotive (ATA) errata https://bluetooth.atlassian.net/wiki/spaces/ATA/pages/1668481034/ATA+Errata+Lists
1273
1274Access to errata requires a Bluetooth SIG membership.
1275
1276Bluetooth SIG working groups for LE Audio
1277*****************************************
1278
1279There are 3 working groups in the Bluetooth SIG related to LE Audio:
1280
1281* Generic Audio (GA) https://www.bluetooth.org/groups/group.aspx?gId=665
1282* Hearing Aid (HA) https://www.bluetooth.org/groups/group.aspx?gId=605
1283* Audio, Telephony, and Automotive (ATA) https://www.bluetooth.org/groups/group.aspx?gId=659
1284
1285By joining these groups you will also get emails from their respective mailing lists,
1286where multiple questions and discussions are handled.
1287The working groups also have scheduled weekly meetings,
1288where issues and the development of the specifications are handled.
1289
1290Access to the Bluetooth SIG working groups requires a Bluetooth SIG membership.
1291
1292The LE Audio Book
1293*****************
1294
1295There is a free ebook on LE Audio at https://www.bluetooth.com/bluetooth-resources/le-audio-book/.
1296The book was released in January 2022,
1297and thus before some of the specifications were finalized,
1298but also before some of the released updates to the specifications.
1299Nevertheless the book still provides a good explanation for many of the concepts and ideas,
1300but please refer to the individual specifications for technical information.
1301
1302Bluetooth SIG informational papers, reports and guides
1303******************************************************
1304
1305The Bluetooth SIG occasionally release new informational papers, report and guides.
1306These can be found at https://www.bluetooth.com/bluetooth-resources/?tags=le-audio&keyword.
1307Here you will also find the aforementioned LE Audio book, among many other good resources.
1308