dotstack API Reference  1.10.37
Data Structures | Macros | Typedefs | Functions
Hands Free Profile (HFP)

Data Structures

struct  bt_hfp_evt_audio_data_t
 HFP_EVENT_AUDIO_DATA_RECEIVED event parameter. More...
 
struct  bt_hfp_evt_slc_connection_state_changed_t
 HFP_EVENT_SLC_CONNECTION_STATE_CHANGED event parameter. More...
 
struct  bt_hfp_evt_audio_connection_state_changed_t
 HFP_EVENT_AUDIO_CONNECTION_STATE_CHANGED event parameter. More...
 
struct  bt_hfp_evt_mic_volume_changed_t
 HFP_EVENT_MIC_VOLUME_CHANGED event parameter. More...
 
struct  bt_hfp_evt_spk_volume_changed_t
 HFP_EVENT_SPK_VOLUME_CHANGED event parameter. More...
 
struct  bt_hfp_evt_indicator_received_t
 HFP_EVENT_INDICATOR_RECEIVED event parameter. More...
 
struct  bt_hfp_evt_query_operator_completed_t
 HFP_EVENT_QUERY_OPERATOR_COMPLETED event parameter. More...
 
struct  bt_hfp_evt_clip_received_t
 HFP_EVENT_CLIP_RECEIVED event parameter. More...
 
struct  bt_hfp_evt_call_waiting_t
 HFP_EVENT_CALL_WAITING event parameter. More...
 
struct  bt_hfp_evt_command_completed_t
 HFP_EVENT_CMD_COMPLETED event parameter. More...
 
struct  bt_hfp_evt_voice_recognition_changed_t
 HFP_EVENT_VOICE_RECOGNITION_CHANGED event parameter. More...
 
struct  bt_hfp_evt_inband_ring_changed_t
 HFP_EVENT_INBAND_RING_CHANGED event parameter. More...
 
struct  bt_hfp_evt_dial_request_received_t
 HFP_AG_EVENT_DIAL_REQUEST_RECEIVED event parameter. More...
 
struct  bt_hfp_ind
 Stores value of an indicator. More...
 
struct  bt_hfp_hf_ind
 Stores value of an HF indicator. More...
 
struct  bt_hfp_event_register_t
 Stores value of HF registrations. More...
 
struct  bt_hfp_call_t
 Stores information about a call. More...
 
struct  bt_hfp_audio_packet_t
 Parameter to HFP_EVENT_AUDIO_DATA_RECEIVED event. More...
 

Macros

#define bt_hfp_allocate_session(role)   bt_hfp_allocate_session_ex(role, 0, 0, 0)
 Allocate HFP session. More...
 
#define bt_hfp_allocate_session_hf()   bt_hfp_allocate_session(HFP_ROLE_HF)
 Allocate HFP session. More...
 
#define bt_hfp_allocate_session_ag()   bt_hfp_allocate_session(HFP_ROLE_AG)
 Allocate HFP session. More...
 
#define bt_hfp_hf_terminate(session)   bt_hfp_hf_reject(session)
 Terminate the active call. More...
 
#define bt_hfp_has_active_call(session)   ((session->call_status_mask & HFP_CALL_STATUS_MASK_ACTIVE) && !(session->call_status_mask & HFP_CALL_STATUS_MASK_ALL_HELD))
 Determines if there is one or more active calls in the AG. More...
 
#define bt_hfp_has_held_call(session)   ((session->call_status_mask & (HFP_CALL_STATUS_MASK_HELD | HFP_CALL_STATUS_MASK_ALL_HELD)) != 0)
 Determines if there is one or more held calls in the AG. More...
 
#define bt_hfp_has_dialing_call(session)   ((session->call_status_mask & HFP_CALL_STATUS_MASK_DIALING) != 0)
 Determines if there is one or more dialing calls in the AG. More...
 
#define bt_hfp_has_alerting_call(session)   ((session->call_status_mask & HFP_CALL_STATUS_MASK_ALERTING) != 0)
 Determines if there is one or more alerting calls in the AG. More...
 
#define bt_hfp_has_outgoing_call(session)   ((session->call_status_mask & (HFP_CALL_STATUS_MASK_ALERTING | HFP_CALL_STATUS_MASK_DIALING)) != 0)
 Determines if there is one or more outgoing (dialing or alerting) calls in the AG. More...
 
#define bt_hfp_has_incoming_call(session)   ((session->call_status_mask & HFP_CALL_STATUS_MASK_INCOMING) != 0)
 Determines if there is one or more incoming calls in the AG. More...
 
#define bt_hfp_has_waiting_call(session)   ((session->call_status_mask & HFP_CALL_STATUS_MASK_WAITING) != 0)
 Determines if there is one or more waiting calls in the AG. More...
 
#define bt_hfp_is_call_setup_in_progress(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) != HFP_IND_CALLSETUP_NO_CALL_SETUP)
 Determines if there is a call setup in progress. More...
 
#define bt_hfp_is_incoming_call_in_progress(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_INCOMING_CALL_SETUP)
 Determines if there is an incoming call setup in progress. More...
 
#define bt_hfp_is_outgoing_call_in_progress(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_OUTGOING_CALL_SETUP)
 Determines if there is an outgoing call setup in progress. More...
 
#define bt_hfp_is_outgoing_call_remote_alerted(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_OUTGOING_CALL_ALERT_REMOTE)
 Determines if a remote party is being alerted during an outgoing call setup. More...
 
#define bt_hfp_has_only_held_call(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLHELD) == HFP_IND_CALLHELD_ALL_CALLS_HELD)
 Determines if all calls are held. More...
 
#define bt_hfp_has_active_held_call(session)   (bt_hfp_get_indicator_value(session, HFP_IND_CALLHELD) == HFP_IND_CALLHELD_ACTIVE_HELD)
 Determines if there are active and held calls in the AG. More...
 
#define bt_hfp_service_present(session)   (bt_hfp_get_indicator_value(session, HFP_IND_SERVICE) != HFP_IND_SERVICE_NO_SERVICE)
 Determines if the AG is connected to cell network. More...
 
#define bt_hfp_roam_active(session)   (bt_hfp_get_indicator_value(session, HFP_IND_ROAM) != HFP_IND_ROAM_NOT_ACTIVE)
 Determines if roaming is active in the AG. More...
 
#define bt_hfp_get_remote_address(session)   (&session->rfcomm_dlc->psess->pch->hci_conn->bdaddr_remote)
 Get the address of the remote device this device is connected. More...
 
#define bt_hfp_ag_set_mic_gain(session, gain)   bt_hfp_set_mic_gain(session, gain)
 Set HF microphone gain. More...
 
