HFP协议分析

news2024/9/20 20:39:24

HFP 全称为Hands-Free Profile,通俗的说就是蓝牙电话协议,可以通过指定好的AT command来控制通话的接听、挂断、拒接等

看协议的一些约定格式

在HFP协议文档里面有一个约定,这里贴出来,每种不同的标识代表不同的意思,后面会用到

“M”表示强制支持

“O”为可选支持

“X”表示排除(用于设备可能支持的功能,但免提功能Profile不能使用这些功能)

“C”表示有条件支持

“N/A”表示不适用(在给定的上下文中没有定义此功能)

image-20230111141121093

协议层级

HFP在协议栈中的层级

image-20230111142108356

image-20230111140235829

HFP协议角色

image-20230111145107279

Audio Gateway (AG) – This is the device that is the gateway of the audio, both for input and output. Typical devices acting as Audio Gateways are cellular phones. 这个就是音频的输入输出角色,一般是手机。 Hands-Free unit (HF) – This is the device acting as the Audio Gateway’s remote audio input and output mechanism. It also provides some remote control means. 这里翻译过来大概就是Audio Gateway的输入输出角色,平常的耳机,车载都属于这类角色

特性支持

image-20230111145715382

image-20230111145802177

机翻有点生硬,对照上面看

image-20230111145934757

上面的表示AG和HF分别支持的功能,如果支持,则需要进行如下的操作

image-20230111150446289

image-20230111150526904

编码要求

image-20230111150744015

具体的可以看HFP官方文档

4 Hands-Free Control Interoperability Requirements

HFP文档的第四章就是对支持功能需要哪些操作的一个细致讲解解释,只对第一个也就是Service Level Connection Establishment 进行分析

Service Level Connection Establishment

首先看一下整体流程,然后一步步解释

image-20230111153307814

建立SLC(Service Level Connection)需要有RFCOMM connection,也就是在HF和AG之间存在RFCOMM connection

HF和AG都可以发起RFCOMM connection的建立。如果AG与HF之间没有RFCOMM会话,则由发起设备先初始化RFCOMM。

RFCOMM连接的建立请参见《Generic Access Profile[5]》章节7.3和《Serial Port Profile[6]》章节3。

Service Level Connection初始化

在RFCOMM connection建立成功后,就可以去执行SLC的初始化

1 Supported features exchange (支持的特性交换)

首先,在初始化过程中,HF向AG发送 AT+BRSF=<HF支持的特征> 命令,通知AG端HF中支持的特征,并使用 +BRSF 结果代码检索AG中支持的特征。

AT+BRSF=<HF supported features bitmap>

Description: Notifies the AG of the supported features available in the HF, and requests information about the supported features in the AG. The supported features shall be represented as a decimal value.

Values: <HF supported features bitmap>: a decimal numeric string, which represents the value of a 32 bit unsigned integer. The 32 bit unsigned integer represents a bitmap of the supported features in

the HF as follows:

image-20230111164611449

其中 bit7 为 V1.6 才添加, bit 7,8,9 是 V1.7 才添加,bit 10,11 是 V1.8 才添加

+BRSF (Bluetooth Retrieve Supported Features)

语法结构: +BRSF: <AG supported features bitmap>

Description: Result code sent by the AG in response to the AT+BRSF command, used to notify the HF what features are supported in the AG. The supported features shall be represented as a decimal value.

Values: <AG supported features bitmap>: a decimal numeric string, which represents the value of a 32 bit unsigned integer. The 32 bit unsigned integer represents a bitmap of the supported features in

the AG as follows:

image-20230111165018843

其中 bit9 为 V1.6 才添加, bit10,11 是 V1.7 才添加, bit 11,12 是 V1.8 才添加

2 Codec Negotiation 编解码协商

其次,在初始化过程中,如果HF支持编解码协商特性,则需要检查AG的AT+BRSF命令响应是否表明其支持编解码协商特性。如果HF和AG都支持编解码器协商特性,HF就应该向AG发送AT+BAC=<HF可用编解码器>命令,通知AG端HF中可用的编解码器

编解码方式, mSBC 就是 WBS(宽带电话, 16KHz)的编解码方式,ID 如下表所示

image-20230111150744015

3 AG Indicators

After having retrieved the supported features in the AG, the HF shall determine which indicators are supported by the AG, as well as the ordering of the supported indicators. This is because, according to the 3GPP 27.007 specification [2], the AG may support additional indicators not provided for by the Hands-Free Profile, and because the ordering of the indicators is implementation specific. The HF uses the AT+CIND=? Test command to retrieve information about the supported indicators and their ordering. Once the HF has the necessary supported indicator and ordering information, it shall retrieve the current status of the indicators in the AG using the AT+CIND? Read command.

