Microchip® Advanced Software Framework

hfp_ag.h File Reference
#include "hci.h"
#include "classic/sdp_client_rfcomm.h"
#include "classic/hfp.h"
#include "classic/hfp_gsm_model.h"

Data Structures

struct  hfp_phone_number_t
 

Functions

void hfp_ag_accept_held_incoming_call (void)
 
void hfp_ag_activate_voice_recognition (hci_con_handle_t acl_handle, int activate)
 
void hfp_ag_answer_incoming_call (void)
 Put the current call on hold, if it exists, and accept incoming call. More...
 
void hfp_ag_call_dropped (void)
 Pass the call droped event to the AG. More...
 
void hfp_ag_clear_last_dialed_number (void)
 
void hfp_ag_create_sdp_record (uint8_t *service, uint32_t service_record_handle, int rfcomm_channel_nr, const char *name, uint8_t ability_to_reject_call, uint16_t supported_features, int wide_band_speech)
 Create HFP Audio Gateway (AG) SDP service record. More...
 
void hfp_ag_establish_audio_connection (hci_con_handle_t acl_handle)
 Establish audio connection. More...
 
void hfp_ag_establish_service_level_connection (bd_addr_t bd_addr)
 Establish RFCOMM connection, and perform service level connection agreement: More...
 
void hfp_ag_hold_incoming_call (void)
 
void hfp_ag_incoming_call (void)
 Pass the accept incoming call event to the AG. More...
 
void hfp_ag_init (uint16_t rfcomm_channel_nr)
 Set up HFP Audio Gateway (AG) device without additional supported features. More...
 
void hfp_ag_init_ag_indicators (int ag_indicators_nr, hfp_ag_indicator_t *ag_indicators)
 Set AG indicators. More...
 
void hfp_ag_init_call_hold_services (int call_hold_services_nr, const char *call_hold_services[])
 Set Call Hold services. More...
 
void hfp_ag_init_codecs (int codecs_nr, uint8_t *codecs)
 Set codecs. More...
 
void hfp_ag_init_hf_indicators (int hf_indicators_nr, hfp_generic_status_indicator_t *hf_indicators)
 Set HF indicators. More...
 
void hfp_ag_init_supported_features (uint32_t supported_features)
 Set supported features. More...
 
void hfp_ag_join_held_call (void)
 Join held call with active call. More...
 
void hfp_ag_notify_incoming_call_waiting (hci_con_handle_t acl_handle)
 
void hfp_ag_outgoing_call_accepted (void)
 Pass the accept outgoing call event to the AG. More...
 
void hfp_ag_outgoing_call_established (void)
 Pass the outgoing call established event to the AG. More...
 
void hfp_ag_outgoing_call_rejected (void)
 Pass the reject outgoing call event to the AG. More...
 
void hfp_ag_outgoing_call_ringing (void)
 Pass the outgoing call ringing event to the AG. More...
 
void hfp_ag_register_packet_handler (btstack_packet_handler_t callback)
 Register callback for the HFP Audio Gateway (AG) client. More...
 
void hfp_ag_reject_held_incoming_call (void)
 
void hfp_ag_reject_phone_number_for_voice_tag (hci_con_handle_t acl_handle)
 
void hfp_ag_release_audio_connection (hci_con_handle_t acl_handle)
 Release audio connection. More...
 
void hfp_ag_release_service_level_connection (hci_con_handle_t acl_handle)
 Release the RFCOMM channel and the audio connection between the HF and the AG. More...
 
void hfp_ag_report_extended_audio_gateway_error_result_code (hci_con_handle_t acl_handle, hfp_cme_error_t error)
 Report Extended Audio Gateway Error result codes in the AG. More...
 
void hfp_ag_send_dtmf_code_done (hci_con_handle_t acl_handle)
 
void hfp_ag_send_phone_number_for_voice_tag (hci_con_handle_t acl_handle, const char *phone_number)
 
void hfp_ag_set_battery_level (int level)
 
