资讯动态

蓝牙btsnoop log,HFP协议连接流程详解,以及RFCOMM连接和常用AT指令

发布时间:2026/8/6 17:37:50 来源:尧图企业网站定制
HFPHands-Free蓝牙免提协议,两个角色AGHF端AG端通常是手机设备HF免提端一般为耳机车载等hfp的连接首先要进行SDP然后建立RFCOMM然后SLC连接完成HFP正式建立成功inbandring tone同步响铃功能支持inbandring在电话响铃时会直接建立sco通过sco播放手机端铃声不支持inbandring则只会发ring给到耳机播放自带铃声 叮叮叮~SCO区别于ACLsco是另一条物理链路用来同步传输实时语音数据HFP两个角色音频网关AG端HF免提端在配对认证完成后L2CAP发起SDPAG端去问询对端设备HF端支持的版本和featuresHFP建立连接需要在RFCOMM连接的基础上,L2CAP先发起RFCOMM的连接3.RFCOMM帧类型RFCOMM基于GSM TS 07.10这是一种由GSM手机使用的一种非对称协议可以将多个数据流复用到同一个物理串行电缆上。RFCOMM是对称的使用TS 07.10特征帧和命令的子集通过L2CAP发送TS 07.10帧。TS 07.10的一些功能适用于蓝牙。RFCOMM使用帧进行通信RFCOMM帧作为L2CAP数据包中的有效负载数据。有五种不同的帧类型• SABM—Start Asynchronous Balanced Mode (startup command). 设置异步平衡模式• UA—Unnumbered Acknowledgement (response when connected). 未编号的确认信息• DISC—Disconnect (disconnect command). 断开连接• DM—Disconnected Mode (response to a command when disconnected). 断开连接模式• UIH—Unnumbered Information with Header check. 未编号的带校验头的信息SABM, UA, DM和 DISC是底层的控制帧RFCOMM使用信道每个信道有一个数据连接链路标识(DLCI)UIH帧上的 DLCI 0时用作发送控制信息 DLCI≠0时用作发送数据。RFCOMM详细介绍:原文链接RFCOMM简单介绍_cmax098的博客-CSDN博客4.RFCOMM第一个控制帧是SABM之后对端UA响应UIH进行参数协商然后第二帧SABM进行数据链路的连接然后RFCOMM建立完成5.基于RFCOMM的连接HFP进行AT指令的交互首先是ATBRSFHF端告诉AG端支持哪些featuresEC and/or NR function: Supported (echo canceling and noise reduction functions)AG端回声消除和噪音减弱 可以通过ATNREC 0关闭Call waiting or 3-way calling: Supported 三方电话CLI presentation capability: Supported CLIP来电显示Voice recognition activation: Supported 语音识别Remote volume control: Supported 通话音量调节Enhanced call status: Supported 电话状态Enhanced call control: Not SupportedCodec negotiation: Supported 编码协商HF Indicators: SupportedeSCO S4: Supported6.BRSF AG端回复HFP所支持featuresThree-way calling: SupportedEC and/or NR function: SupportedVoice recognition function: SupportedIn-band ring tone capability: Not Supported 同步响铃功能Attach a number to a voice tag: Not SupportedAbility to reject a call: SupportedEnhanced call status: SupportedEnhanced call control: Not SupportedExtended error result codes: SupportedCodec negotiation: SupportedHF Indicators: SupportedeSCO S4: Supported7.ATBAC 1,2. 通话sco支持的编码cvsd 8kmsbc 16k8.ATCIND? AT Command: Get supported indicators, 问询AG支持各种指示灯状态下的值范围Indicators SupportedCall Status indicatorValues it can take: 0,1Call Setup indicatorRange of values it can take: 0-3Service availability indicatorRange of values it can take: 0-1Signal indicatorRange of values it can take: 0-5Roaming indicatorValues it can take: 0,1Battery charge indicatorRange of values it can take: 0-5Call Held indicatorRange of values it can take: 0-29.ATCIND? AT Command: Get indicators status 问询当前AG端当前各个指示灯状态值Indicators StatusCall Status: No calls in progressCall Setup: Not currently in call set upService availability: No service. No Home/Roam network available.Signal indicator: Signal strength level 0Roaming indicator: Roaming is not activeBattery charge indicator: Level 2Call Held indicator: No calls held10.ATCMER3, 0, 0, 1.Activates indicator status reporting 激活AG端通话状态报告11.ATCHLD?.Retrieve Three way calling Info 获取AG端三方电话信息12.ATBIND …HF 告知 AG 其支持指示器特性13.ATBIND? HF 向 AG 询问 AG 所支持的HF指示器信息以上指令交互完成后HFP SLC(service level connection)建立完成HFP连接完成14.其它常用AT指令ATNREC 0 关闭回声消除和噪音减弱ATBIEV *,* HF端蓝牙电量ATVGS 12 0-15 HF端speaker音量等级ATVGM 12 (0-15) HF端mic送花音量等级ATCLIP 1 开启来电显示ATCCWA 1 AT Command: Enable call waiting notificationATA 接听电话ATCHUP 挂断电话ATBCS 2 sco编码协商时选择第二个编码msbc.......15.AG端ciev状态值CIEV:1,0 挂断电话或无活跃的通话CIEV:1,1 接听电话CIEV:2,0 当前没有等待的电话需要处理CIEV:2,2 拨打电话CIEV:2,3 已拨通....16.sco通话的建立流程先ATBCS进行编码协商Command: HCI_Enhanced_Setup_Synchronous_ConnectionEvent: HCI_Synchronous_Connection_Complete端开的话看对应连接的Connection_Handle

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价