#define bt_hfp_ag_set_speaker_volume(session, volume)   bt_hfp_set_speaker_volume(session, volume)
 Set HF speaker volume. More...
 

Typedefs

typedef void(* bt_hfp_session_callback_pf) (bt_hfp_session_t *session, bt_byte evt, void *evt_param, void *callback_param)
 Notify the application of changes in the HFP session. More...
 
typedef void(* bt_hfp_find_remote_callback_pf) (bt_hfp_session_t *session, bt_byte server_channel, bt_bool found)
 Notify the application of the result of searching for the Audio Gateway. More...
 
typedef void(* bt_hfp_send_audio_callback_pf) (bt_hfp_session_t *session, void *callback_param)
 Notify the application that audio data has been sent to a remote device. More...
 

Functions

bt_bool bt_hfp_init (void)
 Initialize HFP layer. More...
 
bt_hfp_session_t * bt_hfp_allocate_session_ex (bt_byte role, bt_ulong features, bt_byte mic_gain, bt_byte speaker_volume)
 Allocate HFP session. More...
 
bt_hfp_session_t * bt_hfp_allocate_hf_session (bt_ulong features, bt_byte mic_gain, bt_byte speaker_volume)
 Allocate HFP HF session. More...
 
bt_hfp_session_t * bt_hfp_allocate_ag_session (bt_ulong features, bt_byte mic_gain, bt_byte speaker_volume)
 Allocate HFP AG session. More...
 
void bt_hfp_free_session (bt_hfp_session_t *psess)
 Release HFP session. More...
 
bt_bool bt_hfp_listen (bt_hfp_session_t *session, bt_byte server_channel, bt_hfp_session_callback_pf callback, void *callback_param)
 Listen for incoming connections. More...
 
bt_bool bt_hfp_connect (bt_hfp_session_t *session, bt_bdaddr_t *pbdaddr_remote, bt_hfp_session_callback_pf callback, void *callback_param)
 Connect to a remote device. More...
 
bt_bool bt_hfp_hf_disconnect (bt_hfp_session_t *session)
 Close connection. More...
 
bt_bool bt_hfp_hf_query_operator (bt_hfp_session_t *session)
 Request operator's name from AG. More...
 
bt_bool bt_hfp_hf_answer (bt_hfp_session_t *session)
 Answer the incoming call. More...
 
bt_bool bt_hfp_hf_hold (bt_hfp_session_t *session, bt_byte cmd, bt_byte call_index)
 Enhanced call control. More...
 
bt_bool bt_hfp_hf_reject (bt_hfp_session_t *session)
 Reject the incoming call. More...
 
bt_bool bt_hfp_hf_dial_number (bt_hfp_session_t *session, bt_char *number)
 Place a call. More...
 
bt_bool bt_hfp_hf_redial (bt_hfp_session_t *session)
 Redial last dialed number. More...
 
bt_bool bt_hfp_hf_enable_call_waiting_notification (bt_hfp_session_t *session, bt_bool enable)
 Enable/disable call waiting notification. More...
 
bt_bool bt_hfp_set_mic_gain (bt_hfp_session_t *session, bt_byte gain)
 Report microphone gain on the HF to the AG. More...
 
bt_bool bt_hfp_set_speaker_volume (bt_hfp_session_t *session, bt_byte volume)
 Report speaker volume on the HF to the AG. More...
 
bt_bool bt_hfp_hf_get_subscriber_number (bt_hfp_session_t *session)
 Request subscriber number information from the AG. More...
 
bt_byte bt_hfp_get_indicator_value (bt_hfp_session_t *session, bt_byte indicator_id)
 Get current value of an indicator. More...
 
bt_bool bt_hfp_has_call_with_status (bt_hfp_session_t *session, bt_byte status)
 Determines if there is one or more calls in the AG with the specified status. More...
 
bt_bool bt_hfp_hf_refresh_call_list (bt_hfp_session_t *session)
 Request a call list from the AG. More...
 
bt_bool bt_hfp_hf_enable_calling_line_identification (bt_hfp_session_t *session, bt_bool enable)
 Enable/disable calling line identification notification. More...
 
bt_bool bt_hfp_hf_find_ag (bt_hfp_session_t *session, bt_bdaddr_t *deviceAddress, bt_hfp_find_remote_callback_pf callback)
 Find AG. More...
 
bt_bool bt_hfp_hf_enable_voice_recognition (bt_hfp_session_t *session, bt_bool enable)
 Enable/disable calling voice control in the AG. More...
 
bt_bool bt_hfp_hf_disable_nrec (bt_hfp_session_t *session)
 Disable Echo Canceling and Noise Reduction functions in the AG. More...
 
bt_bool bt_hfp_connect_audio (bt_hfp_session_t *session)
 Transfer audio connection from the AG to the HF. More...
 
bt_bool bt_hfp_disconnect_audio (bt_hfp_session_t *session)
 Transfer audio connection from the HF to the AG. More...
 
bt_hci_conn_state_t * bt_hfp_get_hci_connection (const bt_hfp_session_t *session)
 Get HCI connection for a session. More...
 
bt_uint bt_hfp_get_sco_tx_packet_size (const bt_hfp_session_t *session)
 Get the size of the audio payload in the transmit direction. More...
 
bt_uint bt_hfp_get_sco_rx_packet_size (const bt_hfp_session_t *session)
 Get the size of the audio payload in the receive direction. More...
 
bt_hfp_call_t * bt_hfp_ag_incoming_call (bt_hfp_session_t *session, const bt_char *number, bt_int type)
 HFP AG incoming call. More...
 
bt_hfp_call_t * bt_hfp_ag_outgoing_call (bt_hfp_session_t *session, const bt_char *number)
 HFP AG outgoing call. More...
 
void bt_hfp_ag_reject_outgoing_call (bt_hfp_session_t *session)
 HFP AG reject outgoing call. More...
 
void bt_hfp_ag_outgoing_call_alerting (bt_hfp_session_t *session, bt_hfp_call_t *call)
 HFP AG outgoing call alerting. More...
 
void bt_hfp_ag_call_connected (bt_hfp_session_t *session, bt_hfp_call_t *call)
 HFP AG call connected. More...
 
void bt_hfp_ag_call_disconnected (bt_hfp_session_t *session, bt_hfp_call_t *call)
 HFP AG call disconnected. More...
 
bt_bool bt_hfp_ag_set_service_state (bt_hfp_session_t *session, bt_byte ind_val)
 Set Service State indicator value. More...
 