After having retrieved the status of the indicators in the AG, the HF shall then enable the "Indicators status update" function in the AG by issuing the AT+CMER command, to which the AG shall respond with OK. As a result, the AG shall send the +CIEV unsolicited result code with the corresponding indicator value whenever a change in service, call, or call setup status occurs. When an update is required for both the call and call setup indicators, the AG shall send the +CIEV unsolicited result code for the call indicator before sending the +CIEV unsolicited result code for the call setup indicator. The HF shall use the information provided by the +CIEV code to update its own internal and/or external indications. Once the "Indicators status update" function has been enabled, the AG shall keep the function enabled until either the AT+CMER command is issued to disable it, or the current Service Level Connection between the AG and the HF is dropped for any reason.

After the HF has enabled the “Indicators status update” function in the AG, and if the “Call waiting and 3- way calling” bit was set in the supported features bitmap by both the HF and the AG, the HF shall issue the AT+CHLD=? test command to retrieve the information about how the call hold and multiparty services are supported in the AG. The HF shall not issue the AT+CHLD=? test command in case either the HF or the AG does not support the "Three-way calling" feature.

整理一下

  1. 发送AT+CIND=?问询支持的Indicators,包括(service/call/callsetup/callheld/signal/roam/battchg ),我们拿到了这个值才能对应的解析 AG 发送给 HF 的+CIEV AT 命令! call的index是1,callsetup的index是2,service的index是3,依次类推

    image-20230111173422598

  2. 发送 AT+CIND?问询各个 indicators 的 status ,就是统一问下各个 indicator 的值, 接着上图问询 AT+CIND?

    image-20230111175205668

各个value代表的意思如下:

image-20230111183552212

image-20230111183611146

  1. 发送 AT+CMER enable 各个 indicators,发送这个后, 如果某一个 indicator 有变化, 那么 AG 就可以发送+CIEV 来告知 AT+CMER 是 Standard event reporting activation/deactivation AT command.说白了就是使能/失能 indicator, 一共有两种格式

    AT+CMER=3,0,0,1 activates “indicator events reporting” .

    AT+CMER=3,0,0,0 deactivates “indicator events reporting” .

    使能之后, AG 可以发送+CIEV 命令来汇报各个 indicator 的变化

    **+CIEV:**Standard “indicator events reporting” unsolicited result code.格式为:

    +CIEV: ,, 举例来说(此部分要根据 AT+CIND=?问询到的index 来解析, 每个 AG 可能 index 不同, 所以代码中有解析 index 的动作, 这个 index 是根据 前面的 index 来讲解) 强调 这个 index 是根据 AT+CIND=?来获取到的, 每个 AG 可能不同的 !!!

    如果后续 AG 发送过来 +CIEV:3,x 那么就是 service 有变化, 值为 x, 来个具体的例子, 如图

image-20230111191023621

  1. 以上三个发送完毕,如果HF和AG都支持三方通话,那么发送AT+CHLD=? 此部分是 HF 问询 AG 三方通话的支持的特性都有哪些,一共有如下特性

    Standard call hold and multiparty handling AT command. In the AT+CHLD=<n> command, this specification only covers values for <n> of 0, 1, 1<idx>, 2, 2<idx>, 3 and 4, where:
    
    - 0 = Releases all held calls or sets User Determined User Busy (UDUB) for a waiting call.
    --> 相当于此时正在通话中, 拒接所有等待中的电话, 告知对方 busy 状态
    
    - 1 = Releases all active calls (if any exist) and accepts the other (held or waiting) call.
    --> 挂断所有在通话中的电话, 接听来电
    
    - 1<idx> = Releases call with specified index (<idx>).Hands-Free Profile / Profile Specification Bluetooth SIG Proprietary Page 86 of 139
    --> 挂断 idx 的通话中的电话
    
    - 2 = Places all active calls (if any exist) on hold and accepts the other (held or waiting) call.
    --> 把所有通话中的电话设置为 hold 状态, 然后接听电话 
    
    - 2<idx> = Request private consultation mode with specified call (<idx>). (Place all calls on hold EXCEPT the call indicated by <idx>.)
    --> 请求接受<idx>标识电话, 让其它电话保持。
    
    - 3 = Adds a held call to the conversation.
    --> 增加一个保持电话到对话中
    
    - 4 = Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer). Support for this value and its associated functionality is optional for the HF.
    --> 连接两个电话并且断开两个电话的订阅。 HF 侧可选。
    
    - Where both a held and a waiting call exist, the above procedures shall apply to the waiting call(i.e., not to the held call) in conflicting situation.

    image-20230111193154762

4 HF Indicators

If the HF supports the HF indicator feature, it shall check the +BRSF response to see if the AG also supports the HF Indicator feature.

