Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Hands Free Profile - Audio Gateway (HFP-AG)

Hands Free Profile - Audio Gateway (HFP-AG) . More...

Data Structures

struct  bt_hfp_ag_cb
 HFP profile AG application callback. More...
 

Macros

#define BT_HFP_AG_CODEC_CVSD   0x01
 
#define BT_HFP_AG_CODEC_MSBC   0x02
 
#define BT_HFP_AG_CODEC_LC3_SWB   0x03
 

Typedefs

typedef int(* bt_hfp_ag_query_subscriber_func_t) (struct bt_hfp_ag *ag, char *number, uint8_t type, uint8_t service)
 Query subscriber number callback function.
 

Enumerations

enum  bt_hfp_ag_indicator {
  BT_HFP_AG_SERVICE_IND = 0 , BT_HFP_AG_CALL_IND = 1 , BT_HFP_AG_CALL_SETUP_IND = 2 , BT_HFP_AG_CALL_HELD_IND = 3 ,
  BT_HFP_AG_SIGNAL_IND = 4 , BT_HFP_AG_ROAM_IND = 5 , BT_HFP_AG_BATTERY_IND = 6 , BT_HFP_AG_IND_MAX
}
 
enum  hfp_ag_hf_indicators { HFP_AG_ENHANCED_SAFETY_IND = 1 , HFP_AG_BATTERY_LEVEL_IND = 2 }
 

Functions

int bt_hfp_ag_register (struct bt_hfp_ag_cb *cb)
 Register HFP AG profile.
 
int bt_hfp_ag_connect (struct bt_conn *conn, struct bt_hfp_ag **ag, uint8_t channel)
 Create the hfp ag session.
 
int bt_hfp_ag_disconnect (struct bt_hfp_ag *ag)
 Disconnect the hfp ag session.
 
int bt_hfp_ag_remote_incoming (struct bt_hfp_ag *ag, const char *number)
 Notify HFP Unit of an incoming call.
 
int bt_hfp_ag_hold_incoming (struct bt_hfp_ag_call *call)
 Put the incoming call on hold.
 
int bt_hfp_ag_reject (struct bt_hfp_ag_call *call)
 Reject the incoming call.
 
int bt_hfp_ag_accept (struct bt_hfp_ag_call *call)
 Accept the incoming call.
 
int bt_hfp_ag_terminate (struct bt_hfp_ag_call *call)
 Terminate the active/hold call.
 
int bt_hfp_ag_retrieve (struct bt_hfp_ag_call *call)
 Retrieve the held call.
 
int bt_hfp_ag_hold (struct bt_hfp_ag_call *call)
 Hold the active call.
 
int bt_hfp_ag_outgoing (struct bt_hfp_ag *ag, const char *number)
 Dial a call.
 
int bt_hfp_ag_remote_ringing (struct bt_hfp_ag_call *call)
 Notify HFP Unit that the remote starts ringing.
 
int bt_hfp_ag_remote_reject (struct bt_hfp_ag_call *call)
 Notify HFP Unit that the remote rejects the call.
 
int bt_hfp_ag_remote_accept (struct bt_hfp_ag_call *call)
 Notify HFP Unit that the remote accepts the call.
 
int bt_hfp_ag_remote_terminate (struct bt_hfp_ag_call *call)
 Notify HFP Unit that the remote terminates the active/hold call.
 
int bt_hfp_ag_explicit_call_transfer (struct bt_hfp_ag *ag)
 explicit call transfer
 
int bt_hfp_ag_vgm (struct bt_hfp_ag *ag, uint8_t vgm)
 Set the HF microphone gain.
 
int bt_hfp_ag_vgs (struct bt_hfp_ag *ag, uint8_t vgs)
 Set the HF speaker gain.
 
int bt_hfp_ag_set_operator (struct bt_hfp_ag *ag, uint8_t mode, char *name)
 Set currently network operator.
 
int bt_hfp_ag_audio_connect (struct bt_hfp_ag *ag, uint8_t id)
 Create audio connection.
 
int bt_hfp_ag_inband_ringtone (struct bt_hfp_ag *ag, bool inband)
 Set In-Band Ring Tone.
 
int bt_hfp_ag_voice_recognition (struct bt_hfp_ag *ag, bool activate)
 Enable/disable the voice recognition function.
 
int bt_hfp_ag_vre_state (struct bt_hfp_ag *ag, uint8_t state)
 set voice recognition engine state
 
