connectivity/bluetooth/api/audio/shell/cap.html · connectivity/bluetooth/api/audio/shell/cap.rst 공식 원문 ↗

Zephyr 3.7.0 · Connectivity · Bluetooth · Audio Shell

CAP shell 사용법

Coordinated set과 여러 audio stream의 시작·volume·microphone·broadcast를 role별로 조정합니다.

Official pathconnectivity/bluetooth/api/audio/shell/cap.html
Source fileconnectivity/bluetooth/api/audio/shell/cap.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Acceptor·Initiator·Commander의 공식 console 예제 18개를 보존했습니다.

Roles

Acceptor · Initiator · Commander

Examples

18

Set

CAS · CSIS

Audio

Unicast · broadcast

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 AB6E15A447BFB4069AFB7BFA2002832161A7DA37093CF58A4FE63A31DB428FA9
Bluetooth: Common Audio Profile Shell
#####################################

This document describes how to run the Common Audio Profile functionality.

CAP Acceptor
************

The Acceptor will typically be a resource-constrained device, such as a headset, earbud or hearing
aid. The Acceptor can initialize a Coordinated Set Identification Service instance, if it is in
a pair with one or more other CAP Acceptors.

Using the CAP Acceptor
======================

When the Bluetooth stack has been initialized (:code:`bt init`), the Acceptor can be registered by
calling :code:`cap_acceptor init`, which will register the CAS and CSIS services, as well as
register callbacks.

.. code-block:: console


   cap_acceptor --help
   cap_acceptor - Bluetooth CAP acceptor shell commands
   Subcommands:
     init          :Initialize the service and register callbacks [size <int>]
                    [rank <int>] [not-lockable] [sirk <data>]
     lock          :Lock the set
     release       :Release the set [force]
     sirk          :Set the currently used SIRK <sirk>
     get_sirk      :Get the currently used SIRK
     sirk_rsp      :Set the response used in SIRK requests <accept, accept_enc,
                    reject, oob>

Besides initializing the CAS and the CSIS, there are also commands to lock and release the CSIS
instance, as well as printing and modifying access to the SIRK of the CSIS.

Setting a new SIRK
------------------

