HFP Interface Functions

[English]

HFP_IF API Brief

Application

Brief

hfp_if_register_event_callback()

used to register HFP event callback function

hfp_if_hf_in_bandring_is_active()

check if bandring is ongoing

hfp_if_hf_CLCC_get_current_calls_list()

Get current call list

hfp_if_hf_BLDN_last_dailed_number()

trigger last dailed

hfp_if_hf_ATD_dial_number()

Trigger dial by call number

hfp_if_hf_CHUP_terminal_call()

Terminal call

hfp_if_hf_ATA_answer_call()

Answer call

hfp_if_hf_IPHONEACCEV_bat_level()

Report battery level

hfp_if_hf_report_spk_gain()

Report speaker gain

hfp_if_hf_report_mic_gain()

Report microphone gain

hfp_if_hf_voice_recog()

Enable or Disable Voice Recognition Activation

hfp_if_hf_setup_audio_connection()

Setup Audio connection

hfp_if_hf_disc_audio_connection()

Disconnect audio connection.

hfp_if_get_sync_len()

return the hfp connection sync buffer needed size

hfp_if_conn_sync()

TWS master used to sync host stack to TWS slave

hfp_if_conn_restore()

TWS slave used to rebuild its own host stack

hfp_if_connect()

reconnect HFP profile API

hfp_if_disconnect()

disconnect HFP profile API

hfp_if_init()

HFP stack initialise function

hfp_if_conn_restore_specific()

restore HFP specific variable

hfp_if_get_codec_type()

get voice using codec type

hfp_if_register_ag_handler()

register ag cmd handler

hfp_if_hf_voice_recog_with_cb()

send vr with callback

HFP_IF API Reference

Header File

Functions

void hfp_if_register_event_callback(btif_hfp_register_t *p_callback)

hfp_if_register_event_callback brief description

used to register HFP event callback function

参数:

p_callback[in] HFP event callback struct

返回:

N/A

bool hfp_if_hf_in_bandring_is_active(uint16_t handle)

hfp_if_hf_in_bandring_is_active brief description

check if bandring is ongoing

参数:

handle[in] connection handle

返回值:
  • true – active

  • fail – no active

返回:

result

btif_ret_t hfp_if_hf_CLCC_get_current_calls_list(uint16_t handle)

hfp_if_hf_CLCC_get_current_calls_list brief description

Get current call list

参数:

handle[in] connection handle

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_BLDN_last_dailed_number(uint16_t handle)

hfp_if_hf_BLDN_last_dailed_number brief description

trigger last dailed

参数:

handle[in] connection handle

返回值:
  • 0 – success [BTIF_EXIT_SUCCESS]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_ATD_dial_number(uint16_t handle, char *p_number)

hfp_if_hf_ATD_dial_number brief description

Trigger dial by call number

参数:
  • handle[in] connnection handle

  • p_number[in] phone number

返回值:
  • 0 – success [BTIF_EXIT_SUCCESS]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_CHUP_terminal_call(uint16_t handle)

hfp_if_hf_CHUP_terminal_call brief description

Terminal call

参数:

handle[in] conneciton handle

返回值:
  • 0 – success [BTIF_EXIT_SUCCESS]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_ATA_answer_call(uint16_t handle)

hfp_if_hf_ATA_answer_call brief description

Answer call

参数:

handle[in] connection handle

返回值:
  • 0 – success [BTIF_EXIT_SUCCESS]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_IPHONEACCEV_bat_level(uint16_t handle, uint8_t level)

hfp_if_hf_IPHONEACCEV_bat_level brief description

Report battery level

参数:
  • handle[in] connection handle

  • level[in] battery level

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_report_spk_gain(uint16_t handle, uint8_t spk_gain)

hfp_if_hf_report_spk_gain brief description

Report speaker gain

参数:
  • handle[in] conneciont handle

  • spk_gain[in] VGS value

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_report_mic_gain(uint16_t handle, uint8_t mic_gain)

hfp_if_hf_report_mic_gain brief description

Report microphone gain

参数:
  • handle[in] connection handle

  • mic_gain[in] VGM value

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_voice_recog(uint16_t handle, uint8_t enable)

hfp_if_hf_voice_recog brief description

Enable or Disable Voice Recognition Activation

