SWRA769 august   2023 CC2564C

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Demo Application
  5. 2Running the Bluetooth Code
  6. 3Server Set-Up Using HFP Demo Application
  7. 4Client Set-Up on the Demo Application
  8. 5Example: Audio Gateway with a Commercial Headset
  9. 6Application Commands
    1. 6.1  Generic Access Profile Commands
    2. 6.2  Help (DisplayHelp)
    3. 6.3  Inquiry
    4. 6.4  Pair
    5. 6.5  End Pairing
    6. 6.6  PIN Code Response
    7. 6.7  Pass Key Response
    8. 6.8  User Confirmation Response
    9. 6.9  Set Discoverability Mode
    10. 6.10 Set Connectability Mode
    11. 6.11 Set Pairability Mode
    12. 6.12 Change Simple Pairing Parameters
    13. 6.13 Get Local Address
    14. 6.14 Set Local Name
    15. 6.15 Get Local Name
    16. 6.16 Set Class of Device
    17. 6.17 Get Class of Device
    18. 6.18 Get Remote Name
  10. 7Hands-Free Profile Commands
    1. 7.1  Service Discovery
    2. 7.2  Open Audio Gateway Client
    3. 7.3  Manage Audio
    4. 7.4  Update Control Indicators
    5. 7.5  Call Waiting
    6. 7.6  Set Voice Recognition Activation
    7. 7.7  Set Speaker Gain
    8. 7.8  Set Microphone Gain
    9. 7.9  Disable Remote Sound Enhancement
    10. 7.10 Send Caller ID Notification
    11. 7.11 Set Ring Indication
    12. 7.12 Ring Indication
    13. 7.13 Send Incoming Call State
    14. 7.14 Close AG Client
    15. 7.15 Send Operator Info
    16. 7.16 Send Sub Number
    17. 7.17 Send Call List
  11. 8References
  12. 9Revision History

Example: Audio Gateway with a Commercial Headset

