# Advanced Audio Distribution Profile

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

A2DP defines how multimedia audio can be streamed from one device to another over a
        Bluetooth connection. This mechanism is also called as Bluetooth audio
        streaming.

To perform A2DP source or sink functions, you must first complete the steps in the
            following procedure.

## Set up device for A2DP functions

**Prerequisites**

- Enable SSH to access your host device. For instructions, see [Log in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh).
- Enable A2DP [source](https://docs.qualcomm.com/doc/80-70017-13/topic/set-up-a2dp.html#set-up-a2dp__section_nbc_4cz_kcc_navyanka_08-18-24-2135-3-71) or [sink](https://docs.qualcomm.com/doc/80-70017-13/topic/set-up-a2dp.html#set-up-a2dp__section_ilx_4cz_kcc_navyanka_08-18-24-2135-17-523) role
                    on the device, as required.
- Place the DUT and the remote device in the Bluetooth vicinity.

**Procedure**

1. Run the SSH in command prompt using the following command: 

        ssh root@<device_IP_address>Copy to clipboard

    **Example**

If the IP address of the device is `10.92.160.222`, run
                            the following command:

        ssh root@10.92.160.222Copy to clipboard
2. Connect to the SSH by entering the following password: 

        oelinux123Copy to clipboard
3. Open the Bluetooth test application by running the following command: 

        btappCopy to clipboard

    **Sample output**

sh-5.1# btapp
         get_ap_interface
        :: get_ap_interface
        
        ***************** Menu *******************
                 gap_menu
                 test_menu
                 a2dp_sink_menu
                 hfp_client_menu
                 gattctest_menu
                 gattstest_menu
                 hogp_menu
                 hfp_ag_menu
                 a2dp_source_menu
                 spp_client_menu
                 spp_server_menu
                 eslap_menu
                 exit
         ******************************************Copy to clipboard
4. Enable Bluetooth and pair the device as follows:
    1. Go to the Gap Menu by running the following
                            command: 

            gap_menuCopy to clipboard
    2. Enable Bluetooth by running the following command: 

            enableCopy to clipboard

        **Sample output**

gap_menu
            
            ***************** Menu *******************
                     enable
                     disable
                     inquiry
                     cancel_inquiry
                     get_role_req<space><bt_address>     eg. get_role_req 00:11:22:33:44:55
                     pair<space><bt_address><space><transport>     eg. pair 00:11:22:33:44:55 0(auto)/1(BREDR)/2(BLE)
                     unpair<space><bt_address>     eg. unpair 00:11:22:33:44:55
                     inquiry_list
                     bonded_list
                     get_state
                     get_bt_name
                     get_bt_address
                     set_bt_name<space><bt name>     eg. set_bt_name MDM_Fluoride
                     set_scan_mode<space><scan mode value (range 0-2)>     eg. set_scan_mode 0 --0-BT_SCAN_MODE_NONE,1- BT_SCAN_MODE_CONNECTABLE,2-BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
                     set_afh<space><AFH_Host_Channel_Classification>     eg. set_afh 112233445566778899f0
                     send_hci_cmd<space><hci_cmd>     eg. send_hci_cmd 01,04,05,33,8b,9e,0a,00 - For Inquiry
                     read_clock<space><which_clock range(0-1)><space><bt_address>     eg. read_clock 0(local)/1(acl connection) 00:11:22:33:44:55
                     main_menu
                     switch_role_req<bt_address><space><new_role>     eg. switch_role_req 00:11:22:33:44:55 0 or get_role_req 00:11:22:33:44:55 1
             ******************************************
            enable
             current State = 0, new state = 1
             BT State is ONCopy to clipboard
    3. Pair the device by running the following command: 

            pair <bt_address> <transport>Copy to clipboard

        To accept the outgoing/incoming pairing, enter
                                    `yes`.

        **Parameters**

        - [Run Bluetooth inquiry scan](https://docs.qualcomm.com/doc/80-70017-13/topic/gap_commands.html#gap_commands__section_iy1_xnf_41c) to get the `<bt_address>` of the remote
                                        device.
        - The values of the `<transport>`parameter
                                        can be:
            - `0`: Auto selection
            - `1`: BR/EDR
            - `2`: Bluetooth Low Energy

        **Example**

To initiate a BR/EDR pairing for `<bt_address>`
                                    `98:09:cf:a9:82:23`, run the following command:

            pair 98:09:cf:a9:82:23 1Copy to clipboard

        **Sample output**

pair 98:09:cf:a9:82:23 1 
             BR/EDR Bonding
             ACL state:0 change with reason 00 for device: f8:7d:76:9d:9b:6b
            ************************************************
             Pairing state for MyDeviceA is BOND NONE
            ************************************************
             BT pairing request :: MyDeviceB :: Pairing Code :: 776996
            ************************************************
            **Please enter yes / no **
            yes
            ************************************************
             Pairing state for MyDeviceB is BONDED
            ************************************************Copy to clipboard
    4. Return to the Main Menu by running the following
                            command: 

            main_menuCopy to clipboard
5. Go to the A2DP source or sink menu, as required.
    - To go to the A2DP Source Menu, run the
                                following command from the `main_menu`:

            a2dp_source_menuCopy to clipboard

        **Sample                                        output**

main_menu
            
            ***************** Menu *******************
                     gap_menu
                     test_menu
                     a2dp_sink_menu
                     hfp_client_menu
                     gattctest_menu
                     gattstest_menu
                     hogp_menu
                     hfp_ag_menu
                     a2dp_source_menu
                     spp_client_menu
                     spp_server_menu
                     eslap_menu
                     exit
             ******************************************
            a2dp_source_menu
            
            ***************** Menu *******************
                     connect<space><bt_address>
                     disconnect<space><bt_address>
                     codec_list<space><codec1,param1,param2....,codec2,param1,param2....>
                     avrcp_trackchange
                     avrcp_now_playing_content_changed
                     avrcp_setabsolutevol<space><volstep>  eg: setabsolutevol 10 (range 0-15)
                     avrcp_sendvolupdown<space><1/0>  eg: sendvolupdown 1 (1-up, 0-down)
                     avrcp_availplayerchange
                     avrcp_biggermetadata info:enables bigger avrcp metadata
                     avrcp_setequalizerval<space><val> (1/2)
                     avrcp_setrepeatval<space><val> (1 to 4)
                     avrcp_setshuffleval<space><val>(1 to 3)
                     avrcp_setscanval<space><val> (1 to 3)
                     set_scmst_cp_flag<space><bd_addr><space><0-2> (0-Copyrighted 1-Only Once 2-Content not protected)
                     main_menu
             ******************************************Copy to clipboard

        For A2DP source menu functions, see [Perform Bluetooth A2DP source functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-a2dp-source-functions.html).
    - To go to the A2DP Sink Menu, run the
                                following command from the `main_menu`:

            a2dp_sink_menuCopy to clipboard

        **Sample                                        output**

main_menu
            
            ***************** Menu *******************
                     gap_menu
                     test_menu
                     a2dp_sink_menu
                     hfp_client_menu
                     gattctest_menu
                     gattstest_menu
                     hogp_menu
                     hfp_ag_menu
                     a2dp_source_menu
                     spp_client_menu
                     spp_server_menu
                     eslap_menu
                     exit
             ******************************************
            a2dp_sink_menu
            
            ***************** Menu *******************
                     connect<space><bt_address>
                     disconnect<space><bt_address>
                     play<space><bt_address>
                     pause<space><bt_address>
                     stop<space><bt_address>
                     rewind<space><bt_address>
                     fastforward<space><bt_address>
                     forward<space><bt_address>
                     backward<space><bt_address>
                     power<space><bt_address>
                     volup<space><bt_address>
                     voldown<space><bt_address>
                     volchangednoti<space><vol level(0-15)>
                     mute<space><bt_address>
                     codec_list<space><codec1,param1,param2,codec2,param1,param2,....>
                     getcap<space><bt_address><space><cap_ID>
                     listplayersettingattr<space><bt_address>
                     listplayersettingvalue<space><bt_address><space><attri_ID>
                     getplayersetting<space><bt_address><space><attri_IDs>
                     setplayersetting<space><bt_address><space><attri_IDs><space><attri_Values>
                     getelementattr<space><bt_address><space><num_attrb><space><attribute_IDs>
                     getplayerstatus<space><bt_address>
                     regnotification<space><bt_address><space><event_ID>
                     setaddressedplayer<space><bt_address><space><player_ID>
                     setbrowsedplayer<space><bt_address><space><player_ID>
                     changepath<space><bt_address><space><direction><space><folder_uID>
                     getfolderitems<space><bt_address><space><scopeID><space><startItem><space><endItem><space><num_attrb><space><attrib_IDs>
                     getitemattributes<space><bt_address><space><scopeID><space><uID><space><uID_Counter><space><num_attrb><space><attrib_IDs>
                     playitem<space><bt_address><space><scopeID><space><uID><space><uID_Counter>
                     addtonowplaying<space><bt_address><space><scopeID><space><uID><space><uID_Counter>
                     search<space><bt_address><space><length><space><string>
                     main_menu
             ******************************************Copy to clipboard

        For A2DP sink menu functions, see [Perform Bluetooth A2DP sink functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-a2dp-sink-functions.html).

## Enable A2DP source role

To enable the A2DP source role on the device, do the following:

1. Open the command prompt.
2. Pull the bt\_app.conf file from the device by running the
                    following command:

        scp -r root@<IP_address>:/etc/bluetooth/bt_app.conf .Copy to clipboard

    `<IP_address>`
                        is the IP address of the device.
3. Configure the following values in the bt\_app.conffile:
    - `BtA2dpSinkEnable=false`
    - `BtA2dpSinkSplitEnable=false`
    - `BtHfClientEnable=false`
    - `BtA2dpSourceEnable=true`
4. Save the bt\_app.conf file.
5. Push the bt\_app.conf file to the device by running the
                    following command:

        scp -r bt_app.conf root@<IP_address>:/etc/bluetooth/bt_app.confCopy to clipboard

    `<IP_address>`
                        is the IP address of the device.

## Enable A2DP sink role

To enable the A2DP sink role on the device, do the following:

1. Open the command prompt.
2. Pull the bt\_app.conf file from the device by running the
                    following command:

        scp -r root@<IP_address>:/etc/bluetooth/bt_app.conf .Copy to clipboard

    `<IP_address>`
                        is the IP address of the device.
3. Configure the following values in the bt\_app.conffile:
    - `BtA2dpSinkEnable=true`
    - `BtA2dpSinkSplitEnable=true`
    - `BtHfClientEnable=true`
    - `BtA2dpSourceEnable=false`
4. Save the bt\_app.conf file.
5. Push the bt\_app.conf file to the device by running the
                    following command:

        scp -r bt_app.conf root@<IP_address>:/etc/bluetooth/bt_app.confCopy to clipboard

    `<IP_address>`
                        is the IP address of the device.

- **[Perform Bluetooth A2DP source functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-a2dp-source-functions.html)**  

You can perform A2DP source functions using the `a2dp_source_menu`         options.
- **[Perform Bluetooth A2DP sink functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-a2dp-sink-functions.html)**  

You can perform A2DP sink functions using the `a2dp_sink_menu`         options.

**Parent Topic:** [Verify functionality of Fluoride stack](https://docs.qualcomm.com/doc/80-70017-13/topic/bluetooth_usecases.html)

Last Published: Dec 26, 2024

[Previous Topic
GATT configuration parameters](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/gatt_config_params.md) [Next Topic
Perform Bluetooth A2DP source functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform-a2dp-source-functions.md)