Bluetooth HFP Profile

group BT_HFP

Provide BT HFP profile interfaces.

Typedefs

typedef enum t_bt_hfp_call_status T_BT_HFP_CALL_STATUS

Define BT HFP call status.

Enums

enum t_bt_hfp_call_status

Define BT HFP call status.

Values:

enumerator BT_HFP_CALL_IDLE
enumerator BT_HFP_CALL_INCOMING
enumerator BT_HFP_CALL_OUTGOING
enumerator BT_HFP_CALL_ACTIVE
enumerator BT_HFP_CALL_HELD
enumerator BT_HFP_CALL_ACTIVE_WITH_CALL_WAITING
enumerator BT_HFP_CALL_ACTIVE_WITH_CALL_HELD

Functions

bool bt_hfp_init(uint8_t rfc_hfp_chann_num, uint8_t rfc_hsp_chann_num, uint16_t supported_features, uint8_t supported_codecs)

Initialize HFP profile.

Parameters:
Return values:
  • true – HFP profile was initialized successfully.

  • false – HFP profile was failed to initialize.

Returns:

The status of initializing HFP profile.

bool bt_hfp_connect_req(uint8_t bd_addr[6], uint8_t server_chann, bool is_hfp)

Send an HFP or HSP connection request.

Parameters:
  • bd_addr[in] Remote BT address.

  • server_chann[in] Remote dlci which can be found from the SDP info.

  • is_hfp[in] Choose to create an HFP or HSP connection.

    • true Create a HFP connection.

    • false Create a HSP connection.

Return values:
  • true – HFP or HSP connection request was sent successfully.

  • false – HFP or HSP connection request was failed to send.

Returns:

The status of sending the HFP or HSP connection request.

bool bt_hfp_connect_cfm(uint8_t bd_addr[6], bool accept)

Send an HFP connection confirmation.

Parameters:
  • bd_addr[in] Remote BT address.

  • accept[in] Accept or reject the connection indication.

    • true Accept the connection indication.

    • false Reject the connection indication

Return values:
  • true – HFP connection confirmation was sent successfully.

  • false – HFP connection confirmation was failed to send.

Returns:

The status of sending the HFP connection confirmation.

bool bt_hfp_disconnect_req(uint8_t bd_addr[6])

Send an HFP disconnection request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – HFP disconnection request was sent successfully.

  • false – HFP disconnection request was failed to send.

Returns:

The status of sending the HFP disconnection request.

bool bt_hfp_send_vnd_at_cmd_req(uint8_t bd_addr[6], const char *at_cmd)

Send a vendor AT command request.

Parameters:
  • bd_addr[in] Remote BT address.

  • at_cmd[in] The start address of buffer that stores AT command. AT command string must end with “\r”.

Return values:
  • true – AT command request was sent successfully.

  • false – AT command request was failed to send.

Returns:

The status of sending the AT command request.

bool bt_hfp_dial_with_number_req(uint8_t bd_addr[6], const char *number)

Send a command to dial a specific phone number.

Parameters:
  • bd_addr[in] Remote BT address.

  • number[in] The start address of string buffer that stores phone number.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_dial_last_number_req(uint8_t bd_addr[6])

Send a command to recalling the last number dialed by the remote device.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_call_answer_req(uint8_t bd_addr[6])

Send a command to answer the incoming call.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_call_terminate_req(uint8_t bd_addr[6])

Send a command to terminate the phone call.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_call_hold_req(uint8_t bd_addr[6])

Send a command to hold the phone call.

Experimental Added Since 2.13.0.0:

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_held_call_accept_req(uint8_t bd_addr[6])

Send a command to accept the held phone call.

Experimental Added Since 2.13.0.0:

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_held_call_release_req(uint8_t bd_addr[6])

Send a command to release the held phone call.

Experimental Added Since 2.13.0.0:

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_current_call_list_req(uint8_t bd_addr[6])

Send a command to query current call list.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_release_held_or_waiting_call_req(uint8_t bd_addr[6])

Send a command to release held or waiting call.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_release_active_call_accept_held_or_waiting_call_req(uint8_t bd_addr[6])

Send a command to release active call and accept held or waiting_call.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_hold_active_call_accept_held_or_waiting_call_req(uint8_t bd_addr[6])