bt_bool bt_hfp_ag_set_signal_strength (bt_hfp_session_t *session, bt_byte ind_val)
 Set Signal Strength indicator value. More...
 
bt_bool bt_hfp_ag_set_roam_state (bt_hfp_session_t *session, bt_byte ind_val)
 Set Roaming State indicator value. More...
 
bt_bool bt_hfp_ag_set_battery_level (bt_hfp_session_t *session, bt_byte ind_val)
 Set Battery Level indicator value. More...
 
bt_bool bt_hfp_ag_set_inband_ring (bt_hfp_session_t *session, bt_byte ind_val)
 Send Inband ring notification to HF device. More...
 
bt_bool bt_hfp_activate_voice_recognition (bt_hfp_session_t *session, bt_bool activate)
 Send voice recognition activation notification to HF device. More...
 
bt_bool bt_hfp_ag_set_operator_name (bt_hfp_session_t *session, const bt_byte *name)
 Set Operator name. More...
 
bt_bool bt_hfp_ag_set_subscriber_number (bt_hfp_session_t *session, const bt_byte *number, bt_byte type, bt_byte service)
 Set Subscriber number. More...
 
bt_bool bt_hfp_add_audio_rx_buffer (bt_hfp_session_t *session, bt_hfp_audio_packet_t *buffer)
 Add an audio packet buffer to a receive queue. More...
 
bt_bool bt_hfp_add_audio_tx_buffer (bt_hfp_session_t *session, bt_hfp_audio_packet_t *buffer)
 Add an audio packet buffer to a send queue. More...
 
bt_bool bt_hfp_hf_xapl_set_battery_level (bt_hfp_session_t *session, bt_byte level)
 Set local HF device's battery charge level. More...
 
bt_bool bt_hfp_hf_xapl_set_dock_state (bt_hfp_session_t *session, bt_byte state)
 Set local HF device's dock state. More...
 
bt_bool bt_hfp_hf_xapl_set_headset_state (bt_hfp_session_t *session, const bt_byte *keys, const bt_byte *values, bt_byte value_count)
 Reports a headset state. More...
 
bt_bool bt_hfp_hf_set_hf_indicator (bt_hfp_session_t *session, bt_byte id, bt_byte value)
 Set HF indicator value. More...
 
bt_byte bt_hfp_hf_get_hf_indicator (bt_hfp_session_t *session, bt_byte id)
 Get HF indicator value. More...
 
bt_bool bt_hfp_hf_set_battery_level (bt_hfp_session_t *session, bt_byte level)
 Set local HF device's battery charge level. More...
 

Detailed Description

Macro Definition Documentation

#define bt_hfp_ag_set_mic_gain (   session,
  gain 
)    bt_hfp_set_mic_gain(session, gain)

Set HF microphone gain.

This function sets microphone gain on the HF. The AG can call this function to set the HF's microphone gain.

Parameters
sessionHFP session.
gainMicrophone gain (0 - 15)
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_hfp_ag_set_speaker_volume (   session,
  volume 
)    bt_hfp_set_speaker_volume(session, volume)

Set HF speaker volume.

This function sets speaker volume on the HF. The AG can call this function to set HF's speaker volume.

Parameters
sessionHFP session.
gainSpeaker volume (0 - 15)
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_hfp_allocate_session (   role)    bt_hfp_allocate_session_ex(role, 0, 0, 0)

Allocate HFP session.

This function allocates a new HFP session. Initial values of HFP features, microphone gain and speaker volume are set to 0. Use bt_hfp_allocate_session_ex initialize the session with concrete values of HFP features, microphone gain and speaker volume.

Parameters
roleHFP_ROLE_HF or HFP_ROLE_AG.
Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
#define bt_hfp_allocate_session_ag ( )    bt_hfp_allocate_session(HFP_ROLE_AG)

Allocate HFP session.

This function allocates a new AG HFP session.

Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
#define bt_hfp_allocate_session_hf ( )    bt_hfp_allocate_session(HFP_ROLE_HF)

Allocate HFP session.

This function allocates a new HF HFP session.

Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
#define bt_hfp_get_remote_address (   session)    (&session->rfcomm_dlc->psess->pch->hci_conn->bdaddr_remote)

Get the address of the remote device this device is connected.

Parameters
sessionHFP session.
Returns
  • A pointer to bt_bdaddr structure that contains the address of the remote device.
#define bt_hfp_has_active_call (   session)    ((session->call_status_mask & HFP_CALL_STATUS_MASK_ACTIVE) && !(session->call_status_mask & HFP_CALL_STATUS_MASK_ALL_HELD))

Determines if there is one or more active calls in the AG.

This macro determines if there is one or more active calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are active calls.
  • FALSE otherwise.
#define bt_hfp_has_active_held_call (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLHELD) == HFP_IND_CALLHELD_ACTIVE_HELD)

Determines if there are active and held calls in the AG.

This macro determines if there are active and held calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are active and held calls in the AG.
  • FALSE otherwise.
#define bt_hfp_has_alerting_call (   session)    ((session->call_status_mask & HFP_CALL_STATUS_MASK_ALERTING) != 0)

Determines if there is one or more alerting calls in the AG.

This macro determines if there is one or more alerting calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are alerting calls.
  • FALSE otherwise.
#define bt_hfp_has_dialing_call (   session)    ((session->call_status_mask & HFP_CALL_STATUS_MASK_DIALING) != 0)

Determines if there is one or more dialing calls in the AG.

This macro determines if there is one or more dialing calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are dialing calls.
  • FALSE otherwise.
#define bt_hfp_has_held_call (   session)    ((session->call_status_mask & (HFP_CALL_STATUS_MASK_HELD | HFP_CALL_STATUS_MASK_ALL_HELD)) != 0)

Determines if there is one or more held calls in the AG.

This macro determines if there is one or more held calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are held calls.
  • FALSE otherwise.
#define bt_hfp_has_incoming_call (   session)    ((session->call_status_mask & HFP_CALL_STATUS_MASK_INCOMING) != 0)

Determines if there is one or more incoming calls in the AG.

This macro determines if there is one or more incoming calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are incoming calls.
  • FALSE otherwise.
#define bt_hfp_has_only_held_call (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLHELD) == HFP_IND_CALLHELD_ALL_CALLS_HELD)

Determines if all calls are held.

This macro determines if all calls in the AG are held.

Parameters
sessionHFP session.
Returns
  • TRUE if all calls are held.
  • FALSE otherwise.
#define bt_hfp_has_outgoing_call (   session)    ((session->call_status_mask & (HFP_CALL_STATUS_MASK_ALERTING | HFP_CALL_STATUS_MASK_DIALING)) != 0)