If both the HF and AG support the HF Indicator feature, then the HF shall send the AT+BIND= command to the AG to notify the AG of the supported indicators’ assigned numbers in the HF. The AG shall respond with OK.

After having provided the AG with the HF indicators it supports, the HF shall send the AT+BIND=? to request HF indicators supported by the AG. The AG shall reply with the +BIND response listing all HF indicators that it supports followed by an OK.

Once the HF receives the supported HF indicators list from the AG, the HF shall send the AT+BIND? command to determine which HF indicators are enabled. The AG shall respond with one or more +BIND responses. The AG shall terminate the list with OK. (See Section 4.36.1.3).

From this point onwards, the HF may send the AT+BIEV command with the corresponding HF indicator value whenever a change in value occurs of an enabled HF indicator.

The AG may enable or disable the notification of any HF indicator at any time by using the +BIND unsolicited response (See Section 4.36.1.4).

这部分有几个重点:

  1. 如果 HF & AG 都支持 HF Indicators 的 feature,那么 HF 发送 AT+BIND=<HF supported HF indicators>来告知 AG 支持那些 indicator, HFP 的 indicator 一共有两个, 如下图:

    image-20230112094801382

  2. 发送 AT+BIND=?问询 AG 支持哪些 indicator

  3. 发送 AT+BIND?问询 AG 哪些 indicator 是 enable 的

  4. 发送 AT+BIEV 来使能某一个 indicator

到这里,一个SLC连接就算建立了,回看一下流程图

image-20230111153307814

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1135640.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2023年中国高尔夫用品产值、市场规模及细分产品现状分析[图]

高尔夫用品市场是指个人的高尔夫用品&#xff0c;主要包括高尔夫球具、高尔夫球包、高尔夫用球、高尔夫服装、高尔夫鞋、高尔夫帽子、高尔夫手套及相关配件等方面。 随着高尔夫产业的逐步兴起&#xff0c;高尔夫运动受到了越来越多人们的青睐&#xff0c;与此同时&#xff0c;也…

Loop Copilot:AI驱动,小白也能自己生成音乐?

01 项目介绍 Loop Copilot是一个使用自然语言生成音乐的系统。它不仅允许你使用自然语言来生成你想要的音乐风格、节奏或旋律&#xff0c;还支持通过多轮对话对已生成的音乐进行进一步的编辑和修改。包括对生成的音乐进行编辑修改、添加或删除乐器、加入音效等。 02 工作流程…

0027Java程序设计-房屋出租管理系统

文章目录 摘 要目 录系统设计开发环境 摘 要 随着我国市场经济的快速发展和人们生活水平的不断提高&#xff0c;简单的房屋出租服务已经不能满足人们的需求。如何利用先进的管理手段&#xff0c;提高房屋出租的管理水平&#xff0c;是当今社会所面临的一个重要课题。 本文采用…

vue重修之Vuex【上部】

文章目录 版权声明Vuex 概述Vuex 的主要概念和组件 vuex的使用状态 &#xff08;state&#xff09;Vuex特点 访问vuex中数据$store访问mapState辅助函数访问 开启严格模式及Vuex的单项数据流突变&#xff08;mutations&#xff09;mutations初识带参 mutations辅助函数 mapMuta…

Redis快速上手篇(三)(事务+Idea的连接和使用)

Redis事务 可以一次执行多个命令&#xff0c;本质是一组命令的集合。一个事务中的 所有命令都会序列化&#xff0c;按顺序地串行化执行而不会被其它命令插入&#xff0c;不许加塞。 单独的隔离的操作 官网说明 https://redis.io/docs/interact/transactions/ MULTI、EXEC、…

数据结构,及分类(存储分类、逻辑分类)介绍

一、数据结构&#xff1a; 数据是软件开发的核心。在软件开发过程中基本上就是对数据的新增、删除、修改、查看的操作。 如何合理存储数据&#xff0c;如何有效提升数据操作开发效率&#xff0c;都是软件开发中的重中之重。使用合理的数据结构是非常重要的。 1.1简介&#xff…

【Leetcode】【每日一题】【简单】2520. 统计能整除数字的位数

力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台备战技术面试&#xff1f;力扣提供海量技术面试资源&#xff0c;帮助你高效提升编程技能&#xff0c;轻松拿下世界 IT 名企 Dream Offer。https://leetcode.cn/problems/count-the-digits-that-divide-a…

分享53个ASP.NET源码总有一个是你想要的

分享53个ASP.NET源码总有一个是你想要的 链接&#xff1a;https://pan.baidu.com/s/1xvqgPHSty70VGlQHoy9NYw?pwd8888 提取码&#xff1a;8888 项目名称 ASP.Net 4.5 论坛源码&#xff0c;支持多数据库 Asp.Net Core 3.x博客同步应用案例 ASP.NET Core MVC SqlSugerCore…

