# 执行蓝牙 HFP 客户端功能

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

可以使用 `hfp_client_menu` 选项执行 HFP 客户端功能。

在开始之前，请设置设备并转至如[设置设备的 HFP 功能](https://docs.qualcomm.com/doc/80-70017-13SC/topic/set-up-hfp.html#hfp-set-up__section_w52_kvd_lcc_navyanka_08-19-24-1310-42-670)中所述的 HFP 客户端菜单。

## 连接至 HFP 客户端设备

要连接到 HFP 客户端设备，请运行以下命令：

    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
     Processing event 405 in state 1
    connecting with device f8:7d:76:9d:9b:6b
     current State = 1, new state = 2
     Processing event 441 in state 2
    network state is available
    no call is in progress
    no call in setup
    battery level is 3
    signal level is 2
    AG is in home network
    no held call
     Processing event 439 in state 2
    in-band ringtone provided
     Processing event 442 in state 2
    SLC connected with device f8:7d:76:9d:9b:6b
     current State = 2, new state = 3Copy to clipboard

## 创建 SCO 链接

请运行以下命令，以便创建 SCO 链接：

    create_sco <bt_address>Copy to clipboard

**参数**

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

**示例**

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

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

## 接听来电

要接听来电，请运行以下命令：

    accept_callCopy to clipboard

**示例输出**

accept_call
     Processing event 409 in state 4
    a call is in progress
    no call in setup
     Processing event 439 in state 4Copy to clipboard

## 拒接来电

要拒绝来电，请运行以下命令：

    reject_incoming_callCopy to clipboard

**示例输出**

reject_incoming_call
     Processing event 410 in state 4
    no call in setup
     Processing event 439 in state 4
     Processing event 444 in state 4
     current mode = 2, new mode = 0
     current State = 4, new state = 3
    set param hfp_enable=false success
    BT disconnect is success for SCO usecase
    Disconnected SCO connection with device f8:7d:76:9d:9b:6bCopy to clipboard

## 结束当前通话

要结束当前通话，请运行以下命令：

    end_active_callCopy to clipboard

**示例输出**

end_active_call
     Processing event 411 in state 4
     Processing event 444 in state 4
     current mode = 2, new mode = 0
     current State = 4, new state = 3
    no call is in progress
    set param hfp_enable=false success
    BT disconnect is success for SCO usecase
    Disconnected SCO connection with device f8:7d:76:9d:9b:6bCopy to clipboard

## 拨打电话号码

要拨打电话号码，请运行以下命令：

    dial <phone_number>Copy to clipboard

**参数**

`<phone_number>` 是您打算拨打的电话号码。

**示例输出**

dial 7123456789
     Processing event 422 in state 3
    Outgoing call is in setup
     Processing event 447 in state 3
    SCO/eSCO connected with device f8:7d:76:9d:9b:6b
    Connected state: Requesting for focus
     current mode = 0, new mode = 2
     current State = 3, new state = 4
     Processing event 252 in state 4
    earlier status = 1 new status = 2
    Configure audio for SCO
    No session exists for the usecase
    The server answered: obj path: '/org/pulseaudio/ext/pal/loopback/ses_2'
    BT connect is success for SCO usecase
    set param- hfp_enable=true success
    Outgoing call in alerting stateCopy to clipboard

## 重拨电话号码

要重拨电话号码，请运行以下命令：

    redialCopy to clipboard

**示例输出**

redial
     Processing event 423 in state 3
    Outgoing call is in setup
     Processing event 447 in state 3
    SCO/eSCO connected with device f8:7d:76:9d:9b:6b
    Connected state: Requesting for focus
     current mode = 0, new mode = 2
     current State = 3, new state = 4
     Processing event 252 in state 4
    earlier status = 1 new status = 2
    Configure audio for SCO
    No session exists for the usecase
    The server answered: obj path: '/org/pulseaudio/ext/pal/loopback/ses_2'
    BT connect is success for SCO usecase
    set param- hfp_enable=true success
    Outgoing call in alerting state
    no call in setup
     Processing event 439 in state 4
     Processing event 444 in state 4
     current mode = 2, new mode = 0 
     current State = 4, new state = 3
    set param hfp_enable=false success
    BT disconnect is success for SCO usecase
    Disconnected SCO connection with device f8:7d:76:9d:9b:6bCopy to clipboard

## 保持通话

要保持通话，请运行以下命令：

    hold_active_callCopy to clipboard

**示例输出**

hold_active_call
     Processing event 412 in state 4
    a call is on hold, no active callsCopy to clipboard

## 取消保持通话

要取消保持通话，请运行以下命令：

    unhold_held_callCopy to clipboard

**示例输出**

unhold_held_call
     Processing event 412 in state 4
    no held callCopy to clipboard

## 结束保持的通话

要结束保持的通话，请运行以下命令：

    end_held_callCopy to clipboard

**示例输出**

end_held_call
     Processing event 413 in state 4
     Processing event 444 in state 4
     current mode = 2, new mode = 0
     current State = 4, new state = 3
    set param hfp_enable=false success
    BT disconnect is success for SCO usecase
    Disconnected SCO connection with device f8:7d:76:9d:9b:6b
    no call is in progressCopy to clipboard

## 通话期间拒接来电

要在通话过程中拒绝来电，请运行以下命令：

    reject_incoming_call_when_active_call_presentCopy to clipboard

## 开始语音识别

要启动语音识别，请运行以下命令：

    start_voice_recognitionCopy to clipboard

**示例输出**

start_voice_recognition
     Processing event 425 in state 3
    volume_change_cb : speaker volume is 4
     Processing event 433 in state 3
     Processing event 447 in state 3
    SCO/eSCO connected with device f8:7d:76:9d:9b:6b
    Connected state: Requesting for focus
     current mode = 0, new mode = 2
     current State = 3, new state = 4
     Processing event 252 in state 4
    earlier status = 1 new status = 2
    Configure audio for SCO
    No session exists for the usecase
    The server answered: obj path: '/org/pulseaudio/ext/pal/loopback/ses_2'
    BT connect is success for SCO usecase
    set param- hfp_enable=true success
    signal level is 2Copy to clipboard

## 停止语音识别

要停止语音识别，请运行以下命令：

    stop_voice_recognitionCopy to clipboard

**示例输出**

stop_voice_recognition
     Processing event 426 in state 4
     Processing event 444 in state 4
     current mode = 2, new mode = 0
     current State = 4, new state = 3
    set param hfp_enable=false success
    BT disconnect is success for SCO usecase
    Disconnected SCO connection with device f8:7d:76:9d:9b:6bCopy to clipboard

## 获取运营商名称

请运行以下命令，以便获取运营商名称：

    query_operator_nameCopy to clipboard

**示例输出**

query_operator_name
     Processing event 429 in state 3
    operator name is IND airtelCopy to clipboard

## 获取用户信息

如需获取用户信息，请运行以下命令：

    query_subscriber_infoCopy to clipboard

**示例输出**

query_subscriber_info
     Processing event 430 in state 3
    subscriber name is 917123456789 type is voiceCopy to clipboard

## 断开 HFP 客户端设备的连接

要断开 HFP 客户端设备的连接，请运行以下命令：

    disconnect <bt_address>Copy to clipboard

**参数**

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

**示例**

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

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

**示例输出**

disconnect f8:7d:76:9d:9b:6b
     Processing event 406 in state 3
    Disconnecting with device f8:7d:76:9d:9b:6b
     current State = 3, new state = 2
     Processing event 437 in state 2
    Disconnected from or Unable to connect with device f8:7d:76:9d:9b:6b
     current State = 2, new state = 1Copy to clipboard

## 其他功能

HFP 客户端菜单提供其他功能，使用户能够：

- 交换呼叫
- 验证电话会议
- 访问最近拨打的电话号码
- 控制扬声器和麦克风的音量
- 发送 DTMF 代码

**上一级主题：** [免提配置文件](https://docs.qualcomm.com/doc/80-70017-13SC/topic/set-up-hfp.html)

Last Published: Jan 23, 2025

[Previous Topic
免提配置文件](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/set-up-hfp.md) [Next Topic
执行蓝牙 HFP 音频网关功能](https://docs.qualcomm.com/bundle/publicresource/80-70017-13SC/topics/perform-bluetooth-hfp-ag-functions.md)