Determines if there is one or more outgoing (dialing or alerting) calls in the AG.

This macro determines if there is one or more outgoing (dialing or alerting) calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are outgoing calls.
  • FALSE otherwise.
#define bt_hfp_has_waiting_call (   session)    ((session->call_status_mask & HFP_CALL_STATUS_MASK_WAITING) != 0)

Determines if there is one or more waiting calls in the AG.

This macro determines if there is one or more waiting calls in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if there are waiting calls.
  • FALSE otherwise.
#define bt_hfp_hf_terminate (   session)    bt_hfp_hf_reject(session)

Terminate the active call.

If there is an active call in the AG the app may call this function to terminate it. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_hfp_is_call_setup_in_progress (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) != HFP_IND_CALLSETUP_NO_CALL_SETUP)

Determines if there is a call setup in progress.

This macro determines if a call is being setup, i.e., there is an answered incoming or outgoing call.

Parameters
sessionHFP session.
Returns
  • TRUE if there is a call setup in progress.
  • FALSE otherwise.
#define bt_hfp_is_incoming_call_in_progress (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_INCOMING_CALL_SETUP)

Determines if there is an incoming call setup in progress.

This macro determines if a incoming call is being setup, i.e., there is an answered incoming call.

Parameters
sessionHFP session.
Returns
  • TRUE if there is an incoming call setup in progress.
  • FALSE otherwise.
#define bt_hfp_is_outgoing_call_in_progress (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_OUTGOING_CALL_SETUP)

Determines if there is an outgoing call setup in progress.

This macro determines if a outgoing call is being setup, i.e., there is an answered outgoing call.

Parameters
sessionHFP session.
Returns
  • TRUE if there is an outgoing call setup in progress.
  • FALSE otherwise.
#define bt_hfp_is_outgoing_call_remote_alerted (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_CALLSETUP) == HFP_IND_CALLSETUP_OUTGOING_CALL_ALERT_REMOTE)

Determines if a remote party is being alerted during an outgoing call setup.

This macro determines if a remote party is being alerted during an outgoing call setup.

Parameters
sessionHFP session.
Returns
  • TRUE if a remote party is being alerted during an outgoing call setup.
  • FALSE otherwise.
#define bt_hfp_roam_active (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_ROAM) != HFP_IND_ROAM_NOT_ACTIVE)

Determines if roaming is active in the AG.

This macro determines if roaming is active in the AG.

Parameters
sessionHFP session.
Returns
  • TRUE if roaming is active in the AG.
  • FALSE otherwise.
#define bt_hfp_service_present (   session)    (bt_hfp_get_indicator_value(session, HFP_IND_SERVICE) != HFP_IND_SERVICE_NO_SERVICE)

Determines if the AG is connected to cell network.

This macro determines if the AG is connected to cell network.

Parameters
sessionHFP session.
Returns
  • TRUE if the AG is connected to cell network.
  • FALSE otherwise.

Typedef Documentation

typedef void(* bt_hfp_find_remote_callback_pf) (bt_hfp_session_t *session, bt_byte server_channel, bt_bool found)

Notify the application of the result of searching for the Audio Gateway.

This function is called by the HFP layer when searching for the Audio Gateway on a remote device has completed.

Parameters
sessionHFP session.
server_channelThe RFCOMM server channel used by the Audio Gateway. The application must pass this value to bt_hfp_connect. The value is valid only if the found parameter is TRUE.
foundTRUE if Audio Gateway has been found on the remote device. FALSE otherwise.
typedef void(* bt_hfp_send_audio_callback_pf) (bt_hfp_session_t *session, void *callback_param)

Notify the application that audio data has been sent to a remote device.

This function is called by the HFP layer when audio data has been sent to a remote device.

Parameters
sessionHFP session.
callback_paramThe value of the callback_param parameter passed to the call of bt_hfp_send_audio.
typedef void(* bt_hfp_session_callback_pf) (bt_hfp_session_t *session, bt_byte evt, void *evt_param, void *callback_param)

Notify the application of changes in the HFP session.

This function is called by the HFP layer when various session parameters have changed. It is also called when commands from the remote device or response codes to the commands sent to the the remote device are received.

Parameters
sessionHFP session.
evtSpecifies the id of the event. The value of this arguments is one of the values defined by HFP_EVENT_ constants. Each event has a parameter that points to an event specific structure that clarifies the event. The event parameter is passed through the evt_param parameter.
  • HSP_SESSION_RFCOMM_CONNECTION_STATE_CHANGED - The RFCOMM connection state has changed. The application should examine the value of the bt_hsp_session::state member to determine weather the RFCOMM session has connected or disconnected. The RFCOMM session has connected if the HSP_SESSION_STATE_RFCOMM_CONNECTED bit is set in the bt_hsp_session::state member.
  • HSP_SESSION_SCO_CONNECTION_STATE_CHANGED - The SCO connection state has changed. The application should examine the value of the bt_hsp_session::state member to determine weather the RFCOMM session has connected or disconnected. The RFCOMM session has connected if the HSP_SESSION_STATE_SCO_CONNECTED bit is set in the bt_hsp_session::state member.
  • HSP_SESSION_CMD_RESPONSE_RECEIVED - The Headset has received a response to the command it sent to the Audio Gateway. The response is a string pointed to by the what_param parameter. It can be either HS_RES_OK or HS_RES_ERROR.
  • HSP_SESSION_RING - The Audio gateway has sent the RING unsolicited result code. The application must respond to this result code by sending the button press (call bt_hsp_hs_send_button_press).
  • HSP_SESSION_AUDIO_DATA_RECEIVED - The audio data has been received. The pointer to a buffer is passed in the what_param parameter. The length of the data is passed in the what_param2 parameter (cast to bt_int).
  • HSP_SESSION_HEADSET_CONNECT_ATTEMPT - The attempt to connect to the Audio Gateway has failed.
  • HSP_SESSION_MIC_VOLUME_CHANGED - The Audio Gateway has changed the microphone gain. The new value is passed in the what_param parameter (cast to bt_byte).
  • HSP_SESSION_SPK_VOLUME_CHANGED - The Audio Gateway has changed the speaker volume. The new value is passed in the what_param parameter (cast to bt_byte)
Parameters
evt_paramThe event's parameter.
callback_paramThe value of the callback_param passed to the call of bt_hfp_listen or bt_hfp_connect.

Function Documentation

bt_bool bt_hfp_activate_voice_recognition ( bt_hfp_session_t *  session,
bt_bool  activate 
)

Send voice recognition activation notification to HF device.

This function should be called by the application to indicate to the HF that the voice recognition in the AG has been activated or deactivated.

