# Hands-Free Profile

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 [Sign in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html#use-ssh).
- Enable HFP [client](https://docs.qualcomm.com/doc/80-70018-13/topic/set-up-hfp.html#section-zbs-5xd-lcc-navyanka-08-19-24-1329-1-355) or [audio gateway](https://docs.qualcomm.com/doc/80-70018-13/topic/set-up-hfp.html#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.222
        Copy to clipboard
2. Connect to the SSH by entering the following password:

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

btapp
        Copy 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_menu
            Copy to clipboard
    2. Enable Bluetooth by running the following command:

enable
            Copy 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 ON
            Copy 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-70018-13/topic/gap_commands.html#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 1
            Copy 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_menu
            Copy 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_menu
            Copy 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-70018-13/topic/perform-bluetooth-hfp-client-functions.html#perform-bluetooth-hfp-client-functions).
    - To go to the **HFP Audio Gateway Menu**, run the following command from the `main_menu`:

hfp_ag_menu
            Copy 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-70018-13/topic/perform-bluetooth-hfp-ag-functions.html#perform-bluetooth-hfp-ag-functions).

## 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.conf` file:

    - `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.conf
        Copy 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.conf` file:

    - `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.conf
        Copy to clipboard

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

**Next steps**

- [Perform Bluetooth HFP client functions](https://docs.qualcomm.com/doc/80-70018-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-70018-13/topic/perform-bluetooth-hfp-ag-functions.html)
You can perform HFP audio gateway functions using the `hfp_ag_menu` options.

Last Published: Apr 02, 2025

[Previous Topic
Perform Bluetooth A2DP sink functions](https://docs.qualcomm.com/bundle/publicresource/80-70018-13/topics/perform-a2dp-sink-functions.md) [Next Topic
Perform Bluetooth HFP client functions](https://docs.qualcomm.com/bundle/publicresource/80-70018-13/topics/perform-bluetooth-hfp-client-functions.md)