Bluetooth, HFP, Audio Gateway, AG Exercise → Full-duplex audio Exercise, Connecting Bluetooth Speaker or Hands-Free to Bluetooth Module as Cellphone.
HFP, AG(Audio Gateway)
Practice using a Bluetooth module as an HFP AG(Audio Gateway) and a hands-free product as an HF(Hands-Free) device.
Note. An HFP audio channel is bi-directional.
1. What is HFP AG?
2. Test System Configuration
HFP HF | HFP AG |
Profile Example
Decimal | PBAP | HID | AVRCP | A2DP | HFP | GATT | SPP | BT Role | ||||
TRGT | CTRL | SRC | SNK | AG | HF | CLNT | SVR | |||||
B10 | B09 | B08 | B07 | B06 | B05 | B04 | B03 | B02 | B01 | B00 | ||
11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | HF |
19 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | AG |
163 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | Sink |
323 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | Source |
117 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | Sink&HF |
339 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | Source&AG |
3. Command and Response Sequence
NO | Command | Response | Description |
Step1: Setting-up HFP-AG | |||
1 | AT+COD=5A020C | OK | Set the device type is the mobile phone(Source/AG) |
2 | AT+I2SCFG=0 | OK |
Set the audio output to Analog If the module recognizes codec successfully, feedback +CODEC=ID is received |
3 | AT + PROFILE =19 |
OK +DEVSTAT=0 +PWRSTAT=1 +SPPSTAT=1 +VER=BT955,V2.7.0,20220922 +PROFILE=17 +HFPSTAT=1 +DEVSTAT=1 +DEVSTAT=3 |
Turn on HFP-AG
Note. if the module does not support the corresponding function, the result bit value may be different from the setting value. |
Step2: Pairing with AG | |||
Set BT Earphone to Pairing Mode |
Switch Hans-Free to Paring Mode, to be discoverable by AG or Cellphone |
||
4 | AT+SCAN=1 |
+DEVSTAT=1 +DEVSTAT=9 +SCAN=1,-67,0,8BEE15D417EC,MABT181,340404 +SCAN=2,-66,0,948BC1350C63,Galaxy S8+,5A020C +SCAN=E +DEVSTAT=1 |
|
5 |
AT+HFPCONN=Target
ex) AT+HFPCONN=8BEE15D417EC |
OK +HFPSTAT=2 +PAIRREQ=072372,8BEE15D417EC,MABT181 +PAIRED=0,8BEE15D417EC,MABT181 +HFPSTAT=3 +HFPDEV=8BEE15D417EC,MABT181 +DEVSTAT=1 +HFPVGS=15 +HFPBATT=0 +HFPSTAT=1 +DEVSTAT=3 +HFPSTAT=2 +HFPSTAT=3 +HFPDEV=8BEE15D417EC,MABT181 +DEVSTAT=1 +HFPVGS=15 +HFPBATT=2 |
Connecting HF with AG |
6 | AT+AUDROUTE=2 |
+AUDROUTE=2 OK +HFPAUDIO=1 +AUDMODE=2 +HFPSTAT=4 +HFPSTAT=6 |
Set Audio/Voice path to HFP |