【蓝牙专题】HFP协议解析

【蓝牙专题】HFP协议解析本文详细介绍了 HFP1 6 协议 包括其定义 角色配置 支持的编解码和 AT 命令 以及通信流程 如 ServiceLevel 和 Release 过程

大家好,欢迎来到IT知识分享网。

一、概念

1、依赖关系:

【蓝牙专题】HFP协议解析

【蓝牙专题】HFP协议解析

2、配置和角色

注:HFP并没有master与slave的区分,在建立HFP通信前,LMP link是必须的;

3、支持的功能

其中编解码方式可以看到CVSD是必须支持的,mSBC不是必须支持的,

【蓝牙专题】HFP协议解析

4、AT command 

HFP使用AT command的子集来发送命令;

(1)格式HFP中通过AT command来发送命令,响应,我们来看下命令格式说明:

【蓝牙专题】HFP协议解析

(2)HFP AT command命令子集如下图:

序号

命令参数

说明

1

ATA

Standard call answer AT command.

2

ATDdd…dd

Standard AT command intended for placing a call to a phone number

3

ATD>nnn

Extension of the standard ATD command, intended for memory dialing

4

ERROR

Standard error indication code

5

OK

Standard acknowledgement to the execution of a command

6

NO CARRIER, BUSY, NO ANSWER, DELAYED, BLACKLISTED

Extended response indication codes for AT commands.

7

RING

Standard ―incoming call‖ indication

8

AT+CCWA

Standard ―Call Waiting notification‖ AT command.

+CCWA

Standard ―Call Waiting notification‖ unsolicited result code.

AT+CHLD

Standard call hold and multiparty handling AT command.

AT+CHUP

Standard hang-up AT command. Execution command causes the AG to terminate the currently active call.

AT+CIND

Standard indicator update AT command.

+CIND

Standard list of current phone indicators

AT+CLCC

Standard list current calls command.

+CLCC

Standard list current calls result code.

AT+COPS

The AT+COPS=3,0 shall be sent by the HF to the AG prior to sending the 

AT+COPS? command. AT+COPS=3,0 sets the format of the network operator string 

to the long format alphanumeric.

The AT+COPS? command is used for reading network operator. This profile shall 

only support the “reading” of the name of the network operator. The response to this 

command from the AG shall return a +COPS:<mode>,<format>,<operator> where:

<mode> contains the current mode and provides no information with regard to the 

name of the operator. 

BLUETOOTH SPECIFICATION  Page 80 of 126

Hands-Free Profile 1.6

10 May 2011

<format> specifies the format of the <operator> parameter string, and shall always 

be 0 for this specification.

<operator> specifies a quoted string in alphanumeric format representing the name 

of the network operator. This string shall not exceed 16 characters.

AT+CMEE

Standard AT command used to enable the use of result code +CME ERROR: <err> 

as an indication of an error relating to the functionality of the AG. 

The set command AT+CMEE=1 is covered in this specification.

+CME ERROR

+CME ERROR: 0 – AG failure

+CME ERROR: 1 – no connection to phone 

+CME ERROR: 3 – operation not allowed 

+CME ERROR: 4 – operation not supported 

+CME ERROR: 5 – PH-SIM PIN required 

+CME ERROR: 10 – SIM not inserted

+CME ERROR: 11 – SIM PIN required 

+CME ERROR: 12 – SIM PUK required 

+CME ERROR: 13 – SIM failure 

+CME ERROR: 14 – SIM busy 

+CME ERROR: 16 – incorrect password 

+CME ERROR: 17 – SIM PIN2 required 

+CME ERROR: 18 – SIM PUK2 required 

+CME ERROR: 20 – memory full 

+CME ERROR: 21 – invalid index 

+CME ERROR: 23 – memory failure 

+CME ERROR: 24 – text string too long 

+CME ERROR: 25 – invalid characters in text string

+CME ERROR: 26 – dial string too long 

+CME ERROR: 27 – invalid characters in dial string 

+CME ERROR: 30 – no network service 

+CME ERROR: 31 – network Timeout.