This command can modify the currently used SIRK. To get the new RSI to advertise on air,
:code:`bt adv-data` or :code:`bt advertise` must be called again to set the new advertising data.
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE` is enabled, this will also notify connected
clients.

.. code-block:: console

   uart:~$ cap_acceptor sirk 00112233445566778899aabbccddeeff
   SIRK updated

Getting the current SIRK
------------------------

This command can get the currently used SIRK.

.. code-block:: console

   uart:~$ cap_acceptor get_sirk
   SIRK
   36 04 9a dc 66 3a a1 a1 |6...f:..
   1d 9a 2f 41 01 73 3e 01 |../A.s>.

CAP Initiator
*************

The Initiator will typically be a resource-rich device, such as a phone or PC. The Initiator can
discover CAP Acceptors's CAS and optional CSIS services. The CSIS service can be read to provide
information about other CAP Acceptors in the same Coordinated Set. The Initiator can execute
stream control procedures on sets of devices, either ad-hoc or Coordinated, and thus provides an
easy way to setup multiple streams on multiple devices at once.

Using the CAP Initiator
=======================

When the Bluetooth stack has been initialized (:code:`bt init`), the Initiator can discover CAS and
the optionally included CSIS instance by calling (:code:`cap_initiator discover`).
The CAP initiator also supports broadcast audio as a source.

.. code-block:: console

   uart:~$ cap_initiator --help
   cap_initiator - Bluetooth CAP initiator shell commands
   Subcommands:
     discover          : Discover CAS
     unicast_start     : Unicast Start [csip] [sinks <cnt> (default 1)] [sources
                        <cnt> (default 1)] [conns (<cnt> | all) (default 1)]
     unicast_list      : Unicast list streams
     unicast_update    : Unicast Update <all | stream [stream [stream...]]>
     unicast_stop      : Unicast stop streams [stream [stream [stream...]]] (all by default)
     unicast_cancel    : Unicast cancel current procedure
     ac_1              : Unicast audio configuration 1
     ac_2              : Unicast audio configuration 2
     ac_3              : Unicast audio configuration 3
     ac_4              : Unicast audio configuration 4
     ac_5              : Unicast audio configuration 5
     ac_6_i            : Unicast audio configuration 6(i)
     ac_6_ii           : Unicast audio configuration 6(ii)
     ac_7_i            : Unicast audio configuration 7(i)
     ac_7_ii           : Unicast audio configuration 7(ii)
     ac_8_i            : Unicast audio configuration 8(i)
     ac_8_ii           : Unicast audio configuration 8(ii)
     ac_9_i            : Unicast audio configuration 9(i)
     ac_9_ii           : Unicast audio configuration 9(ii)
     ac_10             : Unicast audio configuration 10
     ac_11_i           : Unicast audio configuration 11(i)
     ac_11_ii          : Unicast audio configuration 11(ii)
     broadcast_start   :
     broadcast_update  : <meta>
     broadcast_stop    :
     broadcast_delete  :
     ac_12             : Broadcast audio configuration 12
     ac_13             : Broadcast audio configuration 13
     ac_14             : Broadcast audio configuration 14

Before being able to perform any stream operation, the device must also perform the
:code:`bap discover` operation to discover the ASEs and PAC records. The :code:`bap init`
command also needs to be called.

When connected
--------------

Discovering CAS and CSIS on a device:

.. code-block:: console

   uart:~$ cap_initiator discover
   discovery completed with CSIS


Discovering ASEs and PAC records on a device:

.. code-block:: console

   uart:~$ bap discover
   conn 0x81cc260: #0: codec 0x81d5b28 dir 0x01
   codec 0x06 cid 0x0000 vid 0x0000 count 5
   data #0: type 0x01 len 2
   00000000: f5                                               |.                |
   data #1: type 0x02 len 1
   data #2: type 0x03 len 1
   data #3: type 0x04 len 4
   00000000: 1e 00 f0                                         |...              |
   data #4: type 0x05 len 1
   meta #0: type 0x01 len 2
   00000000: 06                                               |.                |
   dir 1 loc 1
   snk ctx 6 src ctx 6
   Conn: 0x81cc260, Sink #0: ep 0x81e4248
   Conn: 0x81cc260, Sink #1: ep 0x81e46a8
   conn 0x81cc260: #0: codec 0x81d5f00 dir 0x02
   codec 0x06 cid 0x0000 vid 0x0000 count 5
   data #0: type 0x01 len 2
   00000000: f5                                               |.                |
   data #1: type 0x02 len 1
   data #2: type 0x03 len 1
   data #3: type 0x04 len 4
   00000000: 1e 00 f0                                         |...              |
   data #4: type 0x05 len 1
   meta #0: type 0x01 len 2
   00000000: 06                                               |.                |
   dir 2 loc 1
   snk ctx 6 src ctx 6
   Conn: 0x81cc260, Source #0: ep 0x81e5c88
   Conn: 0x81cc260, Source #1: ep 0x81e60e8
   Discover complete: err 0

Both of the above commands should be done for each device that you want to use in the set.
To use multiple devices, simply connect to more and then use :code:`bt select` the device to execute
the commands on.

Once all devices have been connected and the respective discovery commands have been called, the
:code:`cap_initiator unicast_start` command can be used to put one or more streams into the
streaming state.

.. code-block:: console

   uart:~$ cap_initiator unicast_start sinks 1 sources 0 conns all
   Setting up 1 sinks and 0 sources on each (2) conn
   Starting 1 streams
   Unicast start completed

To stop all the streams that has been started, the :code:`cap_initiator unicast_stop` command can be
used.


.. code-block:: console

   uart:~$ cap_initiator unicast_stop all
   Unicast stop completed

When doing broadcast
--------------------

To start a broadcast as the CAP initiator there are a few steps to be done:

1. Create and configure an extended advertising set with periodic advertising
2. Create and configure a broadcast source
3. Setup extended and periodic advertising data

The following commands will setup a CAP broadcast source using the 16_2_1 preset (defined by BAP):


.. code-block:: console

   bt init
   bap init
   bt adv-create nconn-nscan ext-adv name
   bt per-adv-param
   bap preset broadcast 16_2_1
   cap_initiator ac_12
   bt adv-data discov
   bt per-adv-data
   cap_initiator broadcast_start


The broadcast source is created by the :code:`cap_initiator ac_12`, :code:`cap_initiator ac_13`,
and :code:`cap_initiator ac_14` commands, configuring the broadcast source for the defined audio
configurations from BAP. The broadcast source can then be stopped with
:code:`cap_initiator broadcast_stop` or deleted with :code:`cap_initiator broadcast_delete`.

The metadata of the broadcast source can be updated at any time, including when it is already
streaming. To update the metadata the :code:`cap_initiator broadcast_update` command can be used.
The command takes an array of data, and the only requirement (besides having valid data) is that the
streaming context shall be set. For example to set the streaming context to media, the command can
be used as

.. code-block:: console

   cap_initiator broadcast_update 03020400
   CAP Broadcast source updated with new metadata. Update the advertised base via `bt per-adv-data`
   bt per-adv-data

The :code:`bt per-adv-data` command should be used afterwards to update the data is the advertised
BASE. The data must be little-endian, so in the above example the metadata :code:`03020400` is
setting the metadata entry with :code:`03` as the length, :code:`02` as the type (streaming context)
and :code:`0400` as the value :code:`BT_AUDIO_CONTEXT_TYPE_MEDIA`
(which has the numeric value of 0x).

CAP Commander
*************

The Commander will typically be a either co-located with a CAP Initiator or be on a separate
resource-rich mobile device, such as a phone or smartwatch. The Commander can
discover CAP Acceptors's CAS and optional CSIS services. The CSIS service can be read to provide
information about other CAP Acceptors in the same Coordinated Set. The Commander can provide
information about broadcast sources to CAP Acceptors or coordinate capture and rendering information
such as mute or volume states.

Using the CAP Commander
=======================

When the Bluetooth stack has been initialized (:code:`bt init`), the Commander can discover CAS and
the optionally included CSIS instance by calling (:code:`cap_commander discover`).

.. code-block:: console

   cap_commander --help
   cap_commander - Bluetooth CAP commander shell commands
   Subcommands:
     discover                :Discover CAS
     cancel                  :CAP commander cancel current procedure
     change_volume           :Change volume on all connections <volume>
     change_volume_mute      :Change volume mute state on all connections <mute>
     change_volume_offset    :Change volume offset per connection <volume_offset
                              [volume_offset [...]]>
     change_microphone_mute  :Change microphone mute state on all connections <mute>
     change_microphone_gain  :Change microphone gain per connection <gain
                              [gain [...]]>


Before being able to perform any stream operation, the device must also perform the
:code:`bap discover` operation to discover the ASEs and PAC records. The :code:`bap init`
command also needs to be called.

When connected
--------------

Discovering CAS and CSIS on a device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   uart:~$ cap_commander discover
   discovery completed with CSIS


Setting the volume on all connected devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   uart:~$ vcp_vol_ctlr discover
   VCP discover done with 1 VOCS and 1 AICS
   uart:~$ cap_commander change_volume 15
   uart:~$ cap_commander change_volume 15
   Setting volume to 15 on 2 connections
   VCP volume 15, mute 0
   VCP vol_set done
   VCP volume 15, mute 0
   VCP flags 0x01
   VCP vol_set done
   Volume change completed

Setting the volume offset on one or more devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The offsets are set by connection index, so connection index 0 gets the first offset,
and index 1 gets the second offset, etc.:

.. code-block:: console

   uart:~$ bt connect <device A>
   Connected: <device A>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ vcp_vol_ctlr discover
   VCP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ bt connect <device B>
   Connected: <device B>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ vcp_vol_ctlr discover
   VCP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ cap_commander change_volume_offset 10
   Setting volume offset on 1 connections
   VOCS inst 0x200140a4 offset 10
   Offset set for inst 0x200140a4
   Volume offset change completed
   uart:~$
   uart:~$ cap_commander change_volume_offset 10 15
   Setting volume offset on 2 connections
   Offset set for inst 0x200140a4
   VOCS inst 0x20014188 offset 15
   Offset set for inst 0x20014188
   Volume offset change completed

Setting the volume mute on all connected devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   uart:~$ bt connect <device A>
   Connected: <device A>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ vcp_vol_ctlr discover
   VCP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ bt connect <device B>
   Connected: <device B>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ vcp_vol_ctlr discover
   VCP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ cap_commander change_volume_mute 1
   Setting volume mute to 1 on 2 connections
   VCP volume 100, mute 1
   VCP mute done
   VCP volume 100, mute 1
   VCP mute done
   Volume mute change completed
   uart:~$ cap_commander change_volume_mute 0
   Setting volume mute to 0 on 2 connections
   VCP volume 100, mute 0
   VCP unmute done
   VCP volume 100, mute 0
   VCP unmute done
   Volume mute change completed

Setting the microphone mute on all connected devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   uart:~$ bt connect <device A>
   Connected: <device A>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ micp_mic_ctlr discover
   MICP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ bt connect <device B>
   Connected: <device B>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ micp_mic_ctlr discover
   MICP discover done with 1 VOCS and 1 AICS
   uart:~$
   uart:~$ cap_commander change_microphone_mute 1
   Setting microphone mute to 1 on 2 connections
   MICP microphone 100, mute 1
   MICP mute done
   MICP microphone 100, mute 1
   MICP mute done
   Microphone mute change completed
   uart:~$ cap_commander change_microphone_mute 0
   Setting microphone mute to 0 on 2 connections
   MICP microphone 100, mute 0
   MICP unmute done
   MICP microphone 100, mute 0
   MICP unmute done
   Microphone mute change completed

Setting the microphone gain on one or more devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The gains are set by connection index, so connection index 0 gets the first offset,
and index 1 gets the second offset, etc.:

.. code-block:: console

   uart:~$ bt connect <device A>
   Connected: <device A>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ micp_mic_ctlr discover
   MICP discover done with 1 AICS
   uart:~$
   uart:~$ bt connect <device B>
   Connected: <device B>
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ micp_mic_ctlr discover
   MICP discover done with 1 AICS
   uart:~$
   uart:~$ cap_commander change_microphone_gain 10
   Setting microphone gain on 1 connections
   AICS inst 0x200140a4 state gain 10, mute 0, mode 0
   Gain set for inst 0x200140a4
   Microphone gain change completed
   uart:~$
   uart:~$ cap_commander change_microphone_gain 10 15
   Setting microphone gain on 2 connections
   Gain set for inst 0x200140a4
   AICS inst 0x20014188 state gain 15, mute 0, mode 0
   Gain set for inst 0x20014188
   Microphone gain change completed

Starting a broadcast reception
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   uart:~$ bt connect <device A>
   Connected: <device A>
   uart:~$ bap_init
   uart:~$ cap_commander discover
   discovery completed with CSIS
   uart:~$ bap_broadcast_assistant discover
   BASS discover done with 1 recv states
   uart:~$ cap_commander broadcast_reception_start <device B> 0 4
   Starting broadcast reception on 1 connection(s)

Part 3

한국어 전문 번역

Common Audio Profile shell

CAP 기능을 Acceptor, Initiator와 Commander role로 나누어 실행하는 방법을 설명합니다.

CAP Acceptor

Acceptor는 일반적으로 headset, earbud, hearing aid 같은 resource-constrained device입니다. 다른 CAP Acceptor와 한 쌍 또는 coordinated set을 이루면 CSIS instance를 초기화할 수 있습니다.

초기화와 명령

Bluetooth stack을 bt init으로 초기화한 뒤 cap_acceptor init을 실행하면 CAS·CSIS service와 callback을 등록합니다. Set size·rank·lock 가능 여부·SIRK를 초기화 parameter로 줄 수 있고, CSIS lock·release와 SIRK 접근 정책도 제어할 수 있습니다.

cap_acceptor --help
cap_acceptor - Bluetooth CAP acceptor shell commands
Subcommands:
  init          :Initialize the service and register callbacks [size <int>]
                 [rank <int>] [not-lockable] [sirk <data>]
  lock          :Lock the set
  release       :Release the set [force]
  sirk          :Set the currently used SIRK <sirk>
  get_sirk      :Get the currently used SIRK
  sirk_rsp      :Set the response used in SIRK requests <accept, accept_enc,
                 reject, oob>

새 SIRK 설정

현재 SIRK를 바꾼 뒤 새 RSI가 air에 광고되게 하려면 bt adv-data 또는 bt advertise로 advertising data를 다시 설정해야 합니다. CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE이 활성화되면 연결된 client에도 notification을 보냅니다.

uart:~$ cap_acceptor sirk 00112233445566778899aabbccddeeff
SIRK updated

현재 SIRK 읽기

uart:~$ cap_acceptor get_sirk
SIRK
36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>.

CAP Initiator

Initiator는 phone·PC 같은 resource-rich device입니다. Acceptor의 CAS와 optional CSIS를 발견하고 CSIS에서 같은 coordinated set의 다른 Acceptor 정보를 읽습니다. Ad-hoc 또는 coordinated device set 전체에 stream control procedure를 실행하므로 여러 device의 여러 stream을 한 번에 구성할 수 있습니다.

명령

cap_initiator discover로 CAS와 포함된 CSIS를 발견하며 broadcast source role도 지원합니다. Audio configuration 1~14 명령은 BAP이 정의한 표준 구성에 맞춰 unicast 또는 broadcast stream을 준비합니다.

uart:~$ cap_initiator --help
cap_initiator - Bluetooth CAP initiator shell commands
Subcommands:
  discover          : Discover CAS
  unicast_start     : Unicast Start [csip] [sinks <cnt> (default 1)] [sources
                     <cnt> (default 1)] [conns (<cnt> | all) (default 1)]
  unicast_list      : Unicast list streams
  unicast_update    : Unicast Update <all | stream [stream [stream...]]>
  unicast_stop      : Unicast stop streams [stream [stream [stream...]]] (all by default)
  unicast_cancel    : Unicast cancel current procedure
  ac_1              : Unicast audio configuration 1
  ac_2              : Unicast audio configuration 2
  ac_3              : Unicast audio configuration 3
  ac_4              : Unicast audio configuration 4
  ac_5              : Unicast audio configuration 5
  ac_6_i            : Unicast audio configuration 6(i)
  ac_6_ii           : Unicast audio configuration 6(ii)
  ac_7_i            : Unicast audio configuration 7(i)
  ac_7_ii           : Unicast audio configuration 7(ii)
  ac_8_i            : Unicast audio configuration 8(i)
  ac_8_ii           : Unicast audio configuration 8(ii)
  ac_9_i            : Unicast audio configuration 9(i)
  ac_9_ii           : Unicast audio configuration 9(ii)
  ac_10             : Unicast audio configuration 10
  ac_11_i           : Unicast audio configuration 11(i)
  ac_11_ii          : Unicast audio configuration 11(ii)
  broadcast_start   :
  broadcast_update  : <meta>
  broadcast_stop    :
  broadcast_delete  :
  ac_12             : Broadcast audio configuration 12
  ac_13             : Broadcast audio configuration 13
  ac_14             : Broadcast audio configuration 14

Stream을 조작하기 전 bap init과 bap discover를 실행해 ASE와 PAC record를 발견해야 합니다.

CAS·CSIS 발견

uart:~$ cap_initiator discover
discovery completed with CSIS

ASE·PAC 발견

uart:~$ bap discover
conn 0x81cc260: #0: codec 0x81d5b28 dir 0x01
codec 0x06 cid 0x0000 vid 0x0000 count 5
data #0: type 0x01 len 2
00000000: f5                                               |.                |
data #1: type 0x02 len 1
data #2: type 0x03 len 1
data #3: type 0x04 len 4
00000000: 1e 00 f0                                         |...              |
data #4: type 0x05 len 1
meta #0: type 0x01 len 2
00000000: 06                                               |.                |
dir 1 loc 1
snk ctx 6 src ctx 6
Conn: 0x81cc260, Sink #0: ep 0x81e4248
Conn: 0x81cc260, Sink #1: ep 0x81e46a8
conn 0x81cc260: #0: codec 0x81d5f00 dir 0x02
codec 0x06 cid 0x0000 vid 0x0000 count 5
data #0: type 0x01 len 2
00000000: f5                                               |.                |
data #1: type 0x02 len 1
data #2: type 0x03 len 1
data #3: type 0x04 len 4
00000000: 1e 00 f0                                         |...              |
data #4: type 0x05 len 1
meta #0: type 0x01 len 2
00000000: 06                                               |.                |
dir 2 loc 1
snk ctx 6 src ctx 6
Conn: 0x81cc260, Source #0: ep 0x81e5c88
Conn: 0x81cc260, Source #1: ep 0x81e60e8
Discover complete: err 0

Set에 사용할 각 device에서 두 discovery를 모두 실행합니다. 여러 device는 차례로 연결한 뒤 bt select로 대상 connection을 선택합니다.

여러 connection의 unicast stream 시작

다음은 연결된 두 device 각각에 sink stream 하나를 만들고 source stream은 만들지 않습니다.

uart:~$ cap_initiator unicast_start sinks 1 sources 0 conns all
Setting up 1 sinks and 0 sources on each (2) conn
Starting 1 streams
Unicast start completed

모든 stream 중지

uart:~$ cap_initiator unicast_stop all
Unicast stop completed

CAP broadcast 시작

  1. Extended advertising set과 periodic advertising 구성
  2. Broadcast source 생성·구성
  3. Extended·periodic advertising data 설정

다음은 BAP의 16_2_1 preset과 Audio Configuration 12를 사용합니다.

bt init
bap init
bt adv-create nconn-nscan ext-adv name
bt per-adv-param
bap preset broadcast 16_2_1
cap_initiator ac_12
bt adv-data discov
bt per-adv-data
cap_initiator broadcast_start

ac_12, ac_13, ac_14가 각 BAP audio configuration으로 source를 만듭니다. 이후 broadcast_stop으로 멈추거나 broadcast_delete로 삭제합니다.

Broadcast metadata 갱신

Streaming 중에도 갱신할 수 있으며 valid data와 streaming context가 필수입니다. 다음 little-endian metadata 03020400은 length 03, type 02(streaming context), value 0400(Media context)을 뜻합니다. 갱신 후 bt per-adv-data로 advertised BASE도 다시 설정합니다.

cap_initiator broadcast_update 03020400
CAP Broadcast source updated with new metadata. Update the advertised base via `bt per-adv-data`
bt per-adv-data

CAP Commander

Commander는 Initiator와 같은 device에 있거나 phone·smartwatch 같은 별도 resource-rich mobile device에 있을 수 있습니다. Acceptor의 CAS·CSIS를 발견하고, broadcast source 정보를 Acceptor에 제공하거나 mute·volume 같은 capture·rendering 상태를 여러 device에 걸쳐 조정합니다.

명령

전체 connection의 volume·mute, connection별 volume offset, microphone mute·gain과 진행 중 procedure 취소를 지원합니다.

cap_commander --help
cap_commander - Bluetooth CAP commander shell commands
Subcommands:
  discover                :Discover CAS
  cancel                  :CAP commander cancel current procedure
  change_volume           :Change volume on all connections <volume>
  change_volume_mute      :Change volume mute state on all connections <mute>
  change_volume_offset    :Change volume offset per connection <volume_offset
                           [volume_offset [...]]>
  change_microphone_mute  :Change microphone mute state on all connections <mute>
  change_microphone_gain  :Change microphone gain per connection <gain
                           [gain [...]]>

CAS·CSIS 발견

uart:~$ cap_commander discover
discovery completed with CSIS

모든 device의 volume 설정

각 connection에서 VCP를 먼저 discover한 뒤 한 명령으로 volume을 설정합니다.

uart:~$ vcp_vol_ctlr discover
VCP discover done with 1 VOCS and 1 AICS
uart:~$ cap_commander change_volume 15
uart:~$ cap_commander change_volume 15
Setting volume to 15 on 2 connections
VCP volume 15, mute 0
VCP vol_set done
VCP volume 15, mute 0
VCP flags 0x01
VCP vol_set done
Volume change completed

Connection별 volume offset

첫 offset은 connection index 0, 두 번째는 index 1에 적용됩니다. 하나만 주면 첫 connection만 바뀝니다.

uart:~$ bt connect <device A>
Connected: <device A>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ vcp_vol_ctlr discover
VCP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ bt connect <device B>
Connected: <device B>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ vcp_vol_ctlr discover
VCP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ cap_commander change_volume_offset 10
Setting volume offset on 1 connections
VOCS inst 0x200140a4 offset 10
Offset set for inst 0x200140a4
Volume offset change completed
uart:~$
uart:~$ cap_commander change_volume_offset 10 15
Setting volume offset on 2 connections
Offset set for inst 0x200140a4
VOCS inst 0x20014188 offset 15
Offset set for inst 0x20014188
Volume offset change completed

모든 device의 volume mute

각 device에서 VCP discovery 후 mute 1 또는 unmute 0을 전체 connection에 적용합니다.

uart:~$ bt connect <device A>
Connected: <device A>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ vcp_vol_ctlr discover
VCP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ bt connect <device B>
Connected: <device B>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ vcp_vol_ctlr discover
VCP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ cap_commander change_volume_mute 1
Setting volume mute to 1 on 2 connections
VCP volume 100, mute 1
VCP mute done
VCP volume 100, mute 1
VCP mute done
Volume mute change completed
uart:~$ cap_commander change_volume_mute 0
Setting volume mute to 0 on 2 connections
VCP volume 100, mute 0
VCP unmute done
VCP volume 100, mute 0
VCP unmute done
Volume mute change completed

모든 device의 microphone mute

각 connection에서 MICP를 discover한 뒤 전체 microphone을 mute 또는 unmute합니다.

uart:~$ bt connect <device A>
Connected: <device A>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ micp_mic_ctlr discover
MICP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ bt connect <device B>
Connected: <device B>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ micp_mic_ctlr discover
MICP discover done with 1 VOCS and 1 AICS
uart:~$
uart:~$ cap_commander change_microphone_mute 1
Setting microphone mute to 1 on 2 connections
MICP microphone 100, mute 1
MICP mute done
MICP microphone 100, mute 1
MICP mute done
Microphone mute change completed
uart:~$ cap_commander change_microphone_mute 0
Setting microphone mute to 0 on 2 connections
MICP microphone 100, mute 0
MICP unmute done
MICP microphone 100, mute 0
MICP unmute done
Microphone mute change completed

Connection별 microphone gain

Gain도 argument 순서대로 connection index에 대응합니다.

uart:~$ bt connect <device A>
Connected: <device A>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ micp_mic_ctlr discover
MICP discover done with 1 AICS
uart:~$
uart:~$ bt connect <device B>
Connected: <device B>
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ micp_mic_ctlr discover
MICP discover done with 1 AICS
uart:~$
uart:~$ cap_commander change_microphone_gain 10
Setting microphone gain on 1 connections
AICS inst 0x200140a4 state gain 10, mute 0, mode 0
Gain set for inst 0x200140a4
Microphone gain change completed
uart:~$
uart:~$ cap_commander change_microphone_gain 10 15
Setting microphone gain on 2 connections
Gain set for inst 0x200140a4
AICS inst 0x20014188 state gain 15, mute 0, mode 0
Gain set for inst 0x20014188
Microphone gain change completed

Broadcast reception 시작

Acceptor에 연결하고 BAP·CAP·BASS를 준비한 뒤 다른 broadcast device 정보를 이용해 reception을 시작합니다.

uart:~$ bt connect <device A>
Connected: <device A>
uart:~$ bap_init
uart:~$ cap_commander discover
discovery completed with CSIS
uart:~$ bap_broadcast_assistant discover
BASS discover done with 1 recv states
uart:~$ cap_commander broadcast_reception_start <device B> 0 4
Starting broadcast reception on 1 connection(s)

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.