安防监控项目---概要

文章目录 前言一、项目需求二、环境介绍三、关键点四、主框架分析总结 前言 各位小伙伴&#xff0c;在蛰伏了将近有半年的时间又要和大家分享新的知识了&#xff0c;这次和大家分享的是一个项目&#xff0c;因此呢我准备分项目阶段去和大家分享&#xff0c;希望大家都能够在每…

如何满足TIKTOK直播企业四大网络需求,轻松实现直播无卡顿?

说到企业海外直播&#xff0c;大家脑海里一下就想会想到当下爆火的TIKTOK平台&#xff0c;而随着TIKTOK在全球范围大面积铺开推广&#xff0c;不同国家不同市场的活跃用户数纷纷上涨&#xff0c;让更多的电商企业选择在TIKTOK上进行布局获得商机。 对于已布局TIKTOK直播或者待布…

【Linux】开发工具

目录 Linux编译器-gcc/g使用执行命令&#xff1a;我们的.o和库是如何链接的? make/Makefile依赖关系、依赖方法 Linux编译器-gcc/g使用 gcc只能编译c语言&#xff0c;g可以编译c语言也可以编译g 背景知识&#xff1a; 预处理&#xff08;进行宏替换)编译&#xff08;生成汇编)…

我的Windows10下的WSL的使用经历

微软每年都会举办Build开发者大会&#xff0c;近年来越来越受关注的Linux 子系统Windows Subsystem for Linux&#xff08;WSL&#xff09;已经很完善了&#xff0c;我抱着体验一把的心态&#xff0c;也来使用一下这个功能。 各位新手Linux朋友们&#xff0c;有没有想过怎么在…

ubuntu18.4(后改为20.4)部署chatglm2并进行基于 P-Tuning v2 的微调

下载驱动 NVIDIA显卡驱动官方下载地址 下载好对应驱动并放在某个目录下&#xff0c; 在Linux系统中安装NVIDIA显卡驱动前,建议先卸载Linux系统自带的显卡驱动nouveau。 禁用nouveau 首先&#xff0c;编辑黑名单配置。 vim /etc/modprobe.d/blacklist.conf 在文件的最后添加…

Python实现【亚马逊商品】数据采集

亚马逊作为最大的跨境电商平台之一&#xff0c;其产品一直备受关注&#xff0c;因此采集亚马逊产品功能也是部分卖家所需的&#xff0c;下面我们来了解一下采集亚马逊产品是如何操作的。 l 采集网站 【场景描述】采集亚马逊搜索关键词出来的商品信息。 【入口网址】https://…

MES系统在工业生产中的重要性与功能

MES系统在工业生产中的重要性体现在它的信息化管理能力。传统的生产管理方法主要依靠人工操作和纸质文档记录&#xff0c;效率低下且容易出错。而MES系统利用计算机技术和数据库管理&#xff0c;能够实时记录和监控生产数据&#xff0c;提供准确的生产情况分析报告&#xff0c;…

2023年中国高尔夫服饰市场规模、主要品牌及行业发展方向分析[图]

高尔夫服饰是指高尔夫运动的专用服饰&#xff0c;高尔夫运动作为商务交流的手段和工具&#xff0c;具有较强的商务属性&#xff0c;高尔夫服饰除了具备专业功能属性以外&#xff0c;具备较强的时尚性&#xff0c;适合于商务、日常、休闲等多场景穿戴。高尔夫服饰里的主要类别&a…

快速上手视频下载助手:简单操作,高效下载你心仪的影片

在如今的社交媒体时代&#xff0c;视频已成为人们生活中不可或缺的一部分。微信视频号作为新兴的视频平台&#xff0c;吸引了越来越多的用户。然而&#xff0c;与其他视频平台相比&#xff0c;微信视频号并不支持视频下载功能&#xff0c;给用户带来了不便。但是&#xff0c;不…

React之Jsx如何转换成真实DOM

一、是什么 react通过将组件编写的JSX映射到屏幕&#xff0c;以及组件中的状态发生了变化之后 React会将这些「变化」更新到屏幕上 在前面文章了解中&#xff0c;JSX通过babel最终转化成React.createElement这种形式&#xff0c;例如&#xff1a; <div>< img src&q…

Vue 2 生命周期与 Vue 3 生命周期:介绍与差别对比

目录 引言&#xff1a; 一、Vue 2 生命周期介绍&#xff1a; 二、Vue 3 生命周期介绍&#xff1a; 注册周期钩子​ 生命周期图示 生命周期 三、Vue 2 生命周期与 Vue 3 生命周期的差别对比&#xff1a; 引言&#xff1a; Vue.js 是一款流行的 JavaScript 框架&#xff0…