# 免提 Profile (Hands-Free Profile)

HFP 定义音频网关设备如何连接至免提设备以实现远程控制和音频连接等功能。

要执行 HFP 客户端或音频网关功能，您必须首先完成以下过程中的步骤。

## 设置设备的 HFP 功能

**前提条件**

- 启用 SSH 以访问您的主机设备。有关说明，请参阅[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html#use-ssh)。
- 将 DUT 和远程设备放置在蓝牙附近。

**步骤**

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

ssh root@<device_IP_address>
        Copy to clipboard

    **示例**

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

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

oelinux123
        Copy to clipboard
3. 根据需要配置 DUT 的 HFP [客户端](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-hfp.html#section-nlh-q3v-mcc-navyanka-08-25-24-1246-29-767)或[音频网关](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-hfp.html#section-jgk-r3v-mcc-navyanka-08-25-24-1246-49-237)功能。

## 配置 DUT 的 HFP 客户端功能

在[初始设备设置](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-hfp.html#section-rmp-dgv-mcc-navyanka-08-25-24-1227-32-765)以使用 HFP 功能后，请对 HFP 客户端执行以下操作：

1. 通过在 SSH 中运行以下命令来验证 ofono 服务的状态：

systemctl status ofono
        Copy to clipboard
2. 在文本编辑器中打开 `/etc/pulse/` 目录中的 pulse 配置文件 `system.pa`。
3. 将 `headset=ofono` 添加至文件中的以下行：

Load module bluetooth discover
        load-module module-bluetooth-discover headset=ofono
        Copy to clipboard

    该文件必须如下所示：

### Load module bluetooth discover
        load-module module-bluetooth-discover headset=ofono
        
        ### Load module bluetooth policy
        load-module module-bluetooth-policy
        sh-5.1#
        Copy to clipboard
4. 保存该文件。
5. 通过运行以下命令重新加载守护进程：

systemctl daemon-reload
        Copy to clipboard
6. 通过运行以下命令重新启动 PulseAudio：

systemctl restart pulseaudio
        Copy to clipboard

    重新加载守护程序并重新启动 PulseAudio 后，`system.pa` 配置文件中的更改会在系统中反映。PulseAudio 使用 DBUS 与 ofono 建立连接。
7. 通过在 SSH 中运行以下命令来运行 `bluetoothctl`：

bluetoothctl
        Copy to clipboard
8. 通过从 `bluetoothctl` 菜单运行以下命令，验证免提客户端设备的 UUID 是否出现在列表中：

show
        Copy to clipboard

    **示例输出**

[bluetooth]# show
        Controller 22:22:9B:2C:79:1E (public)
           Name: qcm6490
           Alias: qcm6490
           Class: 0x002c0000
           Powered: yes
           Discoverable: no
           DiscoverableTimeout: 0x000000b4
           Pairable: yes
           UUID: A/V Remote Control        (e000110e-0000-1000-8000-00805f9b34fb)
           UUID: PnP Information           (e0001200-0000-1000-8000-00805f9b34fb)
           UUID: Audio Source              (e000110a-0000-1000-8000-00805f9b34fb)
           UUID: Audio Sink                (e000110b-0000-1000-8000-00805f9b34fb)
           UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
           UUID: Generic Access Profile    (e0001800-0000-1000-8000-00805f9b34fb)
           UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
           UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
           UUID: Handsfree                 (e000111e-0000-1000-8000-00805f9b34fb)
           Modalias: usb:v1D6Bp0246d0541
           Discovering: no
           Roles: central
           Roles: peripheral
        Advertising Features:
           ActiveInstances: 0x00 (0)
           SupportedInstances: 0x10 (16)
           SupportedIncludes: tx-power
           SupportedIncludes: appearance
           SupportedIncludes: local-name
           SupportedSecondaryChannels: 1M
           SupportedSecondaryChannels: 2M
           SupportedSecondaryChannels: Coded
        [bluetooth]#
        Copy to clipboard

Note

未列出免提音频网关和耳机 UUID。列表中仅显示从 PulseAudio 配置的免提客户端 UUID。
9. 在 SSH 中运行以下命令打开 `ofono/test` 菜单：

ls -rt /usr/lib/ofono/test
        Copy to clipboard

Note

`ofono/test` 应用程序仅在 `qcom-multimedia-test-image` 中可用。要在您的版本上运行 `ofono/test` 应用程序，您必须对其进行编译。

    **示例输出**

sh-5.1# ls -rt /usr/lib/ofono/test
        unlock-pin                 set-ddr                     hangup-call
        test-stk-menu              set-context-property        hangup-all
        test-ss-control-cs         set-cbs-topics              hangup-active
        test-ss-control-cf         set-call-forwarding         get-tech-preference
        test-ss-control-cb         send-vcard                  get-serving-cell-info
        test-ss                    send-vcal                   get-operators
        test-sms                   send-ussd                   get-icon
        test-smart-messaging       send-sms                    enter-pin
        test-serving-cell-info     scan-for-operators          enable-throttling
        test-push-notification     reset-pin                   enable-modem
        test-phonebook             remove-contexts             enable-gprs
        test-network-registration  release-and-swap            enable-cbs
        test-modem                 release-and-answer          display-icon
        test-message-waiting       reject-calls                disable-throttling
        test-gnss                  register-operator           disable-modem
        test-cbs                   register-auto               disable-gprs
        test-call-settings         receive-sms                 disable-call-forwarding
        test-call-forwarding       process-context-settings    dial-number
        test-call-barring          private-chat                deactivate-context
        test-advice-of-charge      online-modem                deactivate-all
        swap-calls                 offline-modem               create-multiparty
        set-use-sms-reports        monitor-ofono               create-mms-context
        set-umts-band              lockdown-modem              create-internet-context
        set-tty                    lock-pin                    change-pin
        set-tech-preference        list-operators              cdma-set-credentials
        set-speaker-volume         list-modems                 cdma-list-call
        set-sms-smsc               list-messages               cdma-hangup
        set-sms-bearer             list-contexts               cdma-dial-number
        set-sms-alphabet           list-calls                  cdma-connman-enable
        set-roaming-allowed        list-applications           cdma-connman-disable
        set-msisdn                 list-allowed-access-points  cancel-ussd
        set-mms-details            initiate-ussd               cancel-sms
        set-mic-volume             ims-unregister              backtrace
        set-lte-property           ims-register                answer-calls
        set-gsm-band               hold-and-answer             activate-context
        set-fast-dormancy          hangup-multiparty
        sh-5.1#
        Copy to clipboard

有关 HFP 客户端功能，请参阅[执行蓝牙 HFP 客户端功能](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-perform-bluetooth-hfp-client-functions.html#bluez-perform-bluetooth-hfp-client-functions)。

## 配置 DUT 的 HFP 音频网关功能

在[初始设备设置](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-hfp.html#section-rmp-dgv-mcc-navyanka-08-25-24-1227-32-765)以实现 HFP 功能后，对 HFP 音频网关执行以下操作：

1. 通过在 SSH 中运行以下命令来运行 `bluetoothctl`：

bluetoothctl
        Copy to clipboard
2. 通过从 `bluetoothctl` 菜单运行以下命令，验证免提音频网关和耳机的 UUID 是否出现在列表中：

show
        Copy to clipboard

    **示例输出**

[bluetooth]# show
        Controller 22:22:9B:2C:79:1E (public)
           Name: qcm6490
           Alias: qcm6490
           Class: 0x006c0000
           Powered: yes
           Discoverable: no
           DiscoverableTimeout: 0x000000b4
           Pairable: yes
           UUID: A/V Remote Control        (0000110a-0000-1000-8000-00805f9b34fb)
           UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
           UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
           UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
           UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
           UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
           UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
           UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
           UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
           UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
           UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
           Modalias: usb:v1D6Bp0246d0541
           Discovering: no
           Roles: central
           Roles: peripheral
        Advertising Features:
           ActiveInstances: 0x00 (0)
           SupportedInstances: 0x10 (16)
           SupportedIncludes: tx-power
           SupportedIncludes: appearance
           SupportedIncludes: local-name
           SupportedSecondaryChannels: 1M
           SupportedSecondaryChannels: 2M
           SupportedSecondaryChannels: Coded
        [bluetooth]# |
        Copy to clipboard

有关 HFP 音频网关功能，请参阅[执行蓝牙 HFP 音频网关功能](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-perform-bluetooth-hfp-ag-functions.html#bluez-perform-bluetooth-hfp-ag-functions)。

**后续步骤**

- [执行蓝牙 HFP 客户端功能](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-perform-bluetooth-hfp-client-functions.html)
可以使用 `bluetoothctl` 菜单和 `ofono/test` 工具执行 HFP 客户端功能。
- [执行蓝牙 HFP 音频网关功能](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-perform-bluetooth-hfp-ag-functions.html)
您可以使用 `bluetoothctl` 菜单和 `paplay` 命令执行 HFP 音频网关功能。

Last Published: Apr 30, 2025

[Previous Topic
执行蓝牙 A2DP 接收端功能](https://docs.qualcomm.com/bundle/publicresource/80-70018-13SC/topics/bluez-perform-bluetooth-a2dp-sink-functions.md) [Next Topic
执行蓝牙 HFP 客户端功能](https://docs.qualcomm.com/bundle/publicresource/80-70018-13SC/topics/bluez-perform-bluetooth-hfp-client-functions.md)