The example below demonstrates setting up the client to connect to a commercial headset.

  1. Perform the setps mentioned earlier in "Running the Bluetooth Code" section to initialize the application.
    OpenStack().Bluetooth Stack ID: 1WBS support enabled.Device Chipset: Unknown (greater 4.1)BTPS Version : 4.2.1.0Project Type : 6FW Version : 12.12App Name : HFPDemo_AGApp Version : 0.3LOCAL BD_ADDR: 0x88C255D1D645GAP_Set_Connectability_Mode(cmConnectable).GAP_Set_Discoverability_Mode(dmGeneralDiscoverable, 0).GAP_Set_Pairability_Mode(pmPairableMode).GAP_Register_Remote_Authentication() Success. Command Options: Inquiry, DisplayInquiryList, Pair,  EndPairing, PINCodeResponse, PassKeyResponse,  UserConfirmationResponse,  SetDiscoverabilityMode, SetConnectabilityMode, SetPairabilityMode,  ChangeSimplePairingParameters,  GetLocalAddress, SetLocalName, GetLocalName,  SetClassOfDevice, GetClassOfDevice,  GetRemoteName, ManageAudio,  OpenAudioGatewayClient, CloseAgClient,  ServiceDiscovery, UpdateControlIndicators,  CallWaiting, SendCallerIdNotification,  SetRingIndication, RingIndication,  SetVoiceRecognitionActivation,  SetSpeakerGain, SetMicroPhoneGain,  DisableRemoteSoundEnhancement,  SendOperatorInfo, SendIncomingCallState,  SendSubNumber, SendCallList,  Help
  2. Issue the Inquiry command for the HFP server.
    HFP AG>InquiryReturn Value is 0 GAP_Perform_Inquiry() SUCCESS.HFP AG>GAP Inquiry Entry Result: 0x244B03F712D3.HFP AG>GAP Inquiry Entry Result: 0x3402862CCAE9.HFP AG>GAP Inquiry Entry Result: 0x340286605044.HFP AG>GAP Inquiry Entry Result: 0x484520902A4E.HFP AG>GAP Inquiry Entry Result: 0x08DF1F99F8D0.HFP AG>GAP Inquiry Entry Result: 0x002500F84FAB.HFP AG>GAP_Inquiry_Result: 6 Found.GAP Inquiry Result: 1, 0x244B03F712D3.GAP Inquiry Result: 2, 0x3402862CCAE9.GAP Inquiry Result: 3, 0x340286605044.GAP Inquiry Result: 4, 0x484520902A4E.GAP Inquiry Result: 5, 0x08DF1F99F8D0.GAP Inquiry Result: 6, 0x002500F84FAB.
  3. Discover services of the remote HFP server by issuing the ServiceDiscovery 5 12 command to get the port number.
    HFP AG>ServiceDiscoveryUsage: 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) Handsfree 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) IrSYNCFunction Error.HFP AG>ServiceDiscovery 5 12SDP_Service_Search_Attribute_Request(Handsfree) Success.HFP AG>SDP Service Search Attribute Response Received (Size = 0x0010)Service Record: 1:Attribute ID 0x0000Type: Unsigned Int = 0x00010000Attribute ID 0x0001Type: Data Element SequenceType: UUID_16 = 0x111EType: UUID_16 = 0x1203Attribute ID 0x0004Type: Data Element SequenceType: Data Element SequenceType: UUID_16 = 0x0100Type: Data Element SequenceType: UUID_16 = 0x0003Type: Unsigned Int = 0x0AAttribute ID 0x0006Type: Data Element SequenceType: Unsigned Int = 0x656EType: Unsigned Int = 0x006AType: Unsigned Int = 0x0100Attribute ID 0x0009Type: Data Element SequenceType: Data Element SequenceType: UUID_16 = 0x111EType: Unsigned Int = 0x0106Attribute ID 0x0100Type: Text String = Hands-Free unitAttribute ID 0x0311Type: Unsigned Int = 0x003F
  4. Initiate connection to the remote HFP server by issuing the OpenAudioGatewayClient 5 10 command.
    HFP AG>OpenAudioGatewayClientUsage: OPENAUDIOGATEWAYCLIENT [Inquiry Index] [Port Number].Function Error.HFP AG>OpenAudioGatewayClient 5 10Bluetooth Device Address: 0x08DF1F99F8D0Open Remote HandsFree Port = 000AHFRE_Open_Remote_HandsFree_Port: Function Successful ID = 0001.OpenRemoteHandsFreePort: HFRE_Update_Current_Control_Indicator_Status Function Status 0.

    Observe the output below from the HFP server.

    HFP AG>atLinkKeyRequest: 0x08DF1F99F8D0GAP_Authentication_Response() Success.HFP AG>atPINCodeRequest: 0x08DF1F99F8D0Respond with the command: PINCodeResponseHFP AG>PINCodeResponse 0000PINCodeResponse.GAP_Authentication_Response(), Pin Code Response Success.HFP AG>atLinkKeyCreation: 0x08DF1F99F8D0Link Key: 0x4AF49AD7072771919BAC62840F1F985DLink Key Stored locally.HFP AG>HFRE Open Port Confirmation, ID: 0x0001, Status: 0x0000.HFP AG>HFRE Available Codec List Indiocation, ID: 0x0001 NumCodecs: 2 [ 1 2 ]HFP AG>HFRE Open Service Level Connection Indication, ID: 0x0001 RemoteSupportedFeaturesValid: TRUE RemoteSupportedFeatures: 0x000000BF RemoteCallHoldMultipartySupport: 0x00000000HFRE_Enable Call Line IdentificationHFP AG>HFRE Disable Sound_Enhancement Indication, ID: 0x0001HFRE_Send_Terminating_Response (erOK) :: Res = 0HFP AG>HFRE Speaker Gain Indication, ID: 0x0001, Speaker Gain 0x000A.HFP AG>HFRE Call Line Identification Notification Activation Indication, ID: 0x0001, Enabled: TRUE.HFP AG>HFRE Call Waiting Notification Activation Indication, ID: 0x0001, Enabled: TRUE.HFP AG> HFRE Response Hold Status Indication, ID: 0x0001HFRE_Send_Incoming_Call_State (csNone) :: Res = 0HFP AG>HFRE_Current_Calls_List_IndicationHFRE_Send_Terminating_Response (erOK) :: Res = 0
  5. Initiate audio connection by issuing the: ManageAudio <STATE> command which chooses the Modified sub-band coding (MSBC) by default.
    HFP AG>ManageAudioUsage: Audio [Release = 0, set-up = 1].Function Error.HFP AG>ManageAudio 1HFRE_Send_Select_Codec:: Codec = 2, Res = 0

    Observe the below output from the HFP server.

    HFP AG>HFRE Codec Select Confirmation, ID: 0x0001 AcceptedCodec=2set-up WBS with Audio for ACL handle 0x0001HFRE_set-up_Audio_Connection: Function Successful.HFRE_set-up_Audio_Connection:: Res = 0HFP AG>HFRE Audio Connection Indication, ID: 0x0001, BDADDR=0x08DF1F99F8D0, Status: 0x0000.

Note: The port ID on the remote Hands free device is oxoA (The Unsigned int), from the Atribute ID oxooo4. This port ID is used in the following OpenAudioGatewayClient command as the second parameter after being converted to the decimal equivalent (10).