This function should be called when Service Level Connection has been established.

Parameters
sessionHFP session.
activateFALSE - voice recognition has been activated in the AG. TRUE - voice recognition has been deactivated in the AG.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range, or RFCOMM connection is not established.
bt_bool bt_hfp_add_audio_rx_buffer ( bt_hfp_session_t *  session,
bt_hfp_audio_packet_t *  buffer 
)

Add an audio packet buffer to a receive queue.

An application is responsible for allocating and supplying HFP with buffers used to store received packets. HFP itself only has a queue for storing pointers to buffers supplied by the app. When a packet comes in HFP finds the first buffer large enough to hold the received packet, copies the packet to the buffer and generates a HFP_EVENT_AUDIO_DATA_RECEIVED event. The app then has to process the data in the buffer and return it back to the queue. If there is no buffers in the queue or none of the buffers is large enough the received packets is dropped. Each buffer has a field (data_len) that holds the length of the received buffer. This field is never 0 if the buffer contains a packet. If audio connection closed regardless of what has caused that and there are still buffers in the queue HFP generates a HFP_EVENT_AUDIO_DATA_RECEIVED event for each buffer and sets the data_len to 0. This is to inform the app that the buffer has not been used and can be, for example, deallocated. This function adds a buffer to the receive queue.

Parameters
sessionHFP session.
bufferPointer to a structure that holds the buffer and its parameters.
Returns
  • TRUE. This function never fails.
bt_bool bt_hfp_add_audio_tx_buffer ( bt_hfp_session_t *  session,
bt_hfp_audio_packet_t *  buffer 
)

Add an audio packet buffer to a send queue.

When an application wants to send an audio packet to a remote device it calls this function. The function adds the packet to a queue and tells HFP that it has something to send. The packet will be send as soon as possible. When the packet has been sent a HFP_EVENT_AUDIO_PACKET_SENT is generated. The app can then re-use the buffer as HFP has removed it from the queue and gave up control over it. As in the case of received buffers, if an audio connection closed regardless of what has caused that and there are still buffers in the queue HFP generates a HFP_EVENT_AUDIO_PACKET_SENT event for each buffer and sets the data_len field to 0. This is to inform the app that the buffer has not been used and can be, for example, deallocated.

Parameters
sessionHFP session.
bufferPointer to a structure that holds the buffer and its parameters.
Returns
  • TRUE. This function never fails.
void bt_hfp_ag_call_connected ( bt_hfp_session_t *  session,
bt_hfp_call_t *  call 
)

HFP AG call connected.

This function should be called when incoming call has been answered locally, or outgoing call has been answered by remote party. The call is in the connected state. As a result HFP AG sends notification to connected HF device.

Parameters
sessionHFP session.
callHFP call.
void bt_hfp_ag_call_disconnected ( bt_hfp_session_t *  session,
bt_hfp_call_t *  call 
)

HFP AG call disconnected.

This function should be called when a call has been terminated. It can be local or remote termination of the outgoing or connected call, as well as rejection of the incoming call. As a result HFP AG sends notification to connected HF device.

Parameters
sessionHFP session.
callHFP call.
bt_hfp_call_t* bt_hfp_ag_incoming_call ( bt_hfp_session_t *  session,
const bt_char *  number,
bt_int  type 
)

HFP AG incoming call.

This function should be called when AG receives notification from the cellular baseband about an incoming call. As a result HFP AG saves information about the call and send notification to all connected HF devices.

Parameters
sessionHFP session.
numberstring type phone number of format specified by type
type
  • 128 - both the type of number and the numbering plan are unknown
  • 129 - unknown type of number and ISDN/Telephony numbering plan
  • 145 - international type of number and ISDN/Telephony numbering plan (contains the character "+")
Returns
  • A pointer to the new HFP call structure if the function succeeds.
  • NULL otherwise.
bt_hfp_call_t* bt_hfp_ag_outgoing_call ( bt_hfp_session_t *  session,
const bt_char *  number 
)

HFP AG outgoing call.

This function should be called when AG receives notification from the cellular baseband about an outgoing call. As a result HFP AG saves information about the call and send notification to all connected HF devices.

Parameters
sessionHFP session.
numberstring type phone number of format specified by type
Returns
  • A pointer to the new HFP call structure if the function succeeds.
  • NULL otherwise.
void bt_hfp_ag_outgoing_call_alerting ( bt_hfp_session_t *  session,
bt_hfp_call_t *  call 
)

HFP AG outgoing call alerting.

This function should be called when AG receives notification that the outgoing call is alerting remote party. As a result HFP AG sends notification to all connected HF devices.

Parameters
sessionHFP session.
callHFP call.
void bt_hfp_ag_reject_outgoing_call ( bt_hfp_session_t *  session)

HFP AG reject outgoing call.

This function should be called by AG to abort a request from HF to dial a number stored in memory or re-dial last number dialed.

Parameters
sessionHFP session.
bt_bool bt_hfp_ag_set_battery_level ( bt_hfp_session_t *  session,
bt_byte  ind_val 
)

Set Battery Level indicator value.

This function should be called by the application during session initialization and when battery level changes.

Parameters
sessionHFP session.
ind_valCurrent battery level. Valid values are between 0 for low battery and 5 when battery is full.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range.
bt_bool bt_hfp_ag_set_inband_ring ( bt_hfp_session_t *  session,
bt_byte  ind_val 
)

Send Inband ring notification to HF device.

This function should be called by the application to indicate to the HF that the in-band ring tone setting has been locally changed.

This function should be called when Service Level Connection has been established.

Parameters
sessionHFP session.
ind_valIndicator value. 0 - the AG provides no in-band ring tone. 1 - the AG provides an in-band ring tone.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range, or RFCOMM connection is not established.
bt_bool bt_hfp_ag_set_operator_name ( bt_hfp_session_t *  session,
const bt_byte *  name 
)

Set Operator name.

This function should be called by the application during session initialization.

Parameters
sessionHFP session.
nameOperator's name.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range.
bt_bool bt_hfp_ag_set_roam_state ( bt_hfp_session_t *  session,
bt_byte  ind_val 
)

Set Roaming State indicator value.

This function should be called by the application during session initialization and every time roaming state changes.

Parameters
sessionHFP session.
ind_valCurrent roaming state. Valid values are 1 when the phone is roaming, 0 when phone is in home network.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range.
bt_bool bt_hfp_ag_set_service_state ( bt_hfp_session_t *  session,
bt_byte  ind_val 
)

Set Service State indicator value.

This function should be called by the application during session initialization and every time service state goes up or down.

