零. 概述
本文章主要講下電話免提協議HFP(Hands-Free Profile)Phone status information,包括Signal Strength(信號強度),Roaming Status(漫游狀態),Battery Level(電量),Operator Selection(運營商),Transfer of Call, Call Setup and Call Held Status(電話狀態),
本節講解的內容就是一下HFP feature中的NO.2

一. 宣告
本專欄文章我們會以連載的方式持續更新,本專欄計劃更新內容如下:

第一篇:藍牙綜合介紹 ,主要介紹藍牙的一些概念,產生背景,發展軌跡,市面藍牙介紹,以及藍牙開發板介紹,
第二篇:Transport層介紹,主要介紹藍牙協議堆疊跟藍牙芯片之前的硬體傳輸協議,比如基于UART的H4,H5,BCSP,基于USB的H2等
第三篇:傳統藍牙controller介紹,主要介紹傳統藍牙芯片的介紹,包括射頻層(RF),基帶層(baseband),鏈路管理層(LMP)等
第四篇:傳統藍牙host介紹,主要介紹傳統藍牙的協議堆疊,比如HCI,L2CAP,SDP,RFCOMM,HFP,SPP,HID,AVDTP,AVCTP,A2DP,AVRCP,OBEX,PBAP,MAP等等一系列的協議吧,
第五篇:低功耗藍牙controller介紹,主要介紹低功耗藍牙芯片,包括物理層(PHY),鏈路層(LL)
第六篇:低功耗藍牙host介紹,低功耗藍牙協議堆疊的介紹,包括HCI,L2CAP,ATT,GATT,SM等
第七篇:藍牙芯片介紹,主要介紹一些藍牙芯片的初始化流程,基于HCI vendor command的擴展
第八篇:附錄,主要介紹以上常用名詞的介紹以及一些特殊流程的介紹等,
另外,開發板如下所示,對于想學習藍牙協議堆疊的最好人手一套,以便更好的學習藍牙協議堆疊,相信我,學完這一套視頻你將擁有修改任何協議堆疊的能力(比如Linux下的bluez,Android下的bluedroid),

-------------------------------------------------------------------------------------------------------------------------
CSDN學院鏈接(進入選擇你想要學習的課程):https://edu.csdn.net/lecturer/5352?spm=1002.2001.3001.4144
藍牙交流扣扣群:970324688
Github代碼:https://github.com/sj15712795029/bluetooth_stack
入手開發板:https://item.taobao.com/item.htm?spm=a1z10.1-c-s.w4004-22329603896.18.5aeb41f973iStr&id=622836061708
藍牙學習目錄:https://blog.csdn.net/XiaoXiaoPengBo/article/details/107727900
--------------------------------------------------------------------------------------------------------------------------
二. HFP Phone Status Information 介紹
本小節介紹內容如下:

Phone status information分為6個部分介紹,此6部分都是AT+CMER使能后, AG會發送訊息+CIEV的訊息過來的介紹,
但是會增加一個細節AT command,就是AT+BIA,那這個命令的作用就是active/deactive某一個indicator
說白了AT+CMER是全域使用,AT+BIA是區域使能,
比如:AT+CMER使能后,AT+BIA失能signal的indicator,那么signal的CIEV AG就不會主動發送了,AT+CMER我們前面已經做了介紹,下面就介紹下AT+BIA
AT+BIA (Bluetooth Indicators Activation)
Syntax: AT+BIA=[[<indrep 1>][,[<indrep 2>][,…[,[<indrep n>]]]]]]
舉例:
假設有7個indicator,index是根據AT+CIND=?得到,使能全域是AT+BIA=1,1,1,1,1,1,1
失能全部AT+BIA=0,0,0,0,0,0,0
如果要失能第3個,可以寫成這樣AT+BIA=1,1,0,1,1,1,1
也可以寫成這樣AT+BIA=1,1,0,后續引數自動忽略,采用默認
2.1 Transfer of Signal Strength Indication
此就是手機的信號,AG會通過+CIEV發送給HF

在上一篇connection manager的時候已經介紹了index怎么獲取以及取值多少,我們這里不再介紹index怎么獲取,可以自行參考以前的文章,我們只是貼下value的范圍,可以看到范圍是0~5

2.2 Transfer of Roaming Status Indication
此就是手機的漫游,AG會通過+CIEV發送給HF

在上一篇connection manager的時候已經介紹了index怎么獲取以及取值多少,我們這里不再介紹index怎么獲取,可以自行參考以前的文章,我們只是貼下value的范圍,可以看到只有兩個值 0跟1,說白了就是有沒有插手機卡,能不能入網

2.3 Transfer of Battery Level Indication of AG
此就是手機的電量,AG會通過+CIEV發送給HF

在上一篇connection manager的時候已經介紹了index怎么獲取以及取值多少,我們這里不再介紹index怎么獲取,可以自行參考以前的文章,我們只是貼下value的范圍,可以看到范圍是0~5

2.4 Query Operator Selection
此命令是問詢手機的網路,比如”中國移動”
![]()
整個程序如下圖所示:

? HF shall send AT+COPS=3,0 command to set name format to long alphanumeric. Long alphanumeric is defined as a maximum of 16 characters. The value of 3 as the first parameter indicates that this command is only affecting the format parameter (the second parameter). The second parameter, 0, is the value required to set the format to “long alphanumeric.”
? Upon an internal event or user-initiated action, HF shall send the AT+COPS? (Read) command to find the currently selected operator.
? AG shall respond with +COPS response indicating the currently selected operator. If no operator is selected, <format> and <operator> are omitted
2.5 Report Extended Audio Gateway Error Results Code
此部分是用來使能AG報告給HF更詳細的錯誤
? The HF shall issue the AT+CMEE command to enable/disable the “Extended Audio Gateway Error Result Code” in the AG. The parameter <n> controls the activation/deactivation of the “Extended Error result code” notification.
? Whenever there is an error relating to the functionality of the AG as a result of AT command, the AG shall send +CME ERROR: <err> response to the HF.
如果有錯誤出現,那么AG會通過 +CME ERROR:<err>發送給HF,
詳細的錯誤都有:

2.6 Transfer of Call Status
Call status我們在前面已經說明value的值,分別為:

會有幾種case會更新call active
1)Incoming call,HF發送接聽指令或者AG接聽,都會觸發

2) Outgoing call

以上兩種情況是call value更新為1,下面三種call value變為0
1) HF主動發命令掛斷

2) AG主動掛斷

3) 通話中,突然沒有信號

2.7 Transfer of Callsetup Status
有以下幾個callsetup的value

1) Outgoing call

2) Incoming call

2.8 Indication of Status for Held Calls
在前面我們有介紹call held的value

一共有3個case,你只需要知道這三個case就行,后續介紹三方通話的feature的時候會重新詳細說明
1) Call Held or Active/Held Position Swap

2) Held Call Release

3) Active Call Terminated/Call Remains Held

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/172778.html
標籤:其他
上一篇:如何 查看 linux 的喚醒源