参数:
  • handle[in] coonection handle

  • enable[in] BVRA value

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_setup_audio_connection(uint16_t handle)

hfp_if_hf_setup_audio_connection brief description

Setup Audio connection

参数:

handle[in] connection handle

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_hf_disc_audio_connection(uint16_t handle)

hfp_if_hf_disc_audio_connection brief description

Disconnect audio connection.

参数:

handle[in] connecction handle

返回值:
  • 0 – success

  • other – fail

返回:

result

uint16_t hfp_if_get_sync_len(btif_bd_addr_t *p_addr)

hfp_if_get_sync_len brief description

return the hfp connection sync buffer needed size

参数:

p_addr[in] remote BT MAC address

返回:

data length

btif_ret_t hfp_if_conn_sync(btif_bd_addr_t *p_addr, uint8_t *p_buff, uint16_t buff_len, uint16_t *p_length)

hfp_if_conn_sync brief description

TWS master used to sync host stack to TWS slave

参数:
  • addr[in] remote BT MAC addresss

  • p_buff[out] buffer used to sync profile data

  • buff_len[in] p_buff allocated length

  • p_length[out] sync profile data length will be sent

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_conn_restore(btif_bd_addr_t *p_addr, uint8_t *p_buff, uint16_t length)

hfp_if_conn_restore brief description

TWS slave used to rebuild its own host stack

参数:
  • p_addr[in] remote BT MAC address

  • p_buff[in] sync profile data

  • length[in] p_buff data length

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_connect(btif_bd_addr_t *p_addr)

hfp_if_connect brief description

reconnect HFP profile API

参数:

addr[in] remote BT MAC address

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t hfp_if_disconnect(uint16_t handle)

hfp_if_disconnect brief description

disconnect HFP profile API

参数:

handle[in] connection handle

返回值:
  • 0 – success

  • other – fail

返回:

result

void hfp_if_init(void)

hfp_if_init brief description

HFP stack initialise function

返回:

N/A

btif_ret_t hfp_if_conn_restore_specific(btif_bd_addr_t *p_addr, uint16_t acl_handle)

hfp_if_conn_restore_specific brief description

restore HFP specific variable

参数:
  • addr[in] remote BT MAC address

  • acl_handle[in] connection handle

返回值:
  • 0 – success

  • other – fail

返回:

result

uint8_t hfp_if_get_codec_type(void)

hfp_if_get_codec_type brief description

get voice using codec type

返回:

codec type @btif_sco_codec_t

btif_ret_t hfp_if_register_ag_handler(uint16_t handle, hfp_if_ag_result_callback callback, const char *prefix)

hfp_if_register_ag_handler brief description

register ag cmd handler

返回:

result

btif_ret_t hfp_if_hf_voice_recog_with_cb(uint16_t handle, uint8_t enable, hfp_if_response_callback callback)

hfp_if_hf_voice_recog_with_cb brief description

send vr with callback

返回:

result

Structures

struct if_hfp_cb_t

HFP event header struct definition.

Public Members

btif_hfp_event_t event

event index

uint16_t handle

connection handle

struct if_slc_connect_evt_t

HF profile connected struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

uint8_t status

removte BT MAC address

struct if_slc_disc_evt_t

HF profile disconn struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_ag_ind_changed_evt_t

HFP +CIEV struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

uint8_t value

value for CIEV index

uint8_t min

min value for CIVE index

uint8_t max

max value for CIVE index

btif_hf_ind_t ind_idx

CIEV index @btif_hf_ind_t

struct if_inband_ring_chg_evt_t

HFP in-band ring change struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

bool inband_ring_supported

boolean value for in-band ring active or not

struct if_spk_volume_evt_t

HFP speak volume change struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

uint8_t spk_volume

speaker value

struct if_sco_connect_evt_t

HFP SCO connected struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

btif_bd_addr_t addr

remote BT address

btif_sco_codec_t codec_type

SCO codec type

uint8_t status

status @btif_ret_t

uint16_t rx_pkt_len

RX packet length

uint16_t tx_pkt_len

TX packet length

uint16_t sync_handle

SCO connection handle

struct if_mic_volume_evt_t

HFP MIC volume change struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

uint8_t mic_volume

MIC value

struct if_sco_disc_evt_t