Parameters
sessionHFP session.
ind_valCurrent service state. Valid values are 1 for service present, 0 otherwise.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range.
bt_bool bt_hfp_ag_set_signal_strength ( bt_hfp_session_t *  session,
bt_byte  ind_val 
)

Set Signal Strength indicator value.

This function should be called by the application during session initialization and every time signal strength value changes.

Parameters
sessionHFP session.
ind_valCurrent signal strength. Valid values are between 0 for low signal and 5 for maximum signal.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range.
bt_bool bt_hfp_ag_set_subscriber_number ( bt_hfp_session_t *  session,
const bt_byte *  number,
bt_byte  type,
bt_byte  service 
)

Set Subscriber number.

This function should be called by the application during session initialization.

Parameters
sessionHFP session.
numberstring type phone number of format specified by type
type
  • 128 - both the type of number and the numbering plan are unknown
  • 129 - unknown type of number and ISDN/Telephony numbering plan
  • 145 - international type of number and ISDN/Telephony numbering plan (contains the character "+")
serviceIndicates which service this phone number relates to. Shall be either 4 (voice) or 5 (fax).
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter is out of range.
bt_hfp_session_t* bt_hfp_allocate_ag_session ( bt_ulong  features,
bt_byte  mic_gain,
bt_byte  speaker_volume 
)

Allocate HFP AG session.

This function allocates a new HFP AG session.

Parameters
featuresHFP entity features. This parameter can be a combination of the following values:
  • #define HFP_AG_FEATURE_3_WAY_CALLING
  • #define HFP_AG_FEATURE_EC_NR
  • #define HFP_AG_FEATURE_VOICE_RECOGNITTION
  • #define HFP_AG_FEATURE_INBAND_RING_TONE
  • #define HFP_AG_FEATURE_ATTACH_NUMBER_TO_VOICE_TAG
  • #define HFP_AG_FEATURE_REJECT_CALL
  • #define HFP_AG_FEATURE_ENHANCED_CALL_STATUS
  • #define HFP_AG_FEATURE_ENHANCED_CALL_CONTROL
  • #define HFP_AG_FEATURE_EXTENDED_ERROR_CODED
  • #define HFP_AG_FEATURE_CODEC_NEGOTIATION
  • #define HFP_AG_FEATURE_HF_INDICATORS
  • #define HFP_AG_FEATURE_ESCO_S4
mic_gainInitial microphone gain. The value should be in the range from 0 to 15.
speaker_volumeInitial speaker volume. The value should be in the range from 0 to 15.
Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
bt_hfp_session_t* bt_hfp_allocate_hf_session ( bt_ulong  features,
bt_byte  mic_gain,
bt_byte  speaker_volume 
)

Allocate HFP HF session.

This function allocates a new HFP HF session.

Parameters
featuresHFP entity features. This parameter can be a combination of the following values:
  • HFP_HF_FEATURE_EC_NR
  • HFP_HF_FEATURE_CALL_WAITING
  • HFP_HF_FEATURE_CLI_PRESENTATION
  • HFP_HF_FEATURE_VOICE_RECOGNITTION
  • HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL
  • HFP_HF_FEATURE_ENHANCED_CALL_STATUS
  • HFP_HF_FEATURE_ENHANCED_CALL_CONTROL
  • HFP_HF_FEATURE_CODEC_NEGOTIATION
  • HFP_HF_FEATURE_HF_INDICATORS
  • HFP_HF_FEATURE_ESCO_S4 To set all flags use HFP_HF_FEATURE_ALL
mic_gainInitial microphone gain. The value should be in the range from 0 to 15.
speaker_volumeInitial speaker volume. The value should be in the range from 0 to 15.
Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
bt_hfp_session_t* bt_hfp_allocate_session_ex ( bt_byte  role,
bt_ulong  features,
bt_byte  mic_gain,
bt_byte  speaker_volume 
)

Allocate HFP session.

This function allocates a new HFP session.

Parameters
roleHFP_ROLE_HF or HFP_ROLE_AG.
featuresHFP entity features. If is HFP_ROLE_HF this parameter can be a combination of the following values:
  • HFP_HF_FEATURE_EC_NR
  • HFP_HF_FEATURE_CALL_WAITING
  • HFP_HF_FEATURE_CLI_PRESENTATION
  • HFP_HF_FEATURE_VOICE_RECOGNITTION
  • HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL
  • HFP_HF_FEATURE_ENHANCED_CALL_STATUS
  • HFP_HF_FEATURE_ENHANCED_CALL_CONTROL
  • HFP_HF_FEATURE_CODEC_NEGOTIATION
  • HFP_HF_FEATURE_HF_INDICATORS
  • HFP_HF_FEATURE_ESCO_S4 To set all flags use HFP_HF_FEATURE_ALL
If is HFP_ROLE_AG this parameter can be a combination of the following values:
  • #define HFP_AG_FEATURE_3_WAY_CALLING
  • #define HFP_AG_FEATURE_EC_NR
  • #define HFP_AG_FEATURE_VOICE_RECOGNITTION
  • #define HFP_AG_FEATURE_INBAND_RING_TONE
  • #define HFP_AG_FEATURE_ATTACH_NUMBER_TO_VOICE_TAG
  • #define HFP_AG_FEATURE_REJECT_CALL
  • #define HFP_AG_FEATURE_ENHANCED_CALL_STATUS
  • #define HFP_AG_FEATURE_ENHANCED_CALL_CONTROL
  • #define HFP_AG_FEATURE_EXTENDED_ERROR_CODED
  • #define HFP_AG_FEATURE_CODEC_NEGOTIATION
  • #define HFP_AG_FEATURE_HF_INDICATORS
  • #define HFP_AG_FEATURE_ESCO_S4
mic_gainInitial microphone gain. The value should be in the range from 0 to 15.
speaker_volumeInitial speaker volume. The value should be in the range from 0 to 15.
Returns
  • A pointer to the new HFP session structure if the function succeeds.
  • NULL otherwise.
bt_bool bt_hfp_connect ( bt_hfp_session_t *  session,
bt_bdaddr_t *  pbdaddr_remote,
bt_hfp_session_callback_pf  callback,
void *  callback_param 
)

Connect to a remote device.

This function establishes a HFP connection with a remote device which is running in Audio Gateway mode. Changes in the session state are reported through a callback function.

Parameters
sessionHFP session.
remote_addrAddress of the remote device.
callbackA callback function that is called when session state changes.
callback_paramAn arbitrary data pointer that will be passed to the callback function specified by the callback parameter.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. The callback function is not called in this case.
bt_bool bt_hfp_connect_audio ( bt_hfp_session_t *  session)

