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