# 执行蓝牙 A2DP 接收端功能

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

可以使用 `a2dp_sink_menu` 选项执行 A2DP 接收端功能。

在开始之前，请设置设备并转至如[设置设备的 A2DP 功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/set-up-a2dp.html#set-up-a2dp__section_j44_jzy_kcc_navyanka_08-18-24-2110-52-709)中所述的 A2DP 接收端菜单。

## 连接至 A2DP 接收端

要连接到 A2DP 接收端，请运行以下命令：

    connect <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要连接到具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备，请运行以下命令：

    connect f8:7d:76:9d:9b:6bCopy to clipboard

**示例输出**

connect f8:7d:76:9d:9b:6b
    No session exists for the usecase
    The server answered: obj path: '/org/pulseaudio/ext/pal/loopback/ses_1'
    BT a2dp connect success
    ACL state:0 change with reason 00 for device: f8:7d:76:9d:9b:6b
    Codec Configuration for device f8:7d:76:9d:9b:6b
    Codec type = SBC
    Sample Rate = 44100
    Channel Mode = 2
    A2DP Sink Connected to f8:7d:76:9d:9b:6b
        AVRCP_CTRL_CONNECTED_CB
    <-- getcap rsp message received!
        num_supported:1, rsp_type: 12
        CompanyIDO: 0x6488    
    AVRCP_CTRL_BR_CONNECTED_CB
    <-- getcap rsp message received!
        num_supported:7, rsp_type: 12
        SupportedEvent0: 0x1
        SupportedEvent1: 0x2
        SupportedEvent2: 0x8
        SupportedEvent3: 0x9
        SupportedEvent4: 0x10
        SupportedEvent5: 0x11
        SupportedEvent6: 0x12
    <-- notification message received!
        event_id:1, rsp_type:0
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x0
    <-- notification message received!
        event_id:2, rsp_type:0
        EVENT_TRACK_CHANGED track: 0xff
    <-- notification message received!
        event_id:8, rsp_type:0
        EVENT_APP_SETTING_CHANGED attr_id0: 0x2 attr_value0: 0x1
        EVENT_APP_SETTING_CHANGED attr_id1: 0x3 attr_valuel: 0x1
    <-- notification message received!
        event_id:9, rsp_type:0
        EVENT_NOW_PLAYING_CHANGED
    <-- notification message received!
        event_id:10, rsp_type:0
        EVENT_AVAL_PLAYERS_CHANGED
    <-- notification message received!
        event_id:11, rsp_type:0
        EVENT_ADDR_PLAYER_CHANGED player_id: 0x1 uid_counter: 0x0
    ^[S Processing event 441 in state 1
     current State = 1, new state = 2Copy to clipboard

## 播放音频文件

要在远程设备上播放音频文件，请运行以下命令：

    play <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要在具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备上播放音频文件，请运行以下命令：

    play f8:7d:76:9d:9b:6bCopy to clipboard

**示例输出**

***********************************************
    play f8:7d:76:9d:9b:6b
    ***********************************************
    Recieved Start from Src device
    ***********************************************
    <-- notification message received!    
        event_id:1, rsp_type:1
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x1
    <-- notification message received!
        event_id:2, rsp_type:1
        EVENT_TRACK_CHANGED track: 0x0
    <-- notification message received!
        event_id:1, rsp_type:0
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x1
    <-- notification message received!
        event_id:2, rsp_type:0
        EVENT_TRACK_CHANGED track: 0x0
    btsink_enable=1 successCopy to clipboard

## 暂停音频播放

要暂停音频播放，请运行以下命令：

    pause <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要暂停具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备上的音频播放，请运行以下命令：

    pause f8:7d:76:9d:9b:6bCopy to clipboard

**示例输出**

pause f8:7d:76:9d:9b:6b
    <-- notification message received!
        event_id:1, rsp_type:1
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x0
    <-- notification message received!
        event_id:2, rsp_type:1
        EVENT_TRACK_CHANGED track: 0xff
    <-- notification message received!
        event_id:1, rsp_type:0
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x0
    <-- notification message received!
        event_id:2, rsp_type:0
        EVENT_TRACK_CHANGED track: 0xff
    ****************************************************
    Recieved Suspend from Src device
    ****************************************************
    btsink enable=0 successCopy to clipboard

## 停止音频播放

要停止音频播放，请运行以下命令：

    stop <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要停止具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备上的音频播放，请运行以下命令：

    stop f8:7d:76:9d:9b:6bCopy to clipboard

**示例输出**

stop f8:7d:76:9d:9b:6b
    <-- notification message received!
        event_id:1, rsp_type:1
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x0
    <-- notification message received!
        event_id:2, rsp_type:1
        EVENT_TRACK_CHANGED track: 0xff
    <-- notification message received!
        event_id:1, rsp_type:0
        EVENT_PLAYBACK_STATUS_CHANGED play_status: 0x0
    <-- notification message received!
        event_id:2, rsp_type:0
        EVENT_TRACK_CHANGED track: 0xffCopy to clipboard

## 倒回音频播放

要倒回音频播放，请运行以下命令：

    rewind <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要在具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备上倒回音频播放，请运行以下命令：

    rewind f8:7d:76:9d:9b:6bCopy to clipboard

## 增大音量

要将音量增大一级，请运行以下命令：

    volup <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要增大具有蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备的音量，请运行以下命令：

    volup f8:7d:76:9d:9b:6bCopy to clipboard

## 减小音量

要将音量减小一级，请运行以下命令：

    voldown <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要降低蓝牙地址 `f8:7d:76:9d:9b:6b` 的远程设备的音量，请运行以下命令：

    voldown f8:7d:76:9d:9b:6bCopy to clipboard

## 设置音量大小

要设置音量大小，请运行以下命令：

    volchangednoti <vol level(0-15)>Copy to clipboard

**参数**

`<vol level(0-15)>` 是音量大小。范围从 0 到 15。

**示例**

要将绝对音量设置为 10 级，可运行以下命令：

    volchangednoti 10Copy to clipboard

**示例输出**

volchangednoti 10
    btsink_volume=10 set successfully
    volchangednoti 15
    btsink_volume=15 set successfullyCopy to clipboard

## 静音

要静音，请运行以下命令：

    mute <bt_address>Copy to clipboard

**参数**

`<bt_address>` 是远程设备的蓝牙地址。

**示例**

要将蓝牙地址为 `f8:7d:76:9d:9b:6b` 的远程设备的设为静音，请运行以下命令：

    mute f8:7d:76:9d:9b:6bCopy to clipboard

## 设置 codec 优先级

要设置接收端的 codec 优先级，请运行以下命令：

    codec_list <codec1,param1,param2,codec2,param1,param2,....>Copy to clipboard

**参数**

`<codec1,param1,param2,codec2,param1,param2,....>` 是优先级顺序。

**示例**

要将第一优先级设置为 SBC 44.1 kHz，将第二优先级设置为 SBC 48 kHz，请运行以下命令：

    codec_list sbc,44.1,sbc,48Copy to clipboard

**示例输出**

codec_list sbc,44.1,sbc,48
    Codec List: sbc,44.1,sbc,48
    num_codec_configs = 2Copy to clipboard

注释： 在新连接中应用 codec 的优先级。因此，请在建立连接之前设置 codec 优先级。

## 其他功能

以下与播放器相关的设置取决于远程设备播放器的功能。用户可以根据其远程设备播放器的情况进行配置或摸索这些设置。

- 获取和配置播放器设置
- 了解当前播放器状态
- 将曲目添加至播放列表
- 获取关于当前曲目的详细信息
- 搜索音频文件

**上一级主题：** [高级音频分发配置文件](https://docs.qualcomm.com/doc/80-70017-13SC/topic/set-up-a2dp.html)

Last Published: Jan 23, 2025

[Previous Topic
执行蓝牙 A2DP 发送功能](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/perform-a2dp-source-functions.md) [Next Topic
免提配置文件](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/set-up-hfp.md)