HFP SCO disconnect struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_ring_evt_t

HFP ring struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_start_ring_evt_t

HFP start ring struct defintion.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_stop_ring_evt_t

HFP stop ring struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_call_answer_evt_t

HFP call answer struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_call_terminate_evt_t

HFP call terminate struct definction.

Public Members

if_hfp_cb_t hdr

HFP event haeader

struct if_sco_conn_req_evt_t

HFP SCO connection request struct definition.

Public Members

if_hfp_cb_t hdr

HFP event haeader

bool valid

static @btif_ret_t

if_accept_sync_t accept_sync

SCO setting relevant parameter

struct btif_hfp_register_t

HFP event callback struct definition.

Public Members

dl_list_t dlst_node

node for application handler will be linked to orthers

btif_hfp_event_callback callback

function pointer for callback function

struct hfp_if_response_t

Macros

BTIF_HFP_SLC_ESTABLISHED

callback struct see@if_slc_connect_evt_t

BTIF_HFP_SLC_RELEASED

callback struct see@if_slc_disc_evt_t

BTIF_HFP_AUDIO_CONNECTION_ESTABLISHED

callback struct see@if_sco_connect_evt_t

BTIF_HFP_AUDIO_CONNECTION_RELEASED

callback struct see@if_sco_disc_evt_t

BTIF_HFP_AG_INDICATOR_STATUS_CHANGED

callback struct see@if_ag_ind_changed_evt_t

BTIF_HFP_RING

callback struct see@if_ring_evt_t

BTIF_HFP_SPEAKER_VOLUME

callback struct see@if_spk_volume_evt_t

BTIF_HFP_MICROPHONE_VOLUME

callback struct see@if_mic_volume_evt_t

BTIF_HFP_ENHANCED_CALL_STATUS

callback struct see@NUILL

BTIF_HFP_INBAND_RING_TONE_CHANGED

callback struct see@if_inband_ring_chg_evt_t

BTIF_HFP_START_RINGING

callback struct see@if_start_ring_evt_t

BTIF_HFP_STOP_RINGING

callback struct see@if_stop_ring_evt_t

BTIF_HFP_CALL_ANSWER

callback struct see@if_call_answer_evt_t

BTFI_HFP_CALL_TERMINATED

callback struct see@if_call_terminate_evt_t

BTIF_HFP_SCO_CONN_REQ

callback struct see@if_sco_conn_req_evt_t

STATUS_IF_OK
STATUS_IF_CONNECT
STATUS_IF_RING
STATUS_IF_NO_CARRIER
STATUS_IF_ERROR
STATUS_IF_NO_DIALTONE
STATUS_IF_BUSY
STATUS_IF_NO_ANSWER
STATUS_IF_DELAYED
STATUS_IF_BLACKLISTED
STATUS_IF_CME_ERROR
IF_AG_FAILURE
IF_NO_CONNECTION_TO_PHONE
IF_OPERATION_NOT_ALLOWED
IF_OPERATION_NOT_SUPPORTED
IF_PH_SIM_PIN_REQUIRED
IF_SIM_NOT_INSERTED
IF_SIM_PIN_REQUIRED
IF_SIM_PUK_REQUIRED
IF_SIM_FAILURE
IF_SIM_BUSY
IF_INCORRECT_PASSWORD
IF_SIM_PIN2_REQUIRED
IF_SIM_PUK2_REQUIRED
IF_MEMORY_FULL
IF_INVALID_INDEX
IF_MEMORY_FAILURE
IF_TEXT_STRING_TOO_LONG
IF_INVALID_CHARS_IN_TEXT_STRING
IF_DIAL_STRING_TO_LONG
IF_INVALID_CHARS_IN_DIAL_STRING
IF_NO_NETWORK_SERVICE
IF_NETWORK_TIMEOUT
IF_NETWORK_NOT_ALLOWED

Type Definitions

typedef uint8_t btif_hfp_event_t
typedef uint8_t hfp_if_status_t
typedef uint8_t hfp_if_error_t
typedef void (*hfp_if_response_callback)(hfp_if_status_t result, hfp_if_error_t cme_err, void *p_user_data)
typedef void (*hfp_if_ag_result_callback)(hfp_if_response_t *p_data, void *p_hf_ctrl)