int bt_hfp_ag_vre_textual_representation (struct bt_hfp_ag *ag, uint8_t state, const char *id, uint8_t type, uint8_t operation, const char *text)
 set voice recognition engine state and textual representation
 
int bt_hfp_ag_signal_strength (struct bt_hfp_ag *ag, uint8_t strength)
 Set signal strength.
 
int bt_hfp_ag_roaming_status (struct bt_hfp_ag *ag, uint8_t status)
 Set roaming status.
 
int bt_hfp_ag_battery_level (struct bt_hfp_ag *ag, uint8_t level)
 Set battery level.
 
int bt_hfp_ag_service_availability (struct bt_hfp_ag *ag, bool available)
 Set service availability.
 
int bt_hfp_ag_hf_indicator (struct bt_hfp_ag *ag, enum hfp_ag_hf_indicators indicator, bool enable)
 Activate/deactivate HF indicator.
 

Detailed Description

Hands Free Profile - Audio Gateway (HFP-AG) .

Macro Definition Documentation

◆ BT_HFP_AG_CODEC_CVSD

#define BT_HFP_AG_CODEC_CVSD   0x01

◆ BT_HFP_AG_CODEC_LC3_SWB

#define BT_HFP_AG_CODEC_LC3_SWB   0x03

◆ BT_HFP_AG_CODEC_MSBC

#define BT_HFP_AG_CODEC_MSBC   0x02

Typedef Documentation

◆ bt_hfp_ag_query_subscriber_func_t

typedef int(* bt_hfp_ag_query_subscriber_func_t) (struct bt_hfp_ag *ag, char *number, uint8_t type, uint8_t service)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Query subscriber number callback function.

When AG wants to send subscriber number information, all information will be passed through the callback. And the subscriber number information will be sent out in this function.

Parameters
agHFP AG object.
numberSubscriber number.
typeType of subscriber number specifies the format of the phone number provided, and can be one of the following values:
  • values 128-143: The phone number format may be a national or international format, and may contain prefix and/or escape digits. No changes on the number presentation are required.
  • values 144-159: The phone number format is an international number, including the country code prefix. If the plus sign ("+") is not included as part of the number and shall be added by the AG as needed.
  • values 160-175: National number. No prefix nor escape digits included.
serviceService of subscriber number indicates which service this phone number relates to. Shall be either 4 (voice) or 5 (fax).
Returns
0 if should continue to the next subscriber number information.
negative value to stop.

Enumeration Type Documentation

◆ bt_hfp_ag_indicator

#include <zephyr/bluetooth/classic/hfp_ag.h>

Enumerator
BT_HFP_AG_SERVICE_IND 
BT_HFP_AG_CALL_IND 
BT_HFP_AG_CALL_SETUP_IND 
BT_HFP_AG_CALL_HELD_IND 
BT_HFP_AG_SIGNAL_IND 
BT_HFP_AG_ROAM_IND 
BT_HFP_AG_BATTERY_IND 
BT_HFP_AG_IND_MAX 

◆ hfp_ag_hf_indicators

#include <zephyr/bluetooth/classic/hfp_ag.h>

Enumerator
HFP_AG_ENHANCED_SAFETY_IND 
HFP_AG_BATTERY_LEVEL_IND 

Function Documentation

◆ bt_hfp_ag_accept()

int bt_hfp_ag_accept ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Accept the incoming call.

Accept the incoming call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_audio_connect()

int bt_hfp_ag_audio_connect ( struct bt_hfp_ag * ag,
uint8_t id )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Create audio connection.

Create audio conenction by HFP AG. There are two setups included, Codec connection and audio connection. The codec connection will be established firstly if the codec negotiation are supported by both side. If the passed codec id is not same as the last codec connection, the codec connection procedure will be triggered. After the codec conenction is established, the audio conenction will be started. The passed codec id could be one of BT_HFP_AG_CODEC_XXX. If the codec negotiation feature is supported by both side, the codec id could be one of the bitmaps of ids notified by callback codec. Or, the id should be BT_HFP_AG_CODEC_CVSD.

Parameters
agHFP AG object.
idCodec Id.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_battery_level()

int bt_hfp_ag_battery_level ( struct bt_hfp_ag * ag,
uint8_t level )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set battery level.

Set battery level.

Parameters
agHFP AG object.
levelbattery level.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_connect()

int bt_hfp_ag_connect ( struct bt_conn * conn,
struct bt_hfp_ag ** ag,
uint8_t channel )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Create the hfp ag session.

