1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This is the public interface file for the audio gateway (AG) subsystem 22 * of BTA, Broadcom's Bluetooth application layer for mobile phones. 23 * 24 ******************************************************************************/ 25 #ifndef BTA_AG_API_H 26 #define BTA_AG_API_H 27 28 #include "bta_api.h" 29 #include "bta_hfp_defs.h" 30 #include "esp_hf_defs.h" 31 32 #if (BTA_AG_INCLUDED == TRUE) 33 /***************************************************************************** 34 ** Constants and data types 35 *****************************************************************************/ 36 37 /* AG feature masks */ 38 #define BTA_AG_FEAT_3WAY 0x00000001 /* Three-way calling */ 39 #define BTA_AG_FEAT_ECNR 0x00000002 /* Echo cancellation and/or noise reduction */ 40 #define BTA_AG_FEAT_VREC 0x00000004 /* Voice recognition */ 41 #define BTA_AG_FEAT_INBAND 0x00000008 /* In-band ring tone */ 42 #define BTA_AG_FEAT_VTAG 0x00000010 /* Attach a phone number to a voice tag */ 43 #define BTA_AG_FEAT_REJECT 0x00000020 /* Ability to reject incoming call */ 44 #define BTA_AG_FEAT_ECS 0x00000040 /* Enhanced Call Status */ 45 #define BTA_AG_FEAT_ECC 0x00000080 /* Enhanced Call Control */ 46 #define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */ 47 #define BTA_AG_FEAT_CODEC 0x00000200 /* Codec Negotiation */ 48 #define BTA_AG_FEAT_VOIP 0x00000400 /* VoIP call */ 49 /* Proprietary features: using 31 ~ 16 bits */ 50 #define BTA_AG_FEAT_BTRH 0x00010000 /* CCAP incoming call hold */ 51 #define BTA_AG_FEAT_UNAT 0x00020000 /* Pass unknown AT commands to application */ 52 #define BTA_AG_FEAT_NOSCO 0x00040000 /* No SCO control performed by BTA AG */ 53 #define BTA_AG_FEAT_NO_ESCO 0x00080000 /* Do not allow or use eSCO */ 54 typedef UINT32 tBTA_AG_FEAT; 55 56 /* HFP peer features */ 57 #define BTA_AG_PEER_FEAT_ECNR 0x0001 /* Echo cancellation and/or noise reduction */ 58 #define BTA_AG_PEER_FEAT_3WAY 0x0002 /* Call waiting and three-way calling */ 59 #define BTA_AG_PEER_FEAT_CLI 0x0004 /* Caller ID presentation capability */ 60 #define BTA_AG_PEER_FEAT_VREC 0x0008 /* Voice recognition activation */ 61 #define BTA_AG_PEER_FEAT_VOL 0x0010 /* Remote volume control */ 62 #define BTA_AG_PEER_FEAT_ECS 0x0020 /* Enhanced Call Status */ 63 #define BTA_AG_PEER_FEAT_ECC 0x0040 /* Enhanced Call Control */ 64 #define BTA_AG_PEER_FEAT_CODEC 0x0080 /* Codec Negotiation */ 65 #define BTA_AG_PEER_FEAT_VOIP 0x0100 /* VoIP call */ 66 typedef UINT16 tBTA_AG_PEER_FEAT; 67 68 /* AG extended call handling - masks not related to any spec */ 69 #define BTA_AG_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */ 70 #define BTA_AG_CLIENT_CHLD_REL_ACC 0x00000002 /* 1 Release active calls and accept other (waiting or held) cal */ 71 #define BTA_AG_CLIENT_CHLD_REL_X 0x00000004 /* 1x Release x call*/ 72 #define BTA_AG_CLIENT_CHLD_HOLD_ACC 0x00000008 /* 2 Active calls on hold and accept other call */ 73 #define BTA_AG_CLIENT_CHLD_PRIV_X 0x00000010 /* 2x Active multiparty call on hold except call x */ 74 #define BTA_AG_CLIENT_CHLD_MERGE 0x00000020 /* 3 Add held call to multiparty */ 75 #define BTA_AG_CLIENT_CHLD_MERGE_DETACH 0x00000040 /* 4 Add held call to multiparty */ 76 typedef UINT16 tBTA_AG_CHLD_FEAT; 77 78 /* HFP peer supported codec masks */ 79 // TODO(google) This should use common definitions 80 // in hci/include/hci_audio.h 81 #define BTA_AG_CODEC_NONE BTM_SCO_CODEC_NONE 82 #define BTA_AG_CODEC_CVSD BTM_SCO_CODEC_CVSD /* CVSD */ 83 #define BTA_AG_CODEC_MSBC BTM_SCO_CODEC_MSBC /* mSBC */ 84 typedef UINT16 tBTA_AG_PEER_CODEC; 85 86 /* AG parse mode */ 87 #define BTA_AG_PARSE 0 /* Perform AT command parsing in AG */ 88 #define BTA_AG_PASS_THROUGH 1 /* Pass data directly to phones AT command interpreter */ 89 typedef UINT8 tBTA_AG_PARSE_MODE; 90 91 /* AG open status */ 92 #define BTA_AG_SUCCESS 0 /* Connection successfully opened */ 93 #define BTA_AG_FAIL_SDP 1 /* Open failed due to SDP */ 94 #define BTA_AG_FAIL_RFCOMM 2 /* Open failed due to RFCOMM */ 95 #define BTA_AG_FAIL_RESOURCES 3 /* out of resources failure */ 96 typedef UINT8 tBTA_AG_STATUS; 97 98 /* handle values used with BTA_AgResult */ 99 #define BTA_AG_HANDLE_NONE 0 100 #define BTA_AG_HANDLE_ALL 0xFFFF 101 /* It is safe to use the same value as BTA_AG_HANDLE_ALL 102 * HANDLE_ALL is used for delivering indication 103 * SCO_NO_CHANGE is used for changing sco behavior 104 * They donot interfere with each other 105 */ 106 #define BTA_AG_HANDLE_SCO_NO_CHANGE 0xFFFF 107 108 /* AG result codes used with BTA_AgResult */ 109 #define BTA_AG_SPK_RES 0 /* Update speaker volume */ 110 #define BTA_AG_MIC_RES 1 /* Update microphone volume */ 111 #define BTA_AG_INBAND_RING_RES 2 /* Update inband ring state AT+BSIR */ 112 #define BTA_AG_CIND_RES 3 /* Send indicator response for AT+CIND */ 113 #define BTA_AG_BINP_RES 4 /* Send phone number for voice tag for AT+BINP */ 114 #define BTA_AG_IND_RES 5 /* Update an indicator value +CIEV<...> */ 115 #define BTA_AG_BVRA_RES 6 /* Update voice recognition state for AT+BVRA */ 116 #define BTA_AG_CNUM_RES 7 /* Send subscriber number response for AT+CNUM */ 117 #define BTA_AG_BTRH_RES 8 /* Send CCAP incoming call hold */ 118 #define BTA_AG_CLCC_RES 9 /* Query list of calls AT+CLCC */ 119 #define BTA_AG_COPS_RES 10 /* Read network operator for AT+COPS */ 120 #define BTA_AG_IN_CALL_RES 11 /* Indicate incoming phone call */ 121 #define BTA_AG_IN_CALL_CONN_RES 12 /* Incoming phone call connected*/ 122 #define BTA_AG_CALL_WAIT_RES 13 /* Call waiting notification for AT+CCWA */ 123 #define BTA_AG_OUT_CALL_ORIG_RES 14 /* Outgoing phone call origination AT+ATD*/ 124 #define BTA_AG_OUT_CALL_ALERT_RES 15 /* Outgoing phone call alerting remote party */ 125 #define BTA_AG_OUT_CALL_CONN_RES 16 /* Outgoing phone call connected */ 126 #define BTA_AG_CALL_CANCEL_RES 17 /* Incoming/outgoing 3-way canceled before connected */ 127 #define BTA_AG_END_CALL_RES 18 /* End call AT+CHUP */ 128 #define BTA_AG_IN_CALL_HELD_RES 19 /* Incoming call held AT+CHLD */ 129 #define BTA_AG_UNAT_RES 20 /* Response to unknown AT command event AT+UNAT */ 130 #define BTA_AG_MULTI_CALL_RES 21 /* SLC at three way call */ 131 typedef UINT8 tBTA_AG_RES; 132 133 /* AG callback events */ 134 #define BTA_AG_ENABLE_EVT 0 /* AG enabled */ 135 #define BTA_AG_REGISTER_EVT 1 /* AG registered */ 136 #define BTA_AG_OPEN_EVT 2 /* AG connection open */ 137 #define BTA_AG_CLOSE_EVT 3 /* AG connection closed */ 138 #define BTA_AG_CONN_EVT 4 /* Service level connection opened */ 139 #define BTA_AG_AUDIO_OPEN_EVT 5 /* Audio connection open */ 140 #define BTA_AG_AUDIO_CLOSE_EVT 6 /* Audio connection closed */ 141 #define BTA_AG_SPK_EVT 7 /* Speaker volume changed */ 142 #define BTA_AG_MIC_EVT 8 /* Microphone volume changed */ 143 #define BTA_AG_AT_CKPD_EVT 9 /* CKPD from the HS */ 144 #define BTA_AG_DISABLE_EVT 30 /* AG disabled */ 145 #if (BTM_WBS_INCLUDED == TRUE ) 146 #define BTA_AG_WBS_EVT 31 /* SCO codec nego */ 147 #endif 148 #define BTA_AG_AUDIO_MSBC_OPEN_EVT 32 /* Audio connection with mSBC codec open */ 149 150 /* Values below are for HFP only */ 151 #define BTA_AG_AT_A_EVT 10 /* Answer a incoming call */ 152 #define BTA_AG_AT_D_EVT 11 /* Place a call using number or memory dial */ 153 #define BTA_AG_AT_CHLD_EVT 12 /* Call hold */ 154 #define BTA_AG_AT_CHUP_EVT 13 /* Hang up a call */ 155 #define BTA_AG_AT_CIND_EVT 14 /* Read indicator settings */ 156 #define BTA_AG_AT_VTS_EVT 15 /* Transmit DTMF tone */ 157 #define BTA_AG_AT_BINP_EVT 16 /* Retrieve number from voice tag */ 158 #define BTA_AG_AT_BLDN_EVT 17 /* Place call to last dialed number */ 159 #define BTA_AG_AT_BVRA_EVT 18 /* Enable/disable voice recognition */ 160 #define BTA_AG_AT_NREC_EVT 19 /* Disable echo canceling */ 161 #define BTA_AG_AT_CNUM_EVT 20 /* Retrieve subscriber number */ 162 #define BTA_AG_AT_BTRH_EVT 21 /* CCAP-style incoming call hold */ 163 #define BTA_AG_AT_CLCC_EVT 22 /* Query list of current calls */ 164 #define BTA_AG_AT_COPS_EVT 23 /* Query Current Operator Name on AG */ 165 #define BTA_AG_AT_UNAT_EVT 24 /* Unknown AT command */ 166 #define BTA_AG_AT_CBC_EVT 25 /* Indicator Update */ 167 #define BTA_AG_AT_BAC_EVT 26 /* avablable codec */ 168 #define BTA_AG_AT_BCS_EVT 27 /* Codec select */ 169 typedef UINT8 tBTA_AG_EVT; 170 171 /* HFP errcode - Set when BTA_AG_OK_ERROR is returned in 'ok_flag' */ 172 #define BTA_AG_ERR_PHONE_FAILURE 0 /* Phone Failure */ 173 #define BTA_AG_ERR_NO_CONN_PHONE 1 /* No connection to phone */ 174 #define BTA_AG_ERR_OP_NOT_ALLOWED 3 /* Operation not allowed */ 175 #define BTA_AG_ERR_OP_NOT_SUPPORTED 4 /* Operation not supported */ 176 #define BTA_AG_ERR_PHSIM_PIN_REQ 5 /* PH-SIM PIN required */ 177 #define BTA_AG_ERR_SIM_NOT_INSERTED 10 /* SIM not inserted */ 178 #define BTA_AG_ERR_SIM_PIN_REQ 11 /* SIM PIN required */ 179 #define BTA_AG_ERR_SIM_PUK_REQ 12 /* SIM PUK required */ 180 #define BTA_AG_ERR_SIM_FAILURE 13 /* SIM failure */ 181 #define BTA_AG_ERR_SIM_BUSY 14 /* SIM busy */ 182 #define BTA_AG_ERR_INCORRECT_PWD 16 /* Incorrect password */ 183 #define BTA_AG_ERR_SIM_PIN2_REQ 17 /* SIM PIN2 required */ 184 #define BTA_AG_ERR_SIM_PUK2_REQ 18 /* SIM PUK2 required */ 185 #define BTA_AG_ERR_MEMORY_FULL 20 /* Memory full */ 186 #define BTA_AG_ERR_INVALID_INDEX 21 /* Invalid index */ 187 #define BTA_AG_ERR_MEMORY_FAILURE 23 /* Memory failure */ 188 #define BTA_AG_ERR_TEXT_TOO_LONG 24 /* Text string too long */ 189 #define BTA_AG_ERR_INV_CHAR_IN_TSTR 25 /* Invalid characters in text string */ 190 #define BTA_AG_ERR_DSTR_TOO_LONG 26 /* Dial string too long */ 191 #define BTA_AG_ERR_INV_CHAR_IN_DSTR 27 /* Invalid characters in dial string */ 192 #define BTA_AG_ERR_NO_NETWORK_SERV 30 /* No network service */ 193 #define BTA_AG_ERR_NETWORK_TIME_OUT 31 /* Network timeout */ 194 #define BTA_AG_ERR_NO_NET_EMG_ONLY 32 /* Network not allowed - emergency service only */ 195 #define BTA_AG_ERR_VOIP_CS_CALLS 33 /* AG cannot create simultaneous VoIP and CS calls */ 196 #define BTA_AG_ERR_NOT_FOR_VOIP 34 /* Not supported on this call type(VoIP) */ 197 #define BTA_AG_ERR_SIP_RESP_CODE 35 /* SIP 3 digit response code */ 198 typedef UINT8 tBTA_AG_ERR_TYPE; 199 200 #if 0 /* Not Used in Bluetooth HFP 1.5 Specification */ 201 #define BTA_AG_ERR_PHADAP_LNK_RES 2 /* Phone-adapter link reserved */ 202 #define BTA_AG_ERR_PHFSIM_PIN_REQ 6 /* PH-FSIM PIN required */ 203 #define BTA_AG_ERR_PHFSIM_PUK_REQ 7 /* PH-FSIM PUK required */ 204 #define BTA_AG_ERR_SIM_WRONG 15 /* SIM wrong */ 205 #define BTA_AG_ERR_NOT_FOUND 22 /* Not found */ 206 #define BTA_AG_ERR_NETWORK_TIMEOUT 31 /* Network timeout */ 207 #define BTA_AG_ERR_NET_PIN_REQ 40 /* Network personalization PIN required */ 208 #define BTA_AG_ERR_NET_PUK_REQ 41 /* Network personalization PUK required */ 209 #define BTA_AG_ERR_SUBSET_PIN_REQ 42 /* Network subset personalization PIN required */ 210 #define BTA_AG_ERR_SUBSET_PUK_REQ 43 /* Network subset personalization PUK required */ 211 #define BTA_AG_ERR_SERVPRO_PIN_REQ 44 /* Service provider personalization PIN required */ 212 #define BTA_AG_ERR_SERVPRO_PUK_REQ 45 /* Service provider personalization PUK required */ 213 #define BTA_AG_ERR_CORP_PIN_REQ 46 /* Corporate personalization PIN required */ 214 #define BTA_AG_ERR_CORP_PUK_REQ 47 /* Corporate personalization PUK required */ 215 #define BTA_AG_ERR_UNKNOWN 100 /* Unknown error */ 216 /* GPRS-related errors */ 217 #define BTA_AG_ERR_ILL_MS 103 /* Illegal MS (#3) */ 218 #define BTA_AG_ERR_ILL_ME 106 /* Illegal ME (#6) */ 219 #define BTA_AG_ERR_GPRS_NOT_ALLOWED 107 /* GPRS services not allowed (#7) */ 220 #define BTA_AG_ERR_PLMN_NOT_ALLOWED 111 /* PLMN services not allowed (#11) */ 221 #define BTA_AG_ERR_LOC_NOT_ALLOWED 112 /* Location area not allowed (#12) */ 222 #define BTA_AG_ERR_ROAM_NOT_ALLOWED 113 /* Roaming not allowed in this location area (#13) */ 223 /* Errors related to a failure to Activate a Context */ 224 #define BTA_AG_ERR_OPT_NOT_SUPP 132 /* Service option not supported (#32) */ 225 #define BTA_AG_ERR_OPT_NOT_SUBSCR 133 /* Requested service option not subscribed (#33) */ 226 #define BTA_AG_ERR_OPT_OUT_OF_ORDER 134 /* Service option temporarily out of order (#34) */ 227 #define BTA_AG_ERR_PDP_AUTH_FAILURE 149 /* PDP authentication failure */ 228 /* Other GPRS errors */ 229 #define BTA_AG_ERR_INV_MOBILE_CLASS 150 /* Invalid mobile class */ 230 #define BTA_AG_ERR_UNSPEC_GPRS_ERR 148 /* Unspecified GPRS error */ 231 #endif /* Unused error codes */ 232 233 /* HFP result data 'ok_flag' */ 234 #define BTA_AG_OK_CONTINUE 0 /* Send out response (more responses coming) */ 235 #define BTA_AG_OK_DONE 1 /* Send out response followed by OK (finished) */ 236 #define BTA_AG_OK_ERROR 2 /* Error response */ 237 typedef UINT8 tBTA_AG_AT_RESULT_TYPE; 238 239 /* BTRH values */ 240 #define BTA_AG_BTRH_SET_HOLD 0 /* Put incoming call on hold */ 241 #define BTA_AG_BTRH_SET_ACC 1 /* Accept incoming call on hold */ 242 #define BTA_AG_BTRH_SET_REJ 2 /* Reject incoming call on hold */ 243 #define BTA_AG_BTRH_READ 3 /* Read the current value */ 244 #define BTA_AG_BTRH_NO_RESP 4 /* Not in RH States (reply to read) */ 245 typedef UINT8 tBTA_AG_BTRH_TYPE; 246 247 /* ASCII character string of arguments to the AT command or result */ 248 #ifndef BTA_AG_AT_MAX_LEN 249 #define BTA_AG_AT_MAX_LEN 256 250 #endif 251 252 /* indicator constants HFP 1.1 and later */ 253 #define BTA_AG_IND_CALL 0 /* position of call indicator */ 254 #define BTA_AG_IND_CALLSETUP 1 /* position of callsetup indicator */ 255 #define BTA_AG_IND_SERVICE 2 /* position of service indicator */ 256 /* indicator constants HFP 1.5 and later */ 257 #define BTA_AG_IND_SIGNAL 3 /* position of signal strength indicator */ 258 #define BTA_AG_IND_ROAM 4 /* position of roaming indicator */ 259 #define BTA_AG_IND_BATTCHG 5 /* position of battery charge indicator */ 260 #define BTA_AG_IND_CALLHELD 6 /* position of callheld indicator */ 261 #define BTA_AG_IND_BEARER 7 /* position of bearer indicator */ 262 typedef UINT16 tBTA_AG_IND_TYPE; 263 264 /* call indicator values */ 265 #define BTA_AG_CALL_INACTIVE 0 /* Phone call inactive */ 266 #define BTA_AG_CALL_ACTIVE 1 /* Phone call active */ 267 /* callsetup indicator values */ 268 #define BTA_AG_CALLSETUP_NONE 0 /* Not currently in call set up */ 269 #define BTA_AG_CALLSETUP_INCOMING 1 /* Incoming call process ongoing */ 270 #define BTA_AG_CALLSETUP_OUTGOING 2 /* Outgoing call set up is ongoing */ 271 #define BTA_AG_CALLSETUP_ALERTING 3 /* Remote party being alerted in an outgoing call */ 272 /* service indicator values */ 273 #define BTA_AG_SERVICE_NONE 0 /* Neither CS nor VoIP service is available */ 274 #define BTA_AG_SERVICE_CS 1 /* Only CS service is available */ 275 #define BTA_AG_SERVICE_VOIP 2 /* Only VoIP service is available */ 276 #define BTA_AG_SERVICE_CS_VOIP 3 /* Both CS and VoIP services available */ 277 /* callheld indicator values */ 278 #define BTA_AG_CALLHELD_INACTIVE 0 /* No held calls */ 279 #define BTA_AG_CALLHELD_ACTIVE 1 /* Call held and call active */ 280 #define BTA_AG_CALLHELD_NOACTIVE 2 /* Call held and no call active */ 281 /* signal strength indicator values */ 282 #define BTA_AG_ROAMING_INACTIVE 0 /* Phone call inactive */ 283 #define BTA_AG_ROAMING_ACTIVE 1 /* Phone call active */ 284 /* bearer indicator values */ 285 #define BTA_AG_BEARER_WLAN 0 /* WLAN */ 286 #define BTA_AG_BEARER_BLUETOOTH 1 /* Bluetooth */ 287 #define BTA_AG_BEARER_WIRED 2 /* Wired */ 288 #define BTA_AG_BEARER_2G3G 3 /* 2G 3G */ 289 #define BTA_AG_BEARER_WIMAX 4 /* WIMAX */ 290 #define BTA_AG_BEARER_RES1 5 /* Reserved */ 291 #define BTA_AG_BEARER_RES2 6 /* Reserved */ 292 #define BTA_AG_BEARER_RES3 7 /* Reserved */ 293 294 /* data associated with BTA_AG_IND_RES */ 295 typedef struct 296 { 297 tBTA_AG_IND_TYPE type; 298 UINT16 value; 299 } tBTA_AG_IND; 300 301 /* data type for BTA_AgResult() */ 302 typedef struct 303 { 304 char str[BTA_AG_AT_MAX_LEN+1]; /* used for cops,clcc,cnum... */ 305 tBTA_AG_IND ind; /* used for indicator type */ 306 UINT16 num; /* used for codec state */ 307 UINT16 audio_handle; /* used for audio path */ 308 UINT16 errcode; /* Valid only if 'ok_flag' is set to BTA_AG_OK_ERROR */ 309 UINT8 ok_flag; /* Indicates if response is finished, and if error occurred */ 310 BOOLEAN state; 311 } tBTA_AG_RES_DATA; 312 313 /* data associated with most non-AT events */ 314 typedef struct 315 { 316 UINT16 handle; 317 UINT8 app_id; 318 tBTA_AG_STATUS status; 319 } tBTA_AG_HDR; 320 321 /* data associated with BTA_AG_REGISTER_EVT */ 322 typedef struct 323 { 324 tBTA_AG_HDR hdr; 325 UINT16 handle; 326 tBTA_AG_STATUS status; 327 } tBTA_AG_REGISTER; 328 329 /* data associated with BTA_AG_OPEN_EVT */ 330 typedef struct 331 { 332 tBTA_AG_HDR hdr; 333 BD_ADDR bd_addr; 334 tBTA_SERVICE_ID service_id; 335 tBTA_AG_STATUS status; 336 } tBTA_AG_OPEN; 337 338 /* data associated with BTA_AG_CLOSE_EVT */ 339 typedef struct 340 { 341 tBTA_AG_HDR hdr; 342 BD_ADDR bd_addr; 343 } tBTA_AG_CLOSE; 344 345 /* data associated with BTA_AG_CONN_EVT */ 346 typedef struct 347 { 348 tBTA_AG_HDR hdr; 349 tBTA_AG_PEER_FEAT peer_feat; 350 BD_ADDR bd_addr; 351 tBTA_AG_PEER_CODEC peer_codec; 352 tBTA_AG_CHLD_FEAT chld_feat; 353 } tBTA_AG_CONN; 354 355 /* data associated with AT command event */ 356 typedef struct 357 { 358 tBTA_AG_HDR hdr; 359 BD_ADDR bd_addr; 360 char str[BTA_AG_AT_MAX_LEN+1]; 361 UINT16 num; /* voice recognition state*/ 362 UINT8 idx; /* call number used by CLCC and CHLD */ 363 UINT16 value; 364 } tBTA_AG_VAL; 365 366 /* data associated with BTA_AG_CLIP_EVT and BTA_AG_CCWA_EVT*/ 367 #define BTA_AG_NUMBER_LEN 32 368 typedef struct { 369 char number[BTA_AG_NUMBER_LEN + 1]; 370 } tBTA_AG_NUMBER; 371 372 /* data associated with BTA_HF_CLIENT_OPERATOR_NAME_EVT */ 373 #define BTA_AG_COPS_LEN 16 374 typedef struct { 375 char name[BTA_AG_COPS_LEN + 1]; 376 } tBTA_AG_COPS; 377 378 /* data associated with BTA_AG_AT_RESULT_EVT event */ 379 typedef struct { 380 tBTA_AG_AT_RESULT_TYPE type; 381 UINT16 cme; 382 } tBTA_AG_AT_RESULT; 383 384 /* data associated with BTA_AG_CLCC_EVT event */ 385 typedef struct { 386 UINT32 idx; 387 BOOLEAN inc; 388 UINT8 status; 389 BOOLEAN mpty; 390 BOOLEAN number_present; 391 char number[BTA_AG_NUMBER_LEN + 1]; 392 } tBTA_AG_CLCC; 393 394 /* data associated with BTA_AG_CNUM_EVT event */ 395 typedef struct { 396 UINT16 service; 397 char number[BTA_AG_NUMBER_LEN + 1]; 398 } tBTA_AG_CNUM; 399 400 /* union of data associated with AG callback */ 401 typedef union 402 { 403 tBTA_AG_HDR hdr; 404 tBTA_AG_REGISTER reg; 405 tBTA_AG_OPEN open; 406 tBTA_AG_CLOSE close; 407 tBTA_AG_CONN conn; 408 tBTA_AG_IND ind; 409 tBTA_AG_VAL val; 410 //add 411 tBTA_AG_COPS operator; 412 tBTA_AG_NUMBER number; 413 tBTA_AG_AT_RESULT result; 414 tBTA_AG_CLCC clcc; 415 tBTA_AG_CNUM cnum; 416 } tBTA_AG; 417 418 /* AG callback */ 419 typedef void (tBTA_AG_CBACK)(tBTA_AG_EVT event, tBTA_AG *p_data); 420 421 /* AG configuration structure */ 422 typedef struct 423 { 424 char *cind_info; 425 INT32 conn_tout; 426 UINT16 sco_pkt_types; 427 char *chld_val_ecc; 428 char *chld_val; 429 } tBTA_AG_CFG; 430 431 #ifdef __cplusplus 432 extern "C" 433 { 434 #endif 435 436 /***************************************************************************** 437 ** External Function Declarations 438 *****************************************************************************/ 439 440 /******************************************************************************* 441 ** 442 ** Function BTA_AgEnable 443 ** 444 ** Description Enable the audio gateway service. When the enable 445 ** operation is complete the callback function will be 446 ** called with a BTA_AG_ENABLE_EVT. This function must 447 ** be called before other function in the AG API are 448 ** called. 449 ** 450 ** Returns BTA_SUCCESS if OK, BTA_FAILURE otherwise. 451 ** 452 *******************************************************************************/ 453 tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback); 454 455 /******************************************************************************* 456 ** 457 ** Function BTA_AgDisable 458 ** 459 ** Description Disable the audio gateway service 460 ** 461 ** 462 ** Returns void 463 ** 464 *******************************************************************************/ 465 void BTA_AgDisable(void); 466 467 /******************************************************************************* 468 ** 469 ** Function BTA_AgRegister 470 ** 471 ** Description Register an Audio Gateway service. 472 ** 473 ** 474 ** Returns void 475 ** 476 *******************************************************************************/ 477 void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask, 478 tBTA_AG_FEAT features, char *p_service_names[], UINT8 app_id); 479 480 /******************************************************************************* 481 ** 482 ** Function BTA_AgDeregister 483 ** 484 ** Description Deregister an audio gateway service. 485 ** 486 ** 487 ** Returns void 488 ** 489 *******************************************************************************/ 490 void BTA_AgDeregister(UINT16 handle); 491 492 /******************************************************************************* 493 ** 494 ** Function BTA_AgOpen 495 ** 496 ** Description Opens a connection to a headset or hands-free device. 497 ** When connection is open callback function is called 498 ** with a BTA_AG_OPEN_EVT. Only the data connection is 499 ** opened. The audio connection is not opened. 500 ** 501 ** 502 ** Returns void 503 ** 504 *******************************************************************************/ 505 void BTA_AgOpen(UINT16 handle, BD_ADDR bd_addr, tBTA_SEC sec_mask, tBTA_SERVICE_MASK services); 506 507 /******************************************************************************* 508 ** 509 ** Function BTA_AgClose 510 ** 511 ** Description Close the current connection to a headset or a handsfree 512 ** Any current audio connection will also be closed 513 ** 514 ** 515 ** Returns void 516 ** 517 *******************************************************************************/ 518 void BTA_AgClose(UINT16 handle); 519 520 /******************************************************************************* 521 ** 522 ** Function BTA_AgAudioOpen 523 ** 524 ** Description Opens an audio connection to the currently connected 525 ** headset or hnadsfree 526 ** 527 ** 528 ** Returns void 529 ** 530 *******************************************************************************/ 531 void BTA_AgAudioOpen(UINT16 handle); 532 533 /******************************************************************************* 534 ** 535 ** Function BTA_AgAudioClose 536 ** 537 ** Description Close the currently active audio connection to a headset 538 ** or hnadsfree. The data connection remains open 539 ** 540 ** 541 ** Returns void 542 ** 543 *******************************************************************************/ 544 void BTA_AgAudioClose(UINT16 handle); 545 546 /******************************************************************************* 547 ** 548 ** Function BTA_AgResult 549 ** 550 ** Description Send an AT result code to a headset or hands-free device. 551 ** This function is only used when the AG parse mode is set 552 ** to BTA_AG_PARSE. 553 ** 554 ** 555 ** Returns void 556 ** 557 *******************************************************************************/ 558 void BTA_AgResult(UINT16 handle, tBTA_AG_RES result, tBTA_AG_RES_DATA *p_data); 559 560 /******************************************************************************* 561 ** 562 ** Function BTA_AgSetCodec 563 ** 564 ** Description Specify the codec type to be used for the subsequent 565 ** audio connection. 566 ** 567 ** 568 ** 569 ** Returns void 570 ** 571 *******************************************************************************/ 572 void BTA_AgSetCodec(UINT16 handle, tBTA_AG_PEER_CODEC codec); 573 574 575 #if (BTM_SCO_HCI_INCLUDED == TRUE ) 576 /******************************************************************************* 577 ** 578 ** Function BTA_AgCiData 579 ** 580 ** Description Give an EVT to BTA that tell outgoing data is ready. 581 ** 582 ** 583 ** Returns void 584 ** 585 *******************************************************************************/ 586 void BTA_AgCiData(UINT16 handle); 587 #endif /*#if (BTM_SCO_HCI_INCLUDED == TRUE ) */ 588 589 #ifdef __cplusplus 590 } 591 #endif 592 593 #endif /* #if (BTA_AG_INCLUDED == TRUE) */ 594 595 #endif /* BTA_HF_API_H */ 596