diff options
Diffstat (limited to 'bta/include/bta_ag_api.h')
-rw-r--r-- | bta/include/bta_ag_api.h | 206 |
1 files changed, 92 insertions, 114 deletions
diff --git a/bta/include/bta_ag_api.h b/bta/include/bta_ag_api.h index 5ce8ed1b9..c5d4f3619 100644 --- a/bta/include/bta_ag_api.h +++ b/bta/include/bta_ag_api.h @@ -26,21 +26,35 @@ #define BTA_AG_API_H #include "bta_api.h" -#include "bta_hfp_api.h" #include <string> #include <vector> -#include "bta/include/bta_ag_api.h" -#include "bta/include/bta_api.h" -#include "types/raw_address.h" - /***************************************************************************** * Constants and data types ****************************************************************************/ /* Number of SCBs (AG service instances that can be registered) */ #define BTA_AG_MAX_NUM_CLIENTS 6 +#define HFP_HSP_VERSION_UNKNOWN 0x0000 +#define HFP_VERSION_1_1 0x0101 +#define HFP_VERSION_1_5 0x0105 +#define HFP_VERSION_1_6 0x0106 +#define HFP_VERSION_1_7 0x0107 + +#define HSP_VERSION_1_0 0x0100 +#define HSP_VERSION_1_2 0x0102 + +#define HFP_VERSION_CONFIG_KEY "HfpVersion" +#define HFP_SDP_FEATURES_CONFIG_KEY "HfpSdpFeatures" + +/* Note, if you change the default version here, please also change the one in + * bta_hs_api.h, they are meant to be the same. + */ +#ifndef BTA_HFP_VERSION +#define BTA_HFP_VERSION HFP_VERSION_1_7 +#endif + /* AG feature masks */ #define BTA_AG_FEAT_3WAY 0x00000001 /* Three-way calling */ #define BTA_AG_FEAT_ECNR 0x00000002 /* Echo cancellation/noise reduction */ @@ -64,7 +78,7 @@ /* HFP 1.7+ */ #define BTA_AG_FEAT_HF_IND 0x00000400 /* HF Indicators */ -#define BTA_AG_FEAT_ESCO_S4 0x00000800 /* eSCO S4 setting supported */ +#define BTA_AG_FEAT_ESCO 0x00000800 /* eSCO S4 (and T2) setting supported */ /* Proprietary features: using 31 ~ 16 bits */ #define BTA_AG_FEAT_BTRH 0x00010000 /* CCAP incoming call hold */ @@ -106,74 +120,37 @@ typedef uint8_t tBTA_AG_STATUS; #define BTA_AG_HANDLE_SCO_NO_CHANGE 0xFFFF -#define CASE_RETURN_TEXT(code) \ - case code: \ - return #code - -typedef enum : uint8_t { - /* AG result codes used with BTA_AgResult */ - BTA_AG_SPK_RES = 0, /* Update speaker volume */ - BTA_AG_MIC_RES = 1, /* Update microphone volume */ - BTA_AG_INBAND_RING_RES = 2, /* Update inband ring state */ - BTA_AG_CIND_RES = 3, /* Send indicator response for AT+CIND */ - BTA_AG_BINP_RES = 4, /* Send phone number for voice tag for AT+BINP */ - BTA_AG_IND_RES = 5, /* Update an indicator value */ - BTA_AG_BVRA_RES = 6, /* Update voice recognition state */ - BTA_AG_CNUM_RES = 7, /* Send subscriber number response for AT+CNUM */ - BTA_AG_BTRH_RES = 8, /* Send CCAP incoming call hold */ - BTA_AG_CLCC_RES = 9, /* Query list of calls */ - BTA_AG_COPS_RES = 10, /* Read network operator */ - BTA_AG_IN_CALL_RES = 11, /* Indicate incoming phone call */ - BTA_AG_IN_CALL_CONN_RES = 12, /* Incoming phone call connected */ - BTA_AG_CALL_WAIT_RES = 13, /* Call waiting notification */ - BTA_AG_OUT_CALL_ORIG_RES = 14, /* Outgoing phone call origination */ - - /* Outgoing phone call alerting remote party */ - BTA_AG_OUT_CALL_ALERT_RES = 15, - BTA_AG_OUT_CALL_CONN_RES = 16, /* Outgoing phone call connected */ - - /* Incoming/outgoing = 3,-way canceled before connected */ - BTA_AG_CALL_CANCEL_RES = 17, - BTA_AG_END_CALL_RES = 18, /* End call */ - BTA_AG_IN_CALL_HELD_RES = 19, /* Incoming call held */ - BTA_AG_UNAT_RES = 20, /* Response to unknown AT command event */ - BTA_AG_MULTI_CALL_RES = 21, /* SLC at three way call */ - BTA_AG_BIND_RES = 22, /* Activate/Deactivate HF indicator */ - BTA_AG_IND_RES_ON_DEMAND = 33, /* Update an indicator value forcible */ - BTA_AG_UNKNOWN = 0xff, // Should be unset -} tBTA_AG_RES; - -inline std::string bta_ag_result_text(const tBTA_AG_RES& result) { - switch (result) { - CASE_RETURN_TEXT(BTA_AG_SPK_RES); - CASE_RETURN_TEXT(BTA_AG_MIC_RES); - CASE_RETURN_TEXT(BTA_AG_INBAND_RING_RES); - CASE_RETURN_TEXT(BTA_AG_CIND_RES); - CASE_RETURN_TEXT(BTA_AG_BINP_RES); - CASE_RETURN_TEXT(BTA_AG_IND_RES); - CASE_RETURN_TEXT(BTA_AG_BVRA_RES); - CASE_RETURN_TEXT(BTA_AG_CNUM_RES); - CASE_RETURN_TEXT(BTA_AG_BTRH_RES); - CASE_RETURN_TEXT(BTA_AG_CLCC_RES); - CASE_RETURN_TEXT(BTA_AG_COPS_RES); - CASE_RETURN_TEXT(BTA_AG_IN_CALL_RES); - CASE_RETURN_TEXT(BTA_AG_IN_CALL_CONN_RES); - CASE_RETURN_TEXT(BTA_AG_CALL_WAIT_RES); - CASE_RETURN_TEXT(BTA_AG_OUT_CALL_ORIG_RES); - CASE_RETURN_TEXT(BTA_AG_OUT_CALL_ALERT_RES); - CASE_RETURN_TEXT(BTA_AG_OUT_CALL_CONN_RES); - CASE_RETURN_TEXT(BTA_AG_CALL_CANCEL_RES); - CASE_RETURN_TEXT(BTA_AG_END_CALL_RES); - CASE_RETURN_TEXT(BTA_AG_IN_CALL_HELD_RES); - CASE_RETURN_TEXT(BTA_AG_UNAT_RES); - CASE_RETURN_TEXT(BTA_AG_MULTI_CALL_RES); - CASE_RETURN_TEXT(BTA_AG_BIND_RES); - CASE_RETURN_TEXT(BTA_AG_IND_RES_ON_DEMAND); - CASE_RETURN_TEXT(BTA_AG_UNKNOWN); - default: - return std::string("UNKNOWN"); - } -} +/* AG result codes used with BTA_AgResult */ +#define BTA_AG_SPK_RES 0 /* Update speaker volume */ +#define BTA_AG_MIC_RES 1 /* Update microphone volume */ +#define BTA_AG_INBAND_RING_RES 2 /* Update inband ring state */ +#define BTA_AG_CIND_RES 3 /* Send indicator response for AT+CIND */ +#define BTA_AG_BINP_RES 4 /* Send phone number for voice tag for AT+BINP */ +#define BTA_AG_IND_RES 5 /* Update an indicator value */ +#define BTA_AG_BVRA_RES 6 /* Update voice recognition state */ +#define BTA_AG_CNUM_RES 7 /* Send subscriber number response for AT+CNUM */ +#define BTA_AG_BTRH_RES 8 /* Send CCAP incoming call hold */ +#define BTA_AG_CLCC_RES 9 /* Query list of calls */ +#define BTA_AG_COPS_RES 10 /* Read network operator */ +#define BTA_AG_IN_CALL_RES 11 /* Indicate incoming phone call */ +#define BTA_AG_IN_CALL_CONN_RES 12 /* Incoming phone call connected */ +#define BTA_AG_CALL_WAIT_RES 13 /* Call waiting notification */ +#define BTA_AG_OUT_CALL_ORIG_RES 14 /* Outgoing phone call origination */ + +/* Outgoing phone call alerting remote party */ +#define BTA_AG_OUT_CALL_ALERT_RES 15 +#define BTA_AG_OUT_CALL_CONN_RES 16 /* Outgoing phone call connected */ + +/* Incoming/outgoing 3-way canceled before connected */ +#define BTA_AG_CALL_CANCEL_RES 17 +#define BTA_AG_END_CALL_RES 18 /* End call */ +#define BTA_AG_IN_CALL_HELD_RES 19 /* Incoming call held */ +#define BTA_AG_UNAT_RES 20 /* Response to unknown AT command event */ +#define BTA_AG_MULTI_CALL_RES 21 /* SLC at three way call */ +#define BTA_AG_BIND_RES 22 /* Activate/Deactivate HF indicator */ +#define BTA_AG_IND_RES_ON_DEMAND 33 /* Update an indicator value forcible */ + +typedef uint8_t tBTA_AG_RES; /* HFP peer features */ #define BTA_AG_PEER_FEAT_ECNR 0x0001 /* Echo cancellation/noise reduction */ @@ -185,7 +162,7 @@ inline std::string bta_ag_result_text(const tBTA_AG_RES& result) { #define BTA_AG_PEER_FEAT_ECC 0x0040 /* Enhanced Call Control */ #define BTA_AG_PEER_FEAT_CODEC 0x0080 /* Codec Negotiation */ #define BTA_AG_PEER_FEAT_HF_IND 0x0100 /* HF Indicators */ -#define BTA_AG_PEER_FEAT_ESCO_S4 0x0200 /* eSCO S4 setting supported */ +#define BTA_AG_PEER_FEAT_ESCO 0x0200 /* eSCO S4 (and T2) setting supported */ /* Proprietary features: using bits after 12 */ @@ -318,43 +295,43 @@ struct tBTA_AG_RES_DATA { static const tBTA_AG_RES_DATA kEmpty; }; -typedef enum : uint8_t { - /* AG callback events */ - BTA_AG_ENABLE_EVT = 0, /* AG enabled */ - BTA_AG_REGISTER_EVT = 1, /* AG registered */ - BTA_AG_OPEN_EVT = 2, /* AG connection open */ - BTA_AG_CLOSE_EVT = 3, /* AG connection closed */ - BTA_AG_CONN_EVT = 4, /* Service level connection opened */ - BTA_AG_AUDIO_OPEN_EVT = 5, /* Audio connection open */ - BTA_AG_AUDIO_CLOSE_EVT = 6, /* Audio connection closed */ - BTA_AG_SPK_EVT = 7, /* Speaker volume changed */ - BTA_AG_MIC_EVT = 8, /* Microphone volume changed */ - BTA_AG_AT_CKPD_EVT = 9, /* CKPD from the HS */ - BTA_AG_DISABLE_EVT = 30, /* AG disabled */ - BTA_AG_WBS_EVT = 31, /* SCO codec info */ - /* Values below are for HFP only */ - BTA_AG_AT_A_EVT = 10, /* Answer a call */ - BTA_AG_AT_D_EVT = 11, /* Place a call using number or memory dial */ - BTA_AG_AT_CHLD_EVT = 12, /* Call hold */ - BTA_AG_AT_CHUP_EVT = 13, /* Hang up a call */ - BTA_AG_AT_CIND_EVT = 14, /* Read indicator settings */ - BTA_AG_AT_VTS_EVT = 15, /* Transmit DTMF tone */ - BTA_AG_AT_BINP_EVT = 16, /* Retrieve number from voice tag */ - BTA_AG_AT_BLDN_EVT = 17, /* Place call to last dialed number */ - BTA_AG_AT_BVRA_EVT = 18, /* Enable/disable voice recognition */ - BTA_AG_AT_NREC_EVT = 19, /* Disable echo canceling */ - BTA_AG_AT_CNUM_EVT = 20, /* Retrieve subscriber number */ - BTA_AG_AT_BTRH_EVT = 21, /* CCAP-style incoming call hold */ - BTA_AG_AT_CLCC_EVT = 22, /* Query list of current calls */ - BTA_AG_AT_COPS_EVT = 23, /* Query list of current calls */ - BTA_AG_AT_UNAT_EVT = 24, /* Unknown AT command */ - BTA_AG_AT_CBC_EVT = 25, /* Battery Level report from HF */ - BTA_AG_AT_BAC_EVT = 26, /* avablable codec */ - BTA_AG_AT_BCS_EVT = 27, /* Codec select */ - BTA_AG_AT_BIND_EVT = 28, /* HF indicator */ - BTA_AG_AT_BIEV_EVT = 29, /* HF indicator updates from peer */ - BTA_AG_AT_BIA_EVT = 32, /* AG indicator activation event from peer */ -} tBTA_AG_EVT; +/* AG callback events */ +#define BTA_AG_ENABLE_EVT 0 /* AG enabled */ +#define BTA_AG_REGISTER_EVT 1 /* AG registered */ +#define BTA_AG_OPEN_EVT 2 /* AG connection open */ +#define BTA_AG_CLOSE_EVT 3 /* AG connection closed */ +#define BTA_AG_CONN_EVT 4 /* Service level connection opened */ +#define BTA_AG_AUDIO_OPEN_EVT 5 /* Audio connection open */ +#define BTA_AG_AUDIO_CLOSE_EVT 6 /* Audio connection closed */ +#define BTA_AG_SPK_EVT 7 /* Speaker volume changed */ +#define BTA_AG_MIC_EVT 8 /* Microphone volume changed */ +#define BTA_AG_AT_CKPD_EVT 9 /* CKPD from the HS */ +#define BTA_AG_DISABLE_EVT 30 /* AG disabled */ +#define BTA_AG_WBS_EVT 31 /* SCO codec info */ +/* Values below are for HFP only */ +#define BTA_AG_AT_A_EVT 10 /* Answer a call */ +#define BTA_AG_AT_D_EVT 11 /* Place a call using number or memory dial */ +#define BTA_AG_AT_CHLD_EVT 12 /* Call hold */ +#define BTA_AG_AT_CHUP_EVT 13 /* Hang up a call */ +#define BTA_AG_AT_CIND_EVT 14 /* Read indicator settings */ +#define BTA_AG_AT_VTS_EVT 15 /* Transmit DTMF tone */ +#define BTA_AG_AT_BINP_EVT 16 /* Retrieve number from voice tag */ +#define BTA_AG_AT_BLDN_EVT 17 /* Place call to last dialed number */ +#define BTA_AG_AT_BVRA_EVT 18 /* Enable/disable voice recognition */ +#define BTA_AG_AT_NREC_EVT 19 /* Disable echo canceling */ +#define BTA_AG_AT_CNUM_EVT 20 /* Retrieve subscriber number */ +#define BTA_AG_AT_BTRH_EVT 21 /* CCAP-style incoming call hold */ +#define BTA_AG_AT_CLCC_EVT 22 /* Query list of current calls */ +#define BTA_AG_AT_COPS_EVT 23 /* Query list of current calls */ +#define BTA_AG_AT_UNAT_EVT 24 /* Unknown AT command */ +#define BTA_AG_AT_CBC_EVT 25 /* Battery Level report from HF */ +#define BTA_AG_AT_BAC_EVT 26 /* avablable codec */ +#define BTA_AG_AT_BCS_EVT 27 /* Codec select */ +#define BTA_AG_AT_BIND_EVT 28 /* HF indicator */ +#define BTA_AG_AT_BIEV_EVT 29 /* HF indicator updates from peer */ +#define BTA_AG_AT_BIA_EVT 32 /* AG indicator activation event from peer */ + +typedef uint8_t tBTA_AG_EVT; /* data associated with most non-AT events */ typedef struct { @@ -523,7 +500,8 @@ void BTA_AgDisable(); * Returns void * ******************************************************************************/ -void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_AG_FEAT features, +void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask, + tBTA_AG_FEAT features, const std::vector<std::string>& service_names, uint8_t app_id); @@ -552,7 +530,7 @@ void BTA_AgDeregister(uint16_t handle); * Returns void * ******************************************************************************/ -void BTA_AgOpen(uint16_t handle, const RawAddress& bd_addr); +void BTA_AgOpen(uint16_t handle, const RawAddress& bd_addr, tBTA_SEC sec_mask); /******************************************************************************* * |