void hfp_ag_set_clip (uint8_t type, const char *number)
 Store phone number with initiated call. More...
 
void hfp_ag_set_microphone_gain (hci_con_handle_t acl_handle, int gain)
 
void hfp_ag_set_registration_status (int status)
 
void hfp_ag_set_roaming_status (int status)
 
void hfp_ag_set_signal_strength (int strength)
 
void hfp_ag_set_speaker_gain (hci_con_handle_t acl_handle, int gain)
 
void hfp_ag_set_subcriber_number_information (hfp_phone_number_t *numbers, int numbers_count)
 
void hfp_ag_set_use_in_band_ring_tone (int use_in_band_ring_tone)
 Enable in-band ring tone. More...
 
void hfp_ag_terminate_call (void)
 Reject incoming call, if exists, or terminate active call. More...
 

void hfp_ag_accept_held_incoming_call ( void  )
void hfp_ag_activate_voice_recognition ( hci_con_handle_t  acl_handle,
int  activate 
)
void hfp_ag_answer_incoming_call ( void  )

Put the current call on hold, if it exists, and accept incoming call.

void hfp_ag_call_dropped ( void  )

Pass the call droped event to the AG.

void hfp_ag_clear_last_dialed_number ( void  )
void hfp_ag_create_sdp_record ( uint8_t *  service,
uint32_t  service_record_handle,
int  rfcomm_channel_nr,
const char *  name,
uint8_t  ability_to_reject_call,
uint16_t  supported_features,
int  wide_band_speech 
)

Create HFP Audio Gateway (AG) SDP service record.

Parameters
service
rfcomm_channel_nr
name
ability_to_reject_call
suported_features32-bit bitmap, see HFP_AGSF_* values in hfp.h
wide_band_speechsupported
void hfp_ag_establish_audio_connection ( hci_con_handle_t  acl_handle)

Establish audio connection.

The status of Audio connection establishment is reported via is reported via HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE.

Parameters
bd_addrBluetooth address of the HF
void hfp_ag_establish_service_level_connection ( bd_addr_t  bd_addr)

Establish RFCOMM connection, and perform service level connection agreement:

  • exchange of supported features
  • report Audio Gateway (AG) indicators and their status
  • enable indicator status update in the AG
  • accept the information about available codecs in the Hands-Free (HF), if sent
  • report own information describing the call hold and multiparty services, if possible
  • report which HF indicators are enabled on the AG, if possible The status of SLC connection establishment is reported via HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED.
Parameters
bd_addrBluetooth address of the HF
void hfp_ag_hold_incoming_call ( void  )
void hfp_ag_incoming_call ( void  )

Pass the accept incoming call event to the AG.

void hfp_ag_init ( uint16_t  rfcomm_channel_nr)

Set up HFP Audio Gateway (AG) device without additional supported features.

Parameters
rfcomm_channel_nr
void hfp_ag_init_ag_indicators ( int  ag_indicators_nr,
hfp_ag_indicator_t ag_indicators 
)

Set AG indicators.

Parameters
indicators_nr
indicators
void hfp_ag_init_call_hold_services ( int  call_hold_services_nr,
const char *  call_hold_services[] 
)

Set Call Hold services.

Parameters
indicators_nr
indicators
void hfp_ag_init_codecs ( int  codecs_nr,
uint8_t *  codecs 
)

Set codecs.

Parameters
codecs_nr
codecs
void hfp_ag_init_hf_indicators ( int  hf_indicators_nr,
hfp_generic_status_indicator_t hf_indicators 
)

Set HF indicators.

Parameters
indicators_nr
indicators
void hfp_ag_init_supported_features ( uint32_t  supported_features)

Set supported features.

Parameters
supported_features32-bit bitmap, see HFP_AGSF_* values in hfp.h
void hfp_ag_join_held_call ( void  )

Join held call with active call.

void hfp_ag_notify_incoming_call_waiting ( hci_con_handle_t  acl_handle)
void hfp_ag_outgoing_call_accepted ( void  )

