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

Zephyr 3.7.0 · Connectivity · Bluetooth · Audio Shell

CSIP shell 사용법

RSI·SIRK로 coordinated set member를 찾고 rank 순서대로 전체 set을 lock·release합니다.

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

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

Part 1

요약·해설

Coordinator와 Member의 공식 console 예제 10개를 보존했습니다.

Client

Set Coordinator

Server

Set Member

Identity

RSI · SIRK

Examples

10

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 1DD3F13BA1665F2F340CEBF3FE19274DA547314552C7EFF3A0AA0EF88E502C5E
Bluetooth: Coordinated Set Identification Profile
#################################################

This document describes how to run the coordinated set identification
functionality, both as a client and as a server.
Note that in the examples below, some lines of debug have been removed to make
this shorter and provide a better overview.

Set Coordinator (Client)
************************

The client will typically be a resource-rich device, such as a smartphone
or a laptop. The client is able to lock and release members of a coordinated
set. While the coordinated set is locked, no other clients may lock the set.

To lock a set, the client must connect to each of the set members it wants to
lock. This implementation will always try to connect to all the members of
the set, and at the same time. Thus if the set size is 3, then
:code:`BT_MAX_CONN` shall be at least 3.

If the locks on set members shall persists through disconnects, it is
necessary to bond with the set members. If you need to bond with multiple
set members, make sure that :code:`BT_MAX_PAIRED` is correctly configured.

Using the Set Coordinator
=========================

When the Bluetooth stack has been initialized (:code:`bt init`),
and a set member device has been connected, the call control client can be
initialized by calling :code:`csip_set_coordinator init`, which will start a discovery
for the TBS uuids and store the handles, and optionally subscribe to all
notifications (default is to subscribe to all).

Once the client has connected and discovered the handles, then it can
read the set information, which is needed to identify other set members.
The client can then scan for and connect to the remaining set members, and once
all the members has been connected to, it can lock and release the set.

It is necessary to enable
:kconfig:option:`CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL_DBG` to properly use
the set coordinator.

.. code-block:: console

   csip_set_coordinator --help
   csip_set_coordinator - Bluetooth CSIP_SET_COORDINATOR shell commands
   Subcommands:
      init              :Initialize CSIP_SET_COORDINATOR
      discover          :Run discover for CSIS on peer device [member_index]
      discover_members  :Scan for set members <set_pointer>
      lock_set          :Lock set
      release_set       :Release set
      lock              :Lock specific member [member_index]
      release           :Release specific member [member_index]
      lock_get          :Get the lock value of the specific member and instance
                        [member_index [inst_idx]]


Example usage
=============

Setup
-----

.. code-block:: console

   uart:~$ init
   uart:~$ bt connect xx:xx:xx:xx:xx:xx public

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

Discovering sets on a device:

.. code-block:: console

   uart:~$ csip_set_coordinator init
   <dbg> bt_csip_set_coordinator.primary_discover_func: [ATTRIBUTE] handle 0x0048
   <dbg> bt_csip_set_coordinator.primary_discover_func: Discover complete, found 1 instances
   <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
   Found 1 sets on device
   uart:~$ csip_set_coordinator discover_sets
   <dbg> bt_csip_set_coordinator.SIRK
   36 04 9a dc 66 3a a1 a1 |6...f:..
   1d 9a 2f 41 01 73 3e 01 |../A.s>.
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 1
   Set size 2 (pointer: 0x566fdfe8)

Discover set members, based on the set pointer above:

.. code-block:: console

   uart:~$ csip_set_coordinator discover_members 0x566fdfe8
   <dbg> bt_csip_set_coordinator.csip_found: Found CSIS advertiser with address 34:02:86:03:86:c0 (public)
   <dbg> bt_csip_set_coordinator.is_set_member: hash: 0x33ccb1, prand 0x5bfe6a
   <dbg> bt_csip_set_coordinator.is_discovered: 34:02:86:03:86:c0 (public)
   <dbg> bt_csip_set_coordinator.is_discovered: 34:13:e8:b3:7f:9e (public)
   <dbg> bt_csip_set_coordinator.csip_found: Found member (2 / 2)
   Discovered 2/2 set members

Lock set members:

.. code-block:: console

   uart:~$ csip_set_coordinator lock_set
   <dbg> bt_csip_set_coordinator.bt_csip_set_coordinator_lock_set: Connecting to 34:02:86:03:86:c0 (public)
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_connected: Connected to 34:02:86:03:86:c0 (public)
   <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_lock_set_init_cb:
   <dbg> bt_csip_set_coordinator.SIRK
   36 04 9a dc 66 3a a1 a1 |6...f:..
   1d 9a 2f 41 01 73 3e 01 |../A.s>.
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 2
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 1
   <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 2
   <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
   Set locked

Release set members:

.. code-block:: console

   uart:~$ csip_set_coordinator release_set
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 2
   <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
   <dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 1
   <dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
   Set released

Coordinated Set Member (Server)
**********************************************
The server on devices that are part of a set,
consisting of at least two devices, e.g. a pair of earbuds.

Using the Set Member
=====================

.. code-block:: console

   csip_set_member --help
   csip_set_member - Bluetooth CSIP set member shell commands
   Subcommands:
      register      :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>

Example Usage
=============

Setup
-----

.. code-block:: console

   uart:~$ bt init
   uart:~$ csip_set_member register


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:~$ csip_set_member sirk 00112233445566778899aabbccddeeff
   SIRK updated

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

This command can get the currently used SIRK.

.. code-block:: console

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

Part 3

한국어 전문 번역

Coordinated Set Identification Profile shell

Coordinated set 식별 기능을 client인 Set Coordinator와 server인 Set Member에서 실행합니다. 예제의 일부 debug line은 개요를 위해 생략됐습니다.

Set Coordinator

Coordinator는 smartphone·laptop 같은 resource-rich client이며 set member를 lock·release합니다. Set이 lock된 동안 다른 client는 lock할 수 없습니다.

Lock하려면 원하는 모든 member에 연결해야 합니다. 구현은 모든 member에 동시에 연결하므로 set size가 3이면 BT_MAX_CONN이 최소 3이어야 합니다. Disconnect 뒤에도 lock을 유지하려면 member와 bond하고, 여러 member와 bond할 수 있도록 BT_MAX_PAIRED도 구성합니다.

CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL_DBG를 활성화해야 interactive 사용이 가능합니다. 연결·CSIS discovery 뒤 set 정보에서 다른 member를 식별하고 scan·connect한 다음 전체 set을 lock·release합니다.

csip_set_coordinator --help
csip_set_coordinator - Bluetooth CSIP_SET_COORDINATOR shell commands
Subcommands:
   init              :Initialize CSIP_SET_COORDINATOR
   discover          :Run discover for CSIS on peer device [member_index]
   discover_members  :Scan for set members <set_pointer>
   lock_set          :Lock set
   release_set       :Release set
   lock              :Lock specific member [member_index]
   release           :Release specific member [member_index]
   lock_get          :Get the lock value of the specific member and instance
                     [member_index [inst_idx]]

초기화와 첫 member 연결

uart:~$ init
uart:~$ bt connect xx:xx:xx:xx:xx:xx public

Device의 set 발견

CSIS characteristic에서 SIRK, set size, lock 상태와 rank를 읽고 set pointer를 얻습니다.

uart:~$ csip_set_coordinator init
<dbg> bt_csip_set_coordinator.primary_discover_func: [ATTRIBUTE] handle 0x0048
<dbg> bt_csip_set_coordinator.primary_discover_func: Discover complete, found 1 instances
<dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
Found 1 sets on device
uart:~$ csip_set_coordinator discover_sets
<dbg> bt_csip_set_coordinator.SIRK
36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>.
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 1
Set size 2 (pointer: 0x566fdfe8)

Set pointer로 나머지 member 발견

RSI hash·prand를 확인해 advertising device가 같은 set인지 판별합니다.

uart:~$ csip_set_coordinator discover_members 0x566fdfe8
<dbg> bt_csip_set_coordinator.csip_found: Found CSIS advertiser with address 34:02:86:03:86:c0 (public)
<dbg> bt_csip_set_coordinator.is_set_member: hash: 0x33ccb1, prand 0x5bfe6a
<dbg> bt_csip_set_coordinator.is_discovered: 34:02:86:03:86:c0 (public)
<dbg> bt_csip_set_coordinator.is_discovered: 34:13:e8:b3:7f:9e (public)
<dbg> bt_csip_set_coordinator.csip_found: Found member (2 / 2)
Discovered 2/2 set members

전체 set lock

모든 member에 연결하고 CSIS를 발견한 뒤 rank가 낮은 member부터 순서대로 lock합니다.

uart:~$ csip_set_coordinator lock_set
<dbg> bt_csip_set_coordinator.bt_csip_set_coordinator_lock_set: Connecting to 34:02:86:03:86:c0 (public)
<dbg> bt_csip_set_coordinator.csip_set_coordinator_connected: Connected to 34:02:86:03:86:c0 (public)
<dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
<dbg> bt_csip_set_coordinator.csip_set_coordinator_lock_set_init_cb:
<dbg> bt_csip_set_coordinator.SIRK
36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>.
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_lock_cb: 1
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_rank_cb: 2
<dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 1
<dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
<dbg> bt_csip_set_coordinator.csip_set_coordinator_write_lowest_rank: Locking member with rank 2
<dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was locked
Set locked

전체 set release

Lock의 역순으로 rank가 높은 member부터 release합니다.

uart:~$ csip_set_coordinator release_set
<dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 2
<dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
<dbg> bt_csip_set_coordinator.csip_set_coordinator_release_highest_rank: Releasing member with rank 1
<dbg> bt_csip_set_coordinator.notify_func: Instance 0 lock was released
Set released

Coordinated Set Member

Server는 earbud pair처럼 device 두 개 이상으로 이루어진 set의 각 member에 존재합니다. Size·rank·lock 가능 여부·SIRK를 등록하고 local lock·release와 SIRK access response를 관리합니다.

csip_set_member --help
csip_set_member - Bluetooth CSIP set member shell commands
Subcommands:
   register      :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>

초기화

uart:~$ bt init
uart:~$ csip_set_member register

새 SIRK 설정

RSI advertising을 갱신하려면 bt adv-data 또는 bt advertise를 다시 호출합니다. CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE이 활성화되면 connected client에 알립니다.

uart:~$ csip_set_member sirk 00112233445566778899aabbccddeeff
SIRK updated

현재 SIRK 읽기

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

Source

출처

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