SWRU580 April 2021 CC2564C , CC2564MODA , CC2564MODN
This section provides a description of how to use the demo application to connect smart phone over Bluetooth HSP profile, the same for the second smart phone. Bluetooth HSP is a simple Client-Server connection process with one side, the Client, operating in the Audio-Gateway role and the other, the Server, operating in the Handsfree role. We will setup the boards as a Handsfree Server and use an android phone as the Client. Once connected, we can use the STM3240G-EVAL board as headset, with audio connected to the earphone jack.
The following instructions connect two boards running the HSP profile as a Headset and Audio Gateway.
The Server console also prints out the connected BD_ADDR.
This demonstrates setting up the client to connect to a commercial headset.
OpenStack().
Stack Initialization on Port 1 115200 (UART) Successful.
Bluetooth Stack ID: 1
Device Chipset: 4.1
BTPS Version : 4.0.3.0
Project Type : 6
FW Version : 7.26
App Name : HSPDemo
App Version : 0.1
LOCAL BD_ADDR: 0xB0B448F49D74
GAP_Set_Connectability_Mode(cmConnectable).
GAP_Set_Discoverability_Mode(dmGeneralDiscoverable, 0).
GAP_Set_Pairability_Mode(pmPairableMode).
GAP_Register_Remote_Authentication() Success.
******************************************************************
* Command Options: Headset, AudioGateway, Help *
******************************************************************
Choose Mode>AudioGateway
******************************************************************
* Command Options: Inquiry, DisplayInquiryList, Pair, *
* EndPairing, PINCodeResponse, PassKeyResponse, *
* UserConfirmationResponse, *
* SetDiscoverabilityMode, SetConnectabilityMode,*
* SetPairabilityMode, *
* ChangeSimplePairingParameters, *
* GetLocalAddress, GetLocalName, SetLocalName, *
* GetClassOfDevice, SetClassOfDevice, *
* GetRemoteName, ServiceDiscovery, *
* OpenClient, CloseClient, *
* RingIndication, ChangeSpeakerGain, *
* ChangeMicrophoneGain, *
* ManageAudio, *
* Help, Quit *
******************************************************************
AG>Inquiry
Return Value is 0 GAP_Perform_Inquiry() SUCCESS.
AG>
GAP Inquiry Entry Result: 0x244B03F712D3.
AG>
GAP Inquiry Entry Result: 0x340286605044.
AG>
GAP Inquiry Entry Result: 0x000DFD4072EF.
AG>
GAP_Inquiry_Result: 3 Found.
GAP Inquiry Result: 1, 0x244B03F712D3.
GAP Inquiry Result: 2, 0x340286605044.
GAP Inquiry Result: 3, 0x000DFD4072EF.
AG>GetRemoteName 3
GAP_Query_Remote_Device_Name: Function Successful.
AG>
GAP Remote Name Result: BD_ADDR: 0x000DFD4072EF.
GAP Remote Name Result: Motorola S10-HD.
AG>ServiceDiscovery
Usage: SERVICEDISCOVERY [Inquiry Index] [Profile Index] [16/32 bit UUID (Manual only)].
Profile Index:
0) Manual (MUST specify 16/32 bit UUID)
1) L2CAP
2) Advanced Audio
3) A/V Remote Control
4) Basic Imaging
5) Basic Printing
6) Dial-up Networking
7) FAX
8) File Transfer
9) Hard Copy Cable Repl.
10) Health Device
11) Headset
12) Audio gateway
13) HID
14) LAN Access
15) Message Access
16) Object Push
17) Personal Area Network
18) Phonebook Access
19) SIM Access
20) Serial Port
21) IrSYNC
Function Error.
AG>ServiceDiscovery 3 11
SDP_Service_Search_Attribute_Request(Headset) Success.
AG>
SDP Service Search Attribute Response Received (Size = 0x0010)
Service Record: 1:
Attribute ID 0x0000
Type: Unsigned Int = 0x00010001
Attribute ID 0x0001
Type: Data Element Sequence
Type: UUID_16 = 0x1108
Type: UUID_16 = 0x1203
Attribute ID 0x0004
Type: Data Element Sequence
Type: Data Element Sequence
Type: UUID_16 = 0x0100
Type: Data Element Sequence
Type: UUID_16 = 0x0003
Type: Unsigned Int = 0x02
Attribute ID 0x0006
Type: Data Element Sequence
Type: Unsigned Int = 0x656E
Type: Unsigned Int = 0x006A
Type: Unsigned Int = 0x0100
Attribute ID 0x0009
Type: Data Element Sequence
Type: Data Element Sequence
Type: UUID_16 = 0x1108
Type: Unsigned Int = 0x0100
Attribute ID 0x0100
Type: Text String = Headset
Attribute ID 0x0302
Type: Boolean = TRUE
AG>OpenClient
Usage: Open [Inquiry Index] [RFCOMM Server Port].
Function Error.
AG>OpenClient 3 2
HDSET_Open_Remote_Headset_Port() was successful.
AG>
atPINCodeRequest: 0x000DFD4072EF
Respond with the command: PINCodeResponse
AG>PINCodeResponse 0000
GAP_Authentication_Response(), Pin Code Response Success.
AG>
atLinkKeyCreation: 0x000DFD4072EF
Link Key: 0x19CDEF146AF8A709A1C93BAA99A6E8EE
Link Key Stored locally.
AG>
HDSET Open Port Confirmation, HDSETID: 0x0001, Status 0x0000.
AG>
HDSET Speaker Gain Indication, ID: 0x0001, Gain: 0x0005.
AG>
HDSET Microphone Gain Indication, ID: 0x0001, Gain: 0x000A.
AG>RingIndication
HDSET_Ring_Indication() Success.
AG>ManageAudio
Usage: Audio [Release = 0, Setup = 1].
Function Error.
AG>ManageAudio 1
HDSET_Setup_Audio_Connection: Function Successful.
AG>
HDSET Audio Connection Indication, ID: 0x0001.
AG>ManageAudio 0
HDSET_Release_Audio_Connection: Function Successful.
AG>RingIndication
HDSET_Ring_Indication() Success.