mbox series

[BlueZ,0/7] Implement the MediaAssistant "Push" command

Message ID 20240805120429.67606-1-iulia.tanasescu@nxp.com (mailing list archive)
Headers show
Series Implement the MediaAssistant "Push" command | expand

Message

Iulia Tanasescu Aug. 5, 2024, 12:04 p.m. UTC
This implements the MediaAssistant "Push" command, in BlueZ and
bluetoothctl assistant submenu.

After issuing the "Push" command, the user is prompted to enter
any stream metadata to be sent to the peer. If the "auto" value
is chosen, the default metadata found in the BASE will be sent.
Otherwise, the LTVs found in the BASE will be overwritten by the
user input.

If the stream is encrypted, the user is also prompted to enter the
Broadcast Code for decrypting. If the "auto" value is chosen, a zero
filled array will be provided over DBus.

Below is a bluetoothctl log to exercise the "Push" command for an
unencrypted stream:

client/bluetoothctl
[bluetooth]# [CHG] Controller 00:60:37:31:7E:3F Pairable: yes
[bluetooth]# AdvertisementMonitor path registered
[bluetooth]# scan on
[bluetooth]# [NEW] Device 00:60:37:31:7E:3F 00-60-37-31-7E-3F
[bluetooth]# connect 00:60:37:31:7E:3F
Attempting to connect to 00:60:37:31:7E:3F
[CHG] Device 00:60:37:31:7E:3F Connected: yes
[00-60-37-31-7E-3F]# Connection successful
[00-60-37-31-7E-3F]# [NEW] Device 15:19:44:63:76:7A 15-19-44-63-76-7A
[00-60-37-31-7E-3F]# [NEW] Assistant
      /org/bluez/hci0/src_15_19_44_63_76_7A/dev_00_60_37_31_7E_3F/bis1
[00-60-37-31-7E-3F]# assistant.push
      /org/bluez/hci0/src_15_19_44_63_76_7A/dev_00_60_37_31_7E_3F/bis1
[Assistant] Enter Metadata (auto/value): 0x03 0x02 0x04 0x00
[00-60-37-31-7E-3F]# [CHG] Assistant
      /org/bluez/hci0/src_15_19_44_63_76_7A/dev_00_60_37_31_7E_3F/bis1
      State: pending
[00-60-37-31-7E-3F]# Assistant
      /org/bluez/hci0/src_15_19_44_63_76_7A/dev_00_60_37_31_7E_3F/bis1
      pushed
[00-60-37-31-7E-3F]# [CHG] Assistant
      /org/bluez/hci0/src_15_19_44_63_76_7A/dev_00_60_37_31_7E_3F/bis1
      State: active

The btmon log below shows the GATT write command sent by the Assistant
and the GATT notification received from the peer:

< ACL Data TX: Handle 0 flags 0x00 dlen 32
      ATT: Write Command (0x52) len 27
        Handle: 0x0040 Type: Broadcast Audio Scan Control Point (0x2bc7)
          Data[25]: 02017a766344191500c21a3702ffff01010000000403020400
            Opcode: Add Source (0x02)
            Source_Address_Type: 1
            Source_Address: 15:19:44:63:76:7A
            Source_Adv_SID: 0
            Broadcast_ID: 0x371ac2
            PA_Sync_State: Synchronize to PA - PAST not available
            PA_Interval: 0xffff
            Num_Subgroups: 1
            Subgroup #0:
              BIS_Sync State: 0x00000001
              Metadata: #0: len 0x03 type 0x02
              Metadata:   04 00

> ACL Data RX: Handle 0 flags 0x01 dlen 6
      ATT: Handle Multiple Value Notification (0x23) len 28
        Length: 0x0018
        Handle: 0x003a Type: Broadcast Receive State (0x2bc8)
          Data[24]: 01017a766344191500c21a37020001010000000403020400
          Source_ID: 1
          Source_Address_Type: 1
          Source_Address: 15:19:44:63:76:7A
          Source_Adv_SID: 0
          Broadcast_ID: 0x371ac2
          PA_Sync_State: Synchronized to PA
          BIG_Encryption: Not encrypted
          Num_Subgroups: 1
          Subgroup #0:
            BIS_Sync State: 0x00000001
            Metadata: #0: len 0x03 type 0x02
            Metadata:   04 00

The bluetoothctl log below shows the "Push" command flow for an
encrypted stream:

client/bluetoothctl
[bluetooth]# [CHG] Controller 00:60:37:31:7E:3F Pairable: yes
[bluetooth]# AdvertisementMonitor path registered
[bluetooth]# scan on
[bluetooth]# [NEW] Device 00:60:37:31:7E:3F 00-60-37-31-7E-3F
[bluetooth]# connect 00:60:37:31:7E:3F
Attempting to connect to 00:60:37:31:7E:3F
[CHG] Device 00:60:37:31:7E:3F Connected: yes
[00-60-37-31-7E-3F]# Connection successful
[00-60-37-31-7E-3F]# [NEW] Device 05:1F:EE:F3:F8:7D 05-1F-EE-F3-F8-7D
[00-60-37-31-7E-3F]# [NEW] Assistant
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
[00-60-37-31-7E-3F]# assistant.push
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
[Assistant] Enter Metadata (auto/value): 0x03 0x02 0x04 0x00
[Assistant] Enter Broadcast Code (auto/value): 0x01 0x02 0x68 0x05 0x53
      0xf1 0x41 0x5a 0xa2 0x65 0xbb 0xaf 0xc6 0xea 0x03 0xb8