Transfer audio connection from the AG to the HF.

This function establishes a SCO connection to the AG. As a result the AG will route its audio path to the HF. The result of calling this function will be HFP_EVENT_AUDIO_CONNECTION_STATE_CHANGED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. the HFP_EVENT_AUDIO_CONNECTION_STATE_CHANGED event is not reported in this case.
bt_bool bt_hfp_disconnect_audio ( bt_hfp_session_t *  session)

Transfer audio connection from the HF to the AG.

This function terminates the SCO connection to the AG. As a result the AG will route its audio path to itself. The result of calling this function will be HFP_EVENT_AUDIO_CONNECTION_STATE_CHANGED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. the HFP_EVENT_AUDIO_CONNECTION_STATE_CHANGED event is not reported in this case.
void bt_hfp_free_session ( bt_hfp_session_t *  psess)

Release HFP session.

This function deallocated the specified HFP session. This function does not disconnect the session. It just frees the memory used by the bt_hfp_session structure. The session has to be disconnected by a remote device or by calling bt_hfp_hf_disconnect.

Parameters
sessionThe HFP session to be deallocated.
bt_hci_conn_state_t* bt_hfp_get_hci_connection ( const bt_hfp_session_t *  session)

Get HCI connection for a session.

This function returns a pointer to a structure that describes an HCI connection a session is open on. The return value can be used to call various function from the HCI layer. For example, if an app wants to force disconnection from a remote device it can call bt_hci_disconnect.

Parameters
sessionHFP session.
Returns
  • Pointer to a structure that describes an HCI connection if the function succeeds.
  • NULL if there is no HCI connection associated with the session.
bt_byte bt_hfp_get_indicator_value ( bt_hfp_session_t *  session,
bt_byte  indicator_id 
)

Get current value of an indicator.

This function returns a value stored on the local device.

Parameters
sessionHFP session.
indicator_idthe ID if the indicator
Returns
  • Current indicator's value.
bt_uint bt_hfp_get_sco_rx_packet_size ( const bt_hfp_session_t *  session)

Get the size of the audio payload in the receive direction.

This function returns the maximum size of one SCO/eSCO packet in the receive direction. An application may use the value returned by this function to allocate bt_hfp_audio_packet_t::data buffer for passing to bt_hfp_add_audio_rx_buffer. If the app chooses to use the SCO/eSCO packet size, the size of the buffer should be a multiple of the SCO/eSCO packet size.

Parameters
sessionHFP session.
Returns
  • The maximum size of one SCO/eSCO packet in the receive direction.
  • 0 if there is no SCO/eSCO connection associated with the session.
bt_uint bt_hfp_get_sco_tx_packet_size ( const bt_hfp_session_t *  session)

Get the size of the audio payload in the transmit direction.

This function returns the maximum size of one SCO/eSCO packet in the transmit direction. An application should use the value returned by this function to allocate bt_hfp_audio_packet_t::data buffer for passing to bt_hfp_add_audio_tx_buffer. The size of the buffer should be a multiple (usually 1 or 2 is sufficient) of the SCO/eSCO packet size.

Parameters
sessionHFP session.
Returns
  • The maximum size of one SCO/eSCO packet in the transmit direction.
  • 0 if there is no SCO/eSCO connection associated with the session.
bt_bool bt_hfp_has_call_with_status ( bt_hfp_session_t *  session,
bt_byte  status 
)

Determines if there is one or more calls in the AG with the specified status.

This function does not send any commands to the AG. It uses a list of calls stored on the local device.

Parameters
sessionHFP session.
statusa bit mask of HFP_CALL_STATUS_ constants that defines statuses of calls to be checked.
Returns
  • TRUE if there are calls with specified statuses.
  • FALSE otherwise.
bt_bool bt_hfp_hf_answer ( bt_hfp_session_t *  session)

Answer the incoming call.

If there is an incoming call in the AG the app may call this function to accept it. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event followed by HFP_EVENT_CALL_STARTED event.

Parameters
sessionHSP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_dial_number ( bt_hfp_session_t *  session,
bt_char *  number 
)

Place a call.

Intiate an outgoing call. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
numberPhone number to dial.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_disable_nrec ( bt_hfp_session_t *  session)

Disable Echo Canceling and Noise Reduction functions in the AG.

This function should be called by the application to disable any Echo Canceling and Noise Reduction functions embedded in the AG. The result of calling this function will be HFP_EVENT_NREC_DISABLED event.

This function should be called when Service Level Connection has been established and before any Audio Connection between the HF and the AG is established.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE if parameter if out of range, or RFCOMM connection is not established.
bt_bool bt_hfp_hf_disconnect ( bt_hfp_session_t *  session)

Close connection.

This function closes a HFP connection with a remote device. Changes in the session state are reported through a callback function set when connection was created by calling bt_hfp_connect or bt_hfp_listen.

Parameters
sessionHSP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_enable_call_waiting_notification ( bt_hfp_session_t *  session,
bt_bool  enable 
)

Enable/disable call waiting notification.

Request AG to enable or disable call waiting notification. If call waiting notification is enabled, the AG will notify the HF whenever an incoming call is waiting during an ongoing call. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event. There is usually no need to call this function directly as the call waiting notification is enabled during SLC setup.

Parameters
sessionHFP session.
enableTRUE - to enable call waiting notification, FALSE - to disable it.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_enable_calling_line_identification ( bt_hfp_session_t *  session,
bt_bool  enable 
)

Enable/disable calling line identification notification.

Request AG to enable or disable calling line identification notification. If calling line identification notification is enabled and the calling number is available from the network, the AG will notify the HF whenever there is an incoming call. The application will receive HFP_EVENT_CLIP_RECEIVED event. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event. There is usually no need to call this function directly as the calling line identification notification is enabled during SLC setup.

Parameters
sessionHFP session.
enableTRUE - to enable calling line identification notification, FALSE - to disable it.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_enable_voice_recognition ( bt_hfp_session_t *  session,
bt_bool  enable 
)

Enable/disable calling voice control in the AG.

Request AG to enable or disable voice control. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
enableTRUE - to enable voice control, FALSE - to disable it.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_find_ag ( bt_hfp_session_t *  session,
bt_bdaddr_t *  deviceAddress,
bt_hfp_find_remote_callback_pf  callback 
)

Find AG.

This function connects to a remote device and tries to find the AG on it. If the remote device implements HFP AG this function returns (via callback) the RFCOMM channel which should be used to connect to it.

Parameters
sessionHFP session.
deviceAddressRemote device's address.
callbackA pointer to a function which is called when AG search is complete.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. the callback is not called in this case.
bt_byte bt_hfp_hf_get_hf_indicator ( bt_hfp_session_t *  session,
bt_byte  id 
)

