# Hands-Free Profile

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

HFP defines how an audio gateway device can connect to a hands-free device for
        functions like remote control and audio connection.

To perform HFP client or audio gateway functions, you must first complete the steps in
            the following procedure.

## Set up the device for HFP 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 HFP [client](https://docs.qualcomm.com/doc/80-70017-13/topic/set-up-hfp.html#hfp-set-up__section_zbs_5xd_lcc_navyanka_08-19-24-1329-1-355) or [audio
                        gateway](https://docs.qualcomm.com/doc/80-70017-13/topic/set-up-hfp.html#hfp-set-up__section_ycr_vxd_lcc_navyanka_08-19-24-1329-18-280) 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 HFP client or audio gateway menu, as required.
    - To go to the HFP Client Menu, run the
                                following command from the `main_menu`:

            hfp_client_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
             ******************************************
            hfp_client_menu
            ***************** Menu *******************
                     connect<space><bt_address>
                     disconnect<space><bt_address>
                     create_sco<space><bt_address>
                     destroy_sco<space><bt_address>
                     accept_call
                     reject_incoming_call
                     end_active_call
                     hold_active_call
                     unhold_held_call
                     reject_incoming_call_when_active_call_present
                     end_held_call
                     end_active_call_and_accept_waiting_or_held_call
                     swap_calls
                     add_held_call_to_conference
                     end_specified_active_call<space><index of the call>
                     private_consultation_mode<space><index of the call>
                     put_incoming_call_on_hold_when_no_other_call_present
                     accept_held_incoming_call_when_no_other_call_present
                     reject_held_incoming_call_when_no_other_call_present
                     dial<space><phone_number>
                     redial
                     dial_memory<space><memory_location>
                     start_voice_recognition
                     stop_voice_recognition
                     query_current_calls
                     query_operator_name
                     query_subscriber_info
                     mic_volume_control<space><value>
                     speaker_volume_control<space><value>
                     send_dtmf<space><code>
                     disable_nrec_on_AG
                     main_menu
             ******************************************Copy to clipboard

        For HFP client menu functions, see [Perform Bluetooth HFP client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-bluetooth-hfp-client-functions.html).
    - To go to the HFP Audio Gateway Menu, run the
                                following command from the `main_menu`:

            hfp_ag_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
            *******************************************
            hfp_ag_menu
            ****************** Menu ******************
                     connect<space><bt_address>
                     disconnect<space><bt_address>
                     create_sco<space><bt_address>
                     destroy_sco<space><bt_address>
                     voip_call_ind<space><bt_address>
                     end_voip_call<space><bt_address>
                     main_menu
            ******************************************Copy to clipboard

        For HFP audio gateway menu functions, see [Perform Bluetooth HFP audio gateway functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-bluetooth-hfp-ag-functions.html).

## Enable HFP client role

To enable the HFP client 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.

## Enable HFP audio gateway role

To enable the HFP audio gateway 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:
    - `BtHfpAGEnable=true`
    - `BtA2dpSinkEnable=false`
    - `BtA2dpSinkSplitEnable=false`
    - `BtHfClientEnable=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 HFP client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-bluetooth-hfp-client-functions.html)**  

You can perform HFP client functions using the `hfp_client_menu`         options.
- **[Perform Bluetooth HFP audio gateway functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform-bluetooth-hfp-ag-functions.html)**  

You can perform HFP audio gateway functions using the `hfp_ag_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
Perform Bluetooth A2DP sink functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform-a2dp-sink-functions.md) [Next Topic
Perform Bluetooth HFP client functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform-bluetooth-hfp-client-functions.md)