MT2523 API Reference  LinkIt SDK v4

The Hands-Free Profile (HFP) defines the minimum set of functions such that a mobile phone can be used in conjunction with a Hands-Free device, with a Bluetooth link providing a wireless means for both remote control of the mobile phone by the Hands-Free device and voice connection between the mobile phone and the Hands-Free device. More...

Overview

The Hands-Free Profile (HFP) defines the minimum set of functions such that a mobile phone can be used in conjunction with a Hands-Free device, with a Bluetooth link providing a wireless means for both remote control of the mobile phone by the Hands-Free device and voice connection between the mobile phone and the Hands-Free device.

The following roles are defined for this profile. Audio Gateway (AG). A device that acts as a gateway of the audio, both for input and output. Typical devices acting as AGs are cellular phones. Hands-Free unit (HF). A device that acts as the AG's remote audio input and output. It also provides remote control means.

Terms and Acronyms

Terms Details
BATTCHG Battery Charge indicator of AG to provide the battery level.
BRSF Bluetooth Retrieve Supported Features.
SYNC Synchronization.
MIC Microphone.
DTMF Dual Tone Multi-Frequency, is an in-band telecommunication signaling system using the voice-frequency band over telephone lines. For more information, please refer to Dual tone multi-frequency signaling in Wikipedia.
AG Audio Gateway, the remote device.
NREC Noise Reduction and Echo Canceling, the feature to disable or enable in AG.
WBS Wide Band Speech.
CLI Calling Line Identification, the feature to disable or enable in AG.
DIR Director, the call's director, an attribute of a call.
HFP Hands-Free Profile. For more information, please refer to Hands-free profile in Wikipedia.
CVSD Continuously Variable Slope Delta modulation, a codec of audio. For more information, please refer to Continuously variable slope delta modulation in Wikipedia.
MSBC Modified Sub Band Codec, a codec of audio.
CHLD Call Hold, the 3-way call action in AG.
ISDN Integrated Services Digital Network. For more information, please refer to Integrated services digital network in Wikipedia.
FAX Facsimile.
SLC Service Level Connection, the HFP connection with status negotiation.

How to use this module

This section presents the HFP connection handle and the method to send the command to dial a number.

Functions

bt_status_t bt_hfp_connect (uint32_t *handle, bt_bd_addr_t *address)
 This function sends a HFP connect request to the AG. More...
 
bt_status_t bt_hfp_connect_response (uint32_t handle, bool accept)
 This function responds to a connection request from AG. More...
 
bt_status_t bt_hfp_disconnect (uint32_t handle)
 This function sends a HFP disconnect request to AG. More...
 
bt_status_t bt_hfp_audio_transfer (uint32_t handle, bt_hfp_audio_direction_t audio_dir)
 This function transfers the audio direction to AG or to HF. More...
 
bt_status_t bt_hfp_set_audio_status (uint32_t handle, bt_hfp_audio_status_t status)
 This function sets the current audio connection status. More...
 
bt_status_t bt_hfp_send_command (uint32_t handle, uint8_t *command, uint16_t command_length)
 This function sends an HFP command to the AG. More...
 
bt_bd_addr_tbt_hfp_get_bd_addr_by_handle (uint32_t handle)
 This function gets the remote device's Bluetooth address of current connection. More...
 
bt_status_t bt_hfp_get_init_params (bt_hfp_init_param_t *init_params)
 This function gets the initialization settings. More...
 

Modules

 Define
 This section defines the HFP events and error codes.
 
 Struct
 This section defines data structures for the HFP.
 

Function Documentation

bt_status_t bt_hfp_audio_transfer ( uint32_t  handle,
bt_hfp_audio_direction_t  audio_dir 
)

This function transfers the audio direction to AG or to HF.

Parameters
[in]handleis the handle of the current connection.
[in]audio_diris the switch direction, either to AG or HF, please refer to bt_hfp_audio_direction_t.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
bt_status_t bt_hfp_connect ( uint32_t *  handle,
bt_bd_addr_t address 
)

This function sends a HFP connect request to the AG.

The event BT_HFP_SLC_CONNECTING_IND returns when the SLC is connecting. The event BT_HFP_SLC_CONNECTED_IND returns when HFP negotiation is complete.

Parameters
[out]handleis the channel handle returned.
[in]addressis the Bluetooth address of the AG.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed. BT_STATUS_OUT_OF_MEMORY, out of memory.
bt_status_t bt_hfp_connect_response ( uint32_t  handle,
bool  accept 
)

This function responds to a connection request from AG.

Calll this API to accept or reject the connection, when BT_HFP_CONNECT_REQUEST_IND is received.

Parameters
[in]handleis the handle of the current connection.
[in]acceptis the operation of accepting or rejecting the current connection request.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
bt_status_t bt_hfp_disconnect ( uint32_t  handle)

This function sends a HFP disconnect request to AG.

The event BT_HFP_DISCONNECT_IND returns the current request’s result.

Parameters
[in]handleis the handle of the current connection.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
bt_bd_addr_t* bt_hfp_get_bd_addr_by_handle ( uint32_t  handle)

This function gets the remote device's Bluetooth address of current connection.

Parameters
[in]handleis the handle of the current connection.
Returns
The Bluetooth address.
bt_status_t bt_hfp_get_init_params ( bt_hfp_init_param_t init_params)

This function gets the initialization settings.

This API invoked by the SDP process should be implemented by the application.

Parameters
[out]init_paramsis the settings to initialize.
Returns
BT_STATUS_SUCCESS, the operation completed successfully, otherwise it failed.
bt_status_t bt_hfp_send_command ( uint32_t  handle,
uint8_t *  command,
uint16_t  command_length 
)

This function sends an HFP command to the AG.

The event BT_HFP_ACTION_CMD_CNF returns when the remote device responds.

Parameters
[in]handleis the handle of the current connection.
[in]commandis the command to send.
[in]command_lengthis the command's length.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed. BT_STATUS_OUT_OF_MEMORY, out of memory.
bt_status_t bt_hfp_set_audio_status ( uint32_t  handle,
bt_hfp_audio_status_t  status 
)

This function sets the current audio connection status.

Parameters
[in]handleis the handle of the current connection.
[in]statusis the audio status to set.
Returns
BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.