Create the hfp ag session

Parameters
connACL connection object.
agCreated HFP AG object.
channelPeer rfcomm channel to be connected.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_disconnect()

int bt_hfp_ag_disconnect ( struct bt_hfp_ag * ag)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Disconnect the hfp ag session.

Disconnect the hfp ag session

Parameters
agHFP AG object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_explicit_call_transfer()

int bt_hfp_ag_explicit_call_transfer ( struct bt_hfp_ag * ag)

#include <zephyr/bluetooth/classic/hfp_ag.h>

explicit call transfer

Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer). If CONFIG_BT_HFP_AG_3WAY_CALL is not enabled, the error -ENOTSUP will be returned if the function called.

Parameters
agHFP AG object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_hf_indicator()

int bt_hfp_ag_hf_indicator ( struct bt_hfp_ag * ag,
enum hfp_ag_hf_indicators indicator,
bool enable )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Activate/deactivate HF indicator.

It allows HF to issue the +BIND unsolicited result code to activate/deactivate of the AG’s supported HF Indicators. The indicator of supported indicators can be activated/deactivated are defined in enum hfp_ag_hf_indicators. BT_HFP_AG_HF_INDICATOR_ENH_SAFETY is used to support Enhanced Safety. Only the configuration has been enabled, the indicator can be HFP_AG_ENHANCED_SAFETY_IND. BT_HFP_AG_HF_INDICATOR_BATTERY is used to support Remaining level of Battery. Only the configuration has been enabled, the indicator can be HFP_AG_BATTERY_LEVEL_IND. If CONFIG_BT_HFP_HF_HF_INDICATORS is not enabled, the error -ENOTSUP will be returned if the function called.

Parameters
agHFP AG object.
indicatorThe indicator of the AG’s supported HF Indicators.
enableenable/disable specific HF Indicator.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_hold()

int bt_hfp_ag_hold ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Hold the active call.

Hold the active call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_hold_incoming()

int bt_hfp_ag_hold_incoming ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Put the incoming call on hold.

Put the incoming call on hold.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_inband_ringtone()

int bt_hfp_ag_inband_ringtone ( struct bt_hfp_ag * ag,
bool inband )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set In-Band Ring Tone.

Set In-Band Ring Tone.

Parameters
agHFP AG object.
inbandIn-band or no in-band.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_outgoing()

int bt_hfp_ag_outgoing ( struct bt_hfp_ag * ag,
const char * number )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Dial a call.

Dial a call.

Parameters
agHFP AG object.
numberDialing number.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_register()

int bt_hfp_ag_register ( struct bt_hfp_ag_cb * cb)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Register HFP AG profile.

Register Handsfree profile AG callbacks to monitor the state and get the required HFP details to display.

Parameters
cbcallback structure.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_reject()

int bt_hfp_ag_reject ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Reject the incoming call.

Reject the incoming call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_remote_accept()

int bt_hfp_ag_remote_accept ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Notify HFP Unit that the remote accepts the call.

Notify HFP Unit that the remote accepts the call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_remote_incoming()

int bt_hfp_ag_remote_incoming ( struct bt_hfp_ag * ag,
const char * number )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Notify HFP Unit of an incoming call.

Notify HFP Unit of an incoming call.

Parameters
agHFP AG object.
numberDialing number.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_remote_reject()

int bt_hfp_ag_remote_reject ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Notify HFP Unit that the remote rejects the call.

Notify HFP Unit that the remote rejects the call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_remote_ringing()

int bt_hfp_ag_remote_ringing ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Notify HFP Unit that the remote starts ringing.

Notify HFP Unit that the remote starts ringing.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_remote_terminate()

int bt_hfp_ag_remote_terminate ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Notify HFP Unit that the remote terminates the active/hold call.

Notify HFP Unit that the remote terminates the active/hold call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_retrieve()

int bt_hfp_ag_retrieve ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Retrieve the held call.

Retrieve the held call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_roaming_status()

int bt_hfp_ag_roaming_status ( struct bt_hfp_ag * ag,
uint8_t status )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set roaming status.

Set roaming status.

Parameters
agHFP AG object.
statusRoaming status.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_service_availability()

int bt_hfp_ag_service_availability ( struct bt_hfp_ag * ag,
bool available )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set service availability.

Set service availability.

Parameters
agHFP AG object.
availableservice availability
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_set_operator()