Pass the accept outgoing call event to the AG.

void hfp_ag_outgoing_call_established ( void  )

Pass the outgoing call established event to the AG.

void hfp_ag_outgoing_call_rejected ( void  )

Pass the reject outgoing call event to the AG.

void hfp_ag_outgoing_call_ringing ( void  )

Pass the outgoing call ringing event to the AG.

void hfp_ag_register_packet_handler ( btstack_packet_handler_t  callback)

Register callback for the HFP Audio Gateway (AG) client.

Parameters
callback
void hfp_ag_reject_held_incoming_call ( void  )
void hfp_ag_reject_phone_number_for_voice_tag ( hci_con_handle_t  acl_handle)
void hfp_ag_release_audio_connection ( hci_con_handle_t  acl_handle)

Release audio connection.

The status of releasing the Audio connection is reported via is reported via HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE.

Parameters
bd_addrBluetooth address of the HF
void hfp_ag_release_service_level_connection ( hci_con_handle_t  acl_handle)

Release the RFCOMM channel and the audio connection between the HF and the AG.

If the audio connection exists, it will be released. The status of releasing the SLC connection is reported via HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED.

Parameters
bd_addrBluetooth address of the HF
void hfp_ag_report_extended_audio_gateway_error_result_code ( hci_con_handle_t  acl_handle,
hfp_cme_error_t  error 
)

Report Extended Audio Gateway Error result codes in the AG.

Whenever there is an error relating to the functionality of the AG as a result of AT command, the AG shall send +CME ERROR:

  • +CME ERROR: 0 - AG failure
  • +CME ERROR: 1 - no connection to phone
  • +CME ERROR: 3 - operation not allowed
  • +CME ERROR: 4 - operation not supported
  • +CME ERROR: 5 - PH-SIM PIN required
  • +CME ERROR: 10 - SIM not inserted
  • +CME ERROR: 11 - SIM PIN required
  • +CME ERROR: 12 - SIM PUK required
  • +CME ERROR: 13 - SIM failure
  • +CME ERROR: 14 - SIM busy
  • +CME ERROR: 16 - incorrect password
  • +CME ERROR: 17 - SIM PIN2 required
  • +CME ERROR: 18 - SIM PUK2 required
  • +CME ERROR: 20 - memory full
  • +CME ERROR: 21 - invalid index
  • +CME ERROR: 23 - memory failure
  • +CME ERROR: 24 - text string too long
  • +CME ERROR: 25 - invalid characters in text string
  • +CME ERROR: 26 - dial string too long
  • +CME ERROR: 27 - invalid characters in dial string
  • +CME ERROR: 30 - no network service
  • +CME ERROR: 31 - network Timeout.
  • +CME ERROR: 32 - network not allowed – Emergency calls only
Parameters
bd_addrBluetooth address of the HF
error
void hfp_ag_send_dtmf_code_done ( hci_con_handle_t  acl_handle)
void hfp_ag_send_phone_number_for_voice_tag ( hci_con_handle_t  acl_handle,
const char *  phone_number 
)
void hfp_ag_set_battery_level ( int  level)
void hfp_ag_set_clip ( uint8_t  type,
const char *  number 
)

Store phone number with initiated call.

Parameters
type
number
void hfp_ag_set_microphone_gain ( hci_con_handle_t  acl_handle,
int  gain 
)
void hfp_ag_set_registration_status ( int  status)
void hfp_ag_set_roaming_status ( int  status)
void hfp_ag_set_signal_strength ( int  strength)
void hfp_ag_set_speaker_gain ( hci_con_handle_t  acl_handle,
int  gain 
)
void hfp_ag_set_subcriber_number_information ( hfp_phone_number_t numbers,
int  numbers_count 
)
void hfp_ag_set_use_in_band_ring_tone ( int  use_in_band_ring_tone)

Enable in-band ring tone.

Parameters
use_in_band_ring_tone
void hfp_ag_terminate_call ( void  )

Reject incoming call, if exists, or terminate active call.