+CME ERROR: 32 – network not allowed – Emergency calls only

AT+CLIP

Standard ―Calling Line Identification notification‖ activation AT command.

+CLIP

Standard ―Calling Line Identification notification‖ unsolicited result code.

AT+CMER

Standard event reporting activation/deactivation AT command.

+CIEV

Standard ―indicator events reporting‖ unsolicited result code.

AT+VTS

Standard DTMF generation AT command. 

AT+CNUM

Syntax: 

AT+CNUM  (Retrieve Subscriber Number Information)

AT+CNUM=?   (Test Subscriber Number Information –

Not Implemented)

Description: 

Command issued by HF for the ―Subscriber Number Information‖ feature in the 

AG.

Only the action command AT+CNUM format is used.

+CNUM

Syntax: 

+CNUM: [<alpha>],<number>, <type>,[<speed> ,<service>]  (Response for 

AT+CNUM)

Description:

Standard Response used for sending the ―Subscriber Number Information‖ from 

AG to HF.

The AG shall send the +CNUM: response for the AT+CNUM from the HF.

Values:

–  <alpha>: This optional field is not supported, and shall be left blank.

–  <number>: Quoted string containing the phone number in the format specified by 

<type>. 

–  <type> field specifies the format of the phone number provided, and can be one 

of the following values:

o  values 128-143: The phone number format may be a national or international 

format, and may contain prefix and/or escape digits. No changes on the 

number presentation are required.

o  values 144-159: The phone number format is an international number, 

including the country code prefix. If the plus sign (“+”) is not included as part 

of the number and shall be added by the AG as needed.

–  values 160-175: National number. No prefix nor escape digits included.

–  <speed>: This optional field is not supported, and shall be left blank.

–  <service>: Indicates which service this phone number relates to. Shall be either 4 

(voice) or 5 (fax).

Example:

+CNUM: ,””,129,,4

二、HFP通信流程

上图中的Table3.1给出了HFP支持的feature,这里我们只看1-7,后面的可以自己去翻下spec;

1、HFP Service Level Connection Establishment

        使用HFP时,第一步就是初始化Service Level Connection Establishment,可以由AG或HF发起;Service Level Connection是基于RFCOMM data link chaanel,流程图如下:

a、可以看到,RFCOMM data link chaanel通道建立后,HFP首先发出AT+BRSF来协商HFP支持的feature,详细见后面AT+BRSF feature的说明;

b、第二步是基于第一步,如果AG和HF都支持Codec Negotiation feature,则发送AT+BAC命令,由HF告知AG支持的codecs;

c、第三步AT+CIND是得到支持的indicators和其顺序;

d、第四步:HF使用AT+CMER使能AG端的“Indicators status update”功能这样AG端就可以主动上报状态的改变,无论是服务,电话等;

e、第五步:如果支持“Call waiting and 3-way calling”feature,则使用AT+CHLD获取信息;

这样,就建立了HFP通信,当发生断链时,HF会在超时后主动再次发起HFP Service Level Connection Establishment连接;

【蓝牙专题】HFP协议解析

我们看下AT+BRSF和BRSF的说明

(1)AT+BRSF (Bluetooth Retrieve Supported Features)

(2)BRSF与AT+BRSF类似;

2、HFP Service Level Connection release

HF和AG都可以发起release,步骤主要是RFCOMM信道的移除;

3、注册状态的传输

当AT+CMER和AT+BIA同时被打开时,AG会主动向HF发送AG’s registration status changes,如下图:

【蓝牙专题】HFP协议解析

4、信号强度事件通知

        当AT+CMER和AT+BIA同时被打开时,AG会主动向HF发送AG’s signal strength changes,如下图:

【蓝牙专题】HFP协议解析

5、其他,同上面两个通知还有AG’s roaming status changes和 AG’s battery level changes,如下面两个图片:

【蓝牙专题】HFP协议解析【蓝牙专题】HFP协议解析

三、总结

        HFP是应用层协议,使用AT command的子集命令来实现自身命令;

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/135697.html

(0)
上一篇 2025-07-02 20:15
下一篇 2025-07-02 20:20

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信