# 高级音频分发配置文件

Source: [https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-a2dp.html](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-a2dp.html)

A2DP 定义了如何通过蓝牙连接将多媒体音频从一台设备传输至另一台设备。这种机制也称为蓝牙音频流。

要执行 A2DP 的发送或接收功能，必须首先完成以下过程中的步骤。

## 设置设备的 A2DP 功能

**前提条件**

- 启用 SSH 以访问您的主机设备。相关说明，可参见[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
- 配对 DUT 和远程设备。相关说明，可参见[与远程蓝牙设备配对](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-gap-functions.html#bluez-perform-bluetooth-gap-functions__section_h4c_1bs_lcc_navyanka_08-21-24-1205-46-507)。
- 将 DUT 和远程设备放置在蓝牙附近。

**步骤**

1. 在命令提示符下使用以下命令运行 SSH： 

        ssh root@<device_IP_address>Copy to clipboard

    **示例**

如果设备的 IP 地址为 `10.92.160.222`，则运行以下命令：

        ssh root@10.92.160.222Copy to clipboard
2. 输入以下密码来连接 SSH： 

        oelinux123Copy to clipboard
3. 通过运行以下命令打开蓝牙测试应用程序： 

        bluetoothctlCopy to clipboard

    **示例输出**

sh-5.1# bluetoothctl
        Agent registered        uetoothd...
        [CHG] Controller 22:22:F1:C1:99:C0 Pairable: yesCopy to clipboard
4. 根据需要转至 Transport submenu 或 Player
                        submenu。
    - 请从 `bluetoothctl` 运行以下命令，以便转至 Transport
                                submenu。

            menu transportCopy to clipboard

        **示例输出**

[bluetooth]# menu transport
            Menu transport:
            Available commands:
            -------------------
            list                                              List available transports
            show <transport>                                  Transport information
            acquire <transport>                               Acquire Transport
            release <transport>                               Release Transport
            send <transport> <filename>                       Send contents of a file
            receive <transport> [filename]                    Get/Set file to receive
            volume <transport> [value]                        Get/Set transport volume
            back                                              Return to main menu
            version                                           Display version
            quit                                              Quit program
            exit                                              Quit program
            help                                              Display help about this program
            export                                            Print environment variablesCopy to clipboard

        要在源中执行 Transport submenu 功能，请参阅[执行蓝牙 A2DP 发送功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-a2dp-source-functions.html)。

        要在接收端中执行 Transport submenu
                                    功能，请参阅[执行蓝牙 A2DP 接收端功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-a2dp-sink-functions.html)。
    - 请从 `bluetoothctl` 运行以下命令，以便转至 Player
                                submenu。

            menu playerCopy to clipboard

        **示例输出**

[bluetooth]# menu player
            Menu player:
            Available commands:
            -------------------
            list                                              List available players
            show [player]                                     Player information
            select <player>                                   Select default player
            play [item]                                       Start playback
            pause                                             Pause playback
            stop                                              Stop playback
            next                                              Jump to next item
            previous                                          Jump to previous item
            fast-forward                                      Fast forward playback
            rewind                                            Rewind playback
            equalizer <on/off>                                Enable/Disable equalizer
            repeat <singletrack/alltrack/group/off>           Set repeat mode
            shuffle <alltracks/group/off>                     Set shuffle mode
            scan <alltracks/group/off>                        Set scan mode
            change-folder <item>                              Change current folder
            list-items [start] [end]                          List items of current folder
            search <string>                                   Search items containing string
            queue <item>                                      Add item to playlist queue
            show-item <item>                                  Show item information
            back                                              Return to main menu
            version                                           Display version
            quit                                              Quit program
            exit                                              Quit program
            help                                              Display help about this program
            export                                            Print environment variablesCopy to clipboard

        要在接收端中执行 Player submenu 功能，请参阅[执行蓝牙 A2DP 接收端功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-a2dp-sink-functions.html)。

- **[执行蓝牙 A2DP 发送功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-a2dp-source-functions.html)**  

用户可以使用 `bluetoothctl` 菜单、 `menu transport` 子菜单和 `paplay` 命令执行蓝牙 A2DP 发送功能。
- **[执行蓝牙 A2DP 接收端功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/bluez-perform-bluetooth-a2dp-sink-functions.html)**  

用户可以使用 `bluetoothctl` 菜单、 `menu transport` 子菜单和 `menu player` 子菜单执行蓝牙 A2DP 接收端功能。

**上一级主题：** [验证 BlueZ 堆栈的功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/verify-bluetooth-functionality-of-bluez-stack.html)

Last Published: Jan 23, 2025

[Previous Topic
执行蓝牙 HOGP 功能](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/bluez-perform-bluetooth-hogp-functions.md) [Next Topic
执行蓝牙 A2DP 发送功能](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/bluez-perform-bluetooth-a2dp-source-functions.md)