int bt_hfp_ag_set_operator ( struct bt_hfp_ag * ag,
uint8_t mode,
char * name )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set currently network operator.

Set currently network operator.

Parameters
agHFP AG object.
modeCurrent mode and provides no information with regard to the name of the operator.
nameA string in alphanumeric format representing the name of the network operator. This string shall not exceed 16 characters.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_signal_strength()

int bt_hfp_ag_signal_strength ( struct bt_hfp_ag * ag,
uint8_t strength )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set signal strength.

Set signal strength.

Parameters
agHFP AG object.
strengthSignal strength.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_terminate()

int bt_hfp_ag_terminate ( struct bt_hfp_ag_call * call)

#include <zephyr/bluetooth/classic/hfp_ag.h>

Terminate the active/hold call.

Terminate the active/hold call.

Parameters
callHFP AG call object.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_vgm()

int bt_hfp_ag_vgm ( struct bt_hfp_ag * ag,
uint8_t vgm )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set the HF microphone gain.

Set the HF microphone gain

Parameters
agHFP AG object.
vgmMicrophone gain value.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_vgs()

int bt_hfp_ag_vgs ( struct bt_hfp_ag * ag,
uint8_t vgs )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Set the HF speaker gain.

Set the HF speaker gain

Parameters
agHFP AG object.
vgsSpeaker gain value.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_voice_recognition()

int bt_hfp_ag_voice_recognition ( struct bt_hfp_ag * ag,
bool activate )

#include <zephyr/bluetooth/classic/hfp_ag.h>

Enable/disable the voice recognition function.

Enables/disables the voice recognition function. If CONFIG_BT_HFP_AG_VOICE_RECG is not enabled, the error -ENOTSUP will be returned if the function called.

Parameters
agHFP AG object.
activateActivate/deactivate the voice recognition function.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_vre_state()

int bt_hfp_ag_vre_state ( struct bt_hfp_ag * ag,
uint8_t state )

#include <zephyr/bluetooth/classic/hfp_ag.h>

set voice recognition engine state

It is used to set the voice recognition engine state. The unsolicited result code +BVRA: 1,<vrecstate> will be sent. <vrecstate>: Bitmask that reflects the current state of the voice recognition engine on the AG. Bit 0 - If it is 1, the AG is ready to accept audio input Bit 1 - If it is 1, the AG is sending audio to the HF Bit 2 - If it is 1, the AG is processing the audio input If CONFIG_BT_HFP_AG_ENH_VOICE_RECG is not enabled, the error -ENOTSUP will be returned if the function called.

Parameters
agHFP AG object.
stateThe value of <vrecstate>.
Returns
0 in case of success or negative value in case of error.

◆ bt_hfp_ag_vre_textual_representation()

int bt_hfp_ag_vre_textual_representation ( struct bt_hfp_ag * ag,
uint8_t state,
const char * id,
uint8_t type,
uint8_t operation,
const char * text )

#include <zephyr/bluetooth/classic/hfp_ag.h>

set voice recognition engine state and textual representation

It is used to set the voice recognition engine state with textual representation. unsolicited result code +BVRA: 1,<vrecstate>, <textualRepresentation> will be sent. <vrecstate> is same as parameter state of function bt_hfp_ag_vre_state. <textualRepresentation>: <textID>,<textType>,<textOperation>, <string>. <textID>: Unique ID of the current text as a hexadecimal string (a maximum of 4 characters in length, but less than 4 characters in length is valid). <textType>: ID of the textType from the following list: 0 - Text recognized by the AG from the audio input provided by the HF 1 - Text of the audio output from the AG 2 - Text of the audio output from the AG that contains a question 3 - Text of the audio output from the AG that contains an error description <textOperation>: ID of the operation of the text 1 - NewText: Indicates that a new text started. Shall be used when the <textID> changes 2 - Replace: Replace any existing text with the same <textID> and same <textType> 3 - Append: Attach new text to existing text and keep the same <textID> and same <textType> <string>: The <string> parameter shall be a UTF-8 text string and shall always be contained within double quotes. If CONFIG_BT_HFP_AG_VOICE_RECG_TEXT is not enabled, the error -ENOTSUP will be returned if the function called.

Parameters
agHFP AG object.
stateThe value of <vrecstate>.
idValue of <textID>.
typeValue of <textType>.
operationValue of <textOperation>.
textValue of <string>.
Returns
0 in case of success or negative value in case of error.