Send a command to hold active call and accept held or waiting_call.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_join_two_calls_req(uint8_t bd_addr[6])

Send a command to join two calls.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_audio_connect_req(uint8_t bd_addr[6])

Send a request to creat audio connection.

Note

Although the audio connection may be triggered by either the AG or the HF, the codec connection and the synchronous connection shall always be established by the AG (unless one of the devices is a legacy device). HF implementations that comply with the Hands-Free Profile specification Rev. 0.96,1.0 or 1.5, shall not indicate support for the codec negotiation feature and shall neither send the AT+BAC command nor the AT+BCC command to trigger an audio connection establishment by the AG. In order to guarantee backward compatibility, HFP Rev. x.y implementations shall be able to handle establishment of synchronous connections according to Hands-Free Profile specification Rev. 1.0 or 1.5.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_audio_connect_cfm(uint8_t bd_addr[6], bool accept)

Send an audio connection confirmation.

Experimental Added Since 2.13.0.0:

Parameters:
  • bd_addr[in] Remote BT address.

  • accept[in] Accept or reject the audio connection indication.

    • true Accept the audio connection indication.

    • false Reject the audio connection indication.

Return values:
  • true – Audio connection confirmation was sent successfully.

  • false – Audio connection confirmation was failed to send.

Returns:

The status of sending audio connection confirmation.

bool bt_hfp_audio_disconnect_req(uint8_t bd_addr[6])

Send a request to disconnect audio connection.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_voice_recognition_enable_req(uint8_t bd_addr[6])

Send a command to enable voice recognition.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_voice_recognition_disable_req(uint8_t bd_addr[6])

Send a command to disable voice recognition.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_speaker_gain_level_report(uint8_t bd_addr[6], uint8_t level)

Send a command to synchronize speaker gain level.

Parameters:
  • bd_addr[in] Remote BT address.

  • level[in] Local gain level, range from 0 to 15.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_microphone_gain_level_report(uint8_t bd_addr[6], uint8_t level)

Send a command to synchronize microphone gain level.

Parameters:
  • bd_addr[in] Remote BT address.

  • level[in] Local gain level, range from 0 to 15.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_dtmf_code_transmit(uint8_t bd_addr[6], char code)

Send a specific DTMF code to its network connection.

Parameters:
  • bd_addr[in] Remote BT address.

  • code[in] DTMF codes that are ‘0’-‘9’,’*’,’#’,’A’,’B’,’C’,’and ‘D’.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_network_operator_name_query(uint8_t bd_addr[6])

Send a command to query the current network operator name.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_subscriber_number_query(uint8_t bd_addr[6])

Send a command to query the AG subscriber number information.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_batt_level_report(uint8_t bd_addr[6], uint8_t level)

Send a command to report current battery level.

Parameters:
  • bd_addr[in] Remote BT address.

  • level[in] The current battery level, range from 0 to 100.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_nrec_disable(uint8_t bd_addr[6])

Send a command to disable the echo canceling and noise reduction functions resident in the AG.

Experimental Added Since 2.13.0.0:

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_indicator_activate(uint8_t bd_addr[6], uint32_t indicator_types)

Send a command to activate the AG individual indicators.

Experimental Added Since 2.13.0.0:

Parameters:
  • bd_addr[in] Remote BT address.

  • indicator_types[in] Activating indicator types BT HFP Indicator Type.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_indicator_deactivate(uint8_t bd_addr[6], uint32_t indicator_types)

Send a command to deactivate the AG individual indicators.

Experimental Added Since 2.13.0.0:

Parameters:
  • bd_addr[in] Remote BT address.

  • indicator_types[in] Deactivating indicator types BT HFP Indicator Type.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.

bool bt_hfp_ag_voice_recognition_set(uint8_t bd_addr[6], bool enable)

Send a command to inform HF of activating/deactivating the voice recognition function of AG.

Experimental Added Since 2.13.0.0:

Parameters:
  • bd_addr[in] Remote BT address.

  • enable[in] Activate/deactivate the voice recognition function.

Return values:
  • true – Command request was sent successfully.

  • false – Command request was failed to send.

Returns:

The status of sending the command request.