Get HF indicator value.

This function returns indicator's value stored in session.

Parameters
sessionHFP session.
idIndicator Id. The id can be one of the following values:
  • HFP_HF_IND_ENHANCED_SAFETY
  • HFP_HF_IND_BATTERY_LEVEL
Returns
  • TRUE if the function succeeds.
  • FALSE if indicator's Id is invalid.
bt_bool bt_hfp_hf_get_subscriber_number ( bt_hfp_session_t *  session)

Request subscriber number information from the AG.

This function sends a command to the AG which causes it to send back subscriber number information. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event followed by HFP_EVENT_SUBSCRIBER_NUMBER_RECEIVED event. The caller can retrieve the information from the bt_hfp_session::subscriber_number.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. The callback function is not called in this case.
bt_bool bt_hfp_hf_hold ( bt_hfp_session_t *  session,
bt_byte  cmd,
bt_byte  call_index 
)

Enhanced call control.

If there is an incoming call in the AG the app may call this function to reject it. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
cmdCommand Id.
callindex Call index.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_query_operator ( bt_hfp_session_t *  session)

Request operator's name from AG.

This function requests operator's name from the AG. The result of this call is reported to the app in the form of the HFP_EVENT_QUERY_OPERATOR_COMPLETED event.
There is usually no need to call this function directly as the operator's name is requested and reported to the app during SLC setup.

Parameters
sessionHSP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_redial ( bt_hfp_session_t *  session)

Redial last dialed number.

Request AG to dial last dialed number. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_refresh_call_list ( bt_hfp_session_t *  session)

Request a call list from the AG.

This function send a command to the AG which causes it to send back a list of all calls it currently has. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event followed by HFP_EVENT_CALL_LIST_RECEIVED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_reject ( bt_hfp_session_t *  session)

Reject the incoming call.

If there is an incoming call in the AG the app may call this function to reject it. The result of calling this function will be HFP_EVENT_CMD_COMPLETED event.

Parameters
sessionHFP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_hf_set_battery_level ( bt_hfp_session_t *  session,
bt_byte  level 
)

Set local HF device's battery charge level.

This function stores current battery charge level in session and sends it to AG device if the AG supports battery level reporting. The battery level, depending on AG capabilities, is sent using Apple extension or native HFP command.

Parameters
sessionHFP session.
levelBattery charge level. Valid range is 0 - 100.
Returns
  • TRUE if the function succeeds.
  • FALSE if sending a command to AG failed.
bt_bool bt_hfp_hf_set_hf_indicator ( bt_hfp_session_t *  session,
bt_byte  id,
bt_byte  value 
)

Set HF indicator value.

This function stores indicator's value in session and sends it to AG device if the AG supports HF indicators reporting.

Parameters
sessionHFP session.
idIndicator Id. The id can be one of the following values:
  • HFP_HF_IND_ENHANCED_SAFETY
  • HFP_HF_IND_BATTERY_LEVEL
idIndicator value.
Returns
  • TRUE if the function succeeds.
  • FALSE if indicator's Id is invalid or sending a command to AG failed.
bt_bool bt_hfp_hf_xapl_set_battery_level ( bt_hfp_session_t *  session,
bt_byte  level 
)

Set local HF device's battery charge level.

This function sends current battery charge level to AG device using Apple's custom command if the AG supports Apple extensions to HFP.

Parameters
sessionHFP session.
levelBattery charge level. Valid range is 0 - 9.
Returns
  • TRUE if the function succeeds.
  • FALSE if sending a command to AG failed.
bt_bool bt_hfp_hf_xapl_set_dock_state ( bt_hfp_session_t *  session,
bt_byte  state 
)

Set local HF device's dock state.

This function sends current dock state to AG device using Apple's custom command if the AG supports Apple extensions to HFP.

Parameters
sessionHFP session.
stateDock state. 0 - undocked, 1 - docked.
Returns
  • TRUE if the function succeeds.
  • FALSE if sending a command to AG failed.
bt_bool bt_hfp_hf_xapl_set_headset_state ( bt_hfp_session_t *  session,
const bt_byte *  keys,
const bt_byte *  values,
bt_byte  value_count 
)

Reports a headset state.

This function sends current state of a headset to AG device using Apple's custom command if the AG supports Apple extensions to HFP.

Parameters
sessionHFP session.
keysA list of states to report. An item of keys can be one the following values:
  • HFP_XAPL_KEY_BATTERY_LEVEL
  • HFP_XAPL_KEY_DOCK_STATE
valuesA list of state values to report.
value_countThe number of states in keys and values.
Returns
  • TRUE if the function succeeds.
  • FALSE if sending a command to AG failed.
bt_bool bt_hfp_init ( void  )

Initialize HFP layer.

This function initializes the HFP layer of the stack. It must be called prior to any other HFP function can be called.

bt_bool bt_hfp_listen ( bt_hfp_session_t *  session,
bt_byte  server_channel,
bt_hfp_session_callback_pf  callback,
void *  callback_param 
)

Listen for incoming connections.

This function enables incoming connections on the specified HFP session. Changes in the session state are reported through a callback function.

Parameters
sessionHFP session.
server_channelAn RFCOMM server channel on which the RFCOMM session specified in the call to bt_hfp_allocate_session will be listening.
callbackA callback function that is called when session state changes or data (command or response) is received from the remote party.
callback_paramAn arbitrary data pointer that will be passed to the callback function specified by the callback parameter.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. The callback function is not called in this case.
bt_bool bt_hfp_set_mic_gain ( bt_hfp_session_t *  session,
bt_byte  gain 
)

Report microphone gain on the HF to the AG.

This function reports microphone gain on the HF to the AF. This function is called by the HF upon SLC setup to notify the AG about the current level of the microphone gain on the HF. In case physical mechanisms (buttons, dials etc.) means are implemented on the HF to control the volume levels, the HF calls this function to inform the AG of any changes in the microphone gain.

Parameters
sessionHFP session.
gainMicrophone gain (0 - 15)
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_hfp_set_speaker_volume ( bt_hfp_session_t *  session,
bt_byte  volume 
)

Report speaker volume on the HF to the AG.

This function reports speaker volume on the HF to the AG. This function is called by the HF upon SLC setup to notify the AG about the current level of the speaker volume on the HF. In case physical mechanisms (buttons, dials etc.) means are implemented on the HS to control the volume levels, the HF calls this function to inform the AG of any changes in the speaker volume.

Parameters
sessionHFP session.
gainSpeaker volume (0 - 15)
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.