[00-60-37-31-7E-3F]# [CHG] Assistant
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
      State: pending
[00-60-37-31-7E-3F]# Assistant
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
      pushed
[00-60-37-31-7E-3F]# [CHG] Assistant
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
      State: requesting
[00-60-37-31-7E-3F]# [CHG] Assistant
      /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1
      State: active

The GATT write commands and notifications for this scenario are shown
in the btmon log below:

< ACL Data TX: Handle 0 flags 0x00 dlen 32
      ATT: Write Command (0x52) len 27
        Handle: 0x0040 Type: Broadcast Audio Scan Control Point (0x2bc7)
          Data[25]: 02017df8f3ee1f0500f4015d02ffff01010000000403020400
            Opcode: Add Source (0x02)
            Source_Address_Type: 1
            Source_Address: 05:1F:EE:F3:F8:7D
            Source_Adv_SID: 0
            Broadcast_ID: 0x5d01f4
            PA_Sync_State: Synchronize to PA - PAST not available
            PA_Interval: 0xffff
            Num_Subgroups: 1
            Subgroup #0:
              BIS_Sync State: 0x00000001
              Metadata: #0: len 0x03 type 0x02
              Metadata:   04 00

> ACL Data RX: Handle 0 flags 0x01 dlen 6
      ATT: Handle Multiple Value Notification (0x23) len 28
        Length: 0x0018
        Handle: 0x003a Type: Broadcast Receive State (0x2bc8)
          Data[24]: 01017df8f3ee1f0500f4015d020101000000000403020400
          Source_ID: 1
          Source_Address_Type: 1
          Source_Address: 05:1F:EE:F3:F8:7D
          Source_Adv_SID: 0
          Broadcast_ID: 0x5d01f4
          PA_Sync_State: Synchronized to PA
          BIG_Encryption: Broadcast_Code required
          Num_Subgroups: 1
          Subgroup #0:
            BIS_Sync State: 0x00000000
            Metadata: #0: len 0x03 type 0x02
            Metadata:   04 00

< ACL Data TX: Handle 0 flags 0x00 dlen 25
      ATT: Write Command (0x52) len 20
        Handle: 0x0040 Type: Broadcast Audio Scan Control Point (0x2bc7)
          Data[18]: 04010102680553f1415aa265bbafc6ea03b8
            Opcode: Set Broadcast_Code (0x04)
            Source_ID: 1
            Broadcast_Code[16]: 0102680553f1415aa265bbafc6ea03b8

> ACL Data RX: Handle 0 flags 0x01 dlen 6
      ATT: Handle Multiple Value Notification (0x23) len 28
        Length: 0x0018
        Handle: 0x003a Type: Broadcast Receive State (0x2bc8)
          Data[24]: 01017df8f3ee1f0500f4015d020201010000000403020400
          Source_ID: 1
          Source_Address_Type: 1
          Source_Address: 05:1F:EE:F3:F8:7D
          Source_Adv_SID: 0
          Broadcast_ID: 0x5d01f4
          PA_Sync_State: Synchronized to PA
          BIG_Encryption: Decrypting
          Num_Subgroups: 1
          Subgroup #0:
            BIS_Sync State: 0x00000001
            Metadata: #0: len 0x03 type 0x02
            Metadata:   04 00

Iulia Tanasescu (7):
  shared/bass: Add API to send GATT write command
  device: Add support to iterate through service data
  bass: Store Broadcast ID inside assistant struct
  shared/bass: Add APIs to register bcast src changed cb
  shared/bass: Add additional defines
  bass: Implement MediaAssistant Push method
  assistant: Implement MediaAssistant Push command

 client/assistant.c    | 247 ++++++++++++++++++++++++++++++++
 profiles/audio/bass.c | 317 +++++++++++++++++++++++++++++++++++++++++-
 src/device.c          |   8 +-
 src/device.h          |   5 +-
 src/shared/bass.c     | 133 +++++++++++++++++-
 src/shared/bass.h     |  15 +-
 6 files changed, 720 insertions(+), 5 deletions(-)


base-commit: 100c845b2d20e7f4f96b371e044b8b59944230ab

Comments

patchwork-bot+bluetooth@kernel.org Aug. 6, 2024, 8:29 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon,  5 Aug 2024 15:04:22 +0300 you wrote:
> This implements the MediaAssistant "Push" command, in BlueZ and
> bluetoothctl assistant submenu.
> 
> After issuing the "Push" command, the user is prompted to enter
> any stream metadata to be sent to the peer. If the "auto" value
> is chosen, the default metadata found in the BASE will be sent.
> Otherwise, the LTVs found in the BASE will be overwritten by the
> user input.
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/7] shared/bass: Add API to send GATT write command
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a626ae163fd7
  - [BlueZ,2/7] device: Add support to iterate through service data
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=11fce8b09897
  - [BlueZ,3/7] bass: Store Broadcast ID inside assistant struct
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a426c3617109
  - [BlueZ,4/7] shared/bass: Add APIs to register bcast src changed cb
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fc9c4f2313b7
  - [BlueZ,5/7] shared/bass: Add additional defines
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=15811387144c
  - [BlueZ,6/7] bass: Implement MediaAssistant Push method
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=117b993f3d68
  - [BlueZ,7/7] assistant: Implement MediaAssistant Push command
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e1aa24a43949

You are awesome, thank you!