141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/******************************************************************************
241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  Copyright (c) 2014 The Android Open Source Project
441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  Copyright (C) 2003-2012 Broadcom Corporation
541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  Licensed under the Apache License, Version 2.0 (the "License");
741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  you may not use this file except in compliance with the License.
841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  You may obtain a copy of the License at:
941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
1041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  http://www.apache.org/licenses/LICENSE-2.0
1141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
1241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  Unless required by applicable law or agreed to in writing, software
1341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  distributed under the License is distributed on an "AS IS" BASIS,
1441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  See the License for the specific language governing permissions and
1641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  limitations under the License.
1741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
1841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta ******************************************************************************/
1941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
2041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/******************************************************************************
2141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
2241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *  This is the public interface file for the handsfree (HF role) subsystem
2341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta *
2441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta ******************************************************************************/
2541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#ifndef BTA_HF_CLIENT_API_H
2641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#define BTA_HF_CLIENT_API_H
2741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
2841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#include "bta_api.h"
2941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
3041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*****************************************************************************
318af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *  Constants and data types
328af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ****************************************************************************/
3341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
3441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HFP peer (AG) features*/
35cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_FEAT_3WAY 0x00000001 /* Three-way calling */
36cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_FEAT_ECNR \
37cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000002 /* Echo cancellation and/or noise reduction */
38cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_FEAT_VREC 0x00000004 /* Voice recognition */
39cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_INBAND 0x00000008    /* In-band ring tone */
40cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_VTAG \
41cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000010 /* Attach a phone number to a voice tag */
42cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_REJECT \
43cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000020                              /* Ability to reject incoming call */
44cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_ECS 0x00000040 /* Enhanced Call Status */
45cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_ECC 0x00000080 /* Enhanced Call Control */
46cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_EXTERR 0x00000100 /* Extended error codes */
47cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_PEER_CODEC 0x00000200  /* Codec Negotiation */
4841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
49e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint16_t tBTA_HF_CLIENT_PEER_FEAT;
5041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
5141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HFP HF features */
52cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_ECNR \
53cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000001 /* Echo cancellation and/or noise reduction */
54cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_3WAY \
55cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000002 /* Call waiting and three-way calling */
56cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_CLI \
57cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000004 /* Caller ID presentation capability */
58cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_VREC 0x00000008  /* Voice recognition activation */
59cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_VOL 0x00000010   /* Remote volume control */
60cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_ECS 0x00000020   /* Enhanced Call Status */
61cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_ECC 0x00000040   /* Enhanced Call Control */
62cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
6341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
6441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HFP HF extended call handling - masks not related to any spec */
65cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_REL \
66cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000001 /* 0  Release waiting call or held calls */
67cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_REL_ACC                                             \
68cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000002 /* 1  Release active calls and accept other (waiting or held) cal \
69cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson                */
70cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_REL_X 0x00000004 /* 1x Release x call*/
71cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_HOLD_ACC \
72cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000008 /* 2  Active calls on hold and accept other call */
73cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_PRIV_X \
74cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000010 /* 2x Active multiparty call on hold except call x */
75cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_MERGE               \
76cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000020 /* 3  Add held call to multiparty \
77cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson                */
78cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CHLD_MERGE_DETACH \
79cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  0x00000040 /* 4  Add held call to multiparty */
8041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
81e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint16_t tBTA_HF_CLIENT_CHLD_FEAT;
8241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
8341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HFP AG errors ot OK sent to HF Unit */
84cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_OK 0
85cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_ERROR 1
86cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_NO_CARRIER 2
87cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_BUSY 3
88cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_NO_ANSWER 4
89cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_DELAY 5
90cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_BLACKLISTED 6
91cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_CME 7
9241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
93e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_AT_RESULT_TYPE;
9441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
9541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HF Client callback events */
96cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_ENABLE_EVT 0     /* HF Client enabled */
97cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_REGISTER_EVT 1   /* HF Client registered */
98cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_OPEN_EVT 2       /* HF Client connection open */
99cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CLOSE_EVT 3      /* HF Client connection closed */
100cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CONN_EVT 4       /* Service level connection opened */
101cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AUDIO_OPEN_EVT 5 /* Audio connection open */
102cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AUDIO_MSBC_OPEN_EVT \
103cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  6 /* Audio connection with mSBC codec open */
104cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AUDIO_CLOSE_EVT 7 /* Audio connection closed */
105cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_SPK_EVT 8         /* Speaker volume changed */
106cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_MIC_EVT 9         /* Microphone volume changed */
107cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_EVT 10        /* Indicator */
108cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_VOICE_REC_EVT \
109cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  11 /* AG changed voice recognition setting */
110cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_OPERATOR_NAME_EVT 12 /* Operator name acquired */
111cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CLIP_EVT 13      /* Calling line identification event */
112cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CCWA_EVT 14      /* Call waiting notification */
113cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_RESULT_EVT 15 /* Call waiting notification */
114cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CLCC_EVT 16      /* current call event */
115cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_CNUM_EVT 17      /* subscriber information event */
116cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_BTRH_EVT 18      /* bluetooth response and hold event */
117cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_BSIR_EVT                                               \
118cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  19                              /* in-band ring tone setting changed event \
119cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson                                     */
120cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_BINP_EVT 20 /* binp number event */
121cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_RING_INDICATION 21 /* HF Client ring indication */
122cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_DISABLE_EVT 30     /* HF Client disabled */
12341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
124e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_EVT;
12541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
12641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HF Client open status */
127cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_SUCCESS 0        /* Connection successfully opened */
128cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FAIL_SDP 1       /* Open failed due to SDP */
129cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FAIL_RFCOMM 2    /* Open failed due to RFCOMM */
130cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_FAIL_RESOURCES 3 /* out of resources failure  */
13141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
132e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_STATUS;
13341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
13441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* indicator type */
135cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_BATTCH 0    /* Battery charge indicator */
136cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_SIGNAL 1    /* Signal Strength indicator */
137cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_SERVICE 2   /* Service availability indicator */
138cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_CALL 3      /* Standard call status indicator*/
139cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_ROAM 4      /* Roaming status indicator */
140cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
141cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_IND_CALLHELD 6  /* Call hold status indicator */
14241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
143e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_IND_TYPE;
14441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
14541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* AT commands */
146cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_VTS 0
147cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_BTRH 1
148cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_CHUP 2
149cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_CHLD 3
150cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_BCC 4
151cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_CNUM 5
152cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_ATA 6
153cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_COPS 7
154cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_ATD 8
155cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_VGM 9
156cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_VGS 10
157cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_BVRA 11
158cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_CLCC 12
159cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_BINP 13
160cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_BLDN 14
161cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_CMD_NREC 15
16241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
163e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_AT_CMD_TYPE;
16441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
16541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_REGISTER_EVT */
166cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
1679e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
168cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_STATUS status;
16941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_REGISTER;
17041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
17141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_OPEN_EVT */
172cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
1739e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
1746664b2ccbbf0240524bc23c5dc81c690cf4daffaSanket Agarwal  uint16_t handle;  // Handle for client control block
175cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_STATUS status;
17641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_OPEN;
17741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
17841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_CONN_EVT */
179cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
1809e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
181cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_PEER_FEAT peer_feat;
182cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_CHLD_FEAT chld_feat;
18341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_CONN;
18441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
18541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_IND_EVT event */
186cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
1879e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
188cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_IND_TYPE type;
189cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  uint16_t value;
19041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_IND;
19141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
19241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_OPERATOR_NAME_EVT */
19341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#define BTA_HF_CLIENT_OPERATOR_NAME_LEN 16
194cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
1959e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
196cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  char name[BTA_HF_CLIENT_OPERATOR_NAME_LEN + 1];
19741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_OPERATOR_NAME;
19841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
19941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_CLIP_EVT  and BTA_HF_CLIENT_CCWA_EVT*/
20041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#define BTA_HF_CLIENT_NUMBER_LEN 32
201cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
2029e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
203cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
20441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_NUMBER;
20541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
20641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_AT_RESULT_EVT event */
207cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
2089e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
209cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_AT_RESULT_TYPE type;
210cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  uint16_t cme;
21141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_AT_RESULT;
21241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
21341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_CLCC_EVT event */
214cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
2159e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
216cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  uint32_t idx;
217cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  bool inc;
218cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  uint8_t status;
219cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  bool mpty;
220cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  bool number_present;
221cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
22241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_CLCC;
22341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
22441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with BTA_HF_CLIENT_CNUM_EVT event */
225cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct {
2269e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
227cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  uint16_t service;
228cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
22941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_CNUM;
23041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
23141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* data associated with other events */
232bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwaltypedef struct {
2339e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
234bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal  uint16_t value;
235bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal} tBTA_HF_CLIENT_VAL;
23641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
23741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* union of data associated with AG callback */
238cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef union {
2395eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal  // Common BD ADDR field for all tyepdefs
2409e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowski  RawAddress bd_addr;
241cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_REGISTER reg;
242cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_OPEN open;
243cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_CONN conn;
244cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_IND ind;
245cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_VAL val;
246cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_OPERATOR_NAME operator_name;
247cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_NUMBER number;
248cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_AT_RESULT result;
249cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_CLCC clcc;
250cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson  tBTA_HF_CLIENT_CNUM cnum;
25141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT;
25241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
253e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint32_t tBTA_HF_CLIENT_FEAT;
25441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
25541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* HF Client callback */
256cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef void(tBTA_HF_CLIENT_CBACK)(tBTA_HF_CLIENT_EVT event,
257cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson                                   tBTA_HF_CLIENT* p_data);
25841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
25941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*****************************************************************************
2608af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *  External Function Declarations
2618af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ****************************************************************************/
26241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
26341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
2648af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2658af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientEnable
2668af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2678af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      Enable the HF CLient service. When the enable
2688af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  operation is complete the callback function will be
2698af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  called with a BTA_HF_CLIENT_ENABLE_EVT. This function must
2708af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  be called before other function in the HF CLient API are
2718af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  called.
2728af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2738af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          BTA_SUCCESS if OK, BTA_FAILURE otherwise.
2748af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2758af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
276bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket AgarwaltBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK* p_cback, tBTA_SEC sec_mask,
277bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal                               tBTA_HF_CLIENT_FEAT features,
278bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal                               const char* p_service_name);
27941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
28041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
2818af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2828af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientDisable
2838af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
284bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal * Description      Disable the HF Client service.
2858af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2868af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
2878af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2888af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
28924933b5b1a06274c47133debac5251a97128a267June R. Tate-Gansvoid BTA_HfClientDisable(void);
29041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
29141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
2928af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2938af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientOpen
2948af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
2958af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      Opens a connection to an audio gateway.
2968af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  When connection is open callback function is called
2978af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  with a BTA_HF_CLIENT_OPEN_EVT. Only the data connection is
298bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal *                  opened. The audio connection is not opened. The handle
299bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal *                  is stored in p_handle and should be used for subsequent
300bdcfc045f9d21afc1510cdad4fddd97a93c26477Sanket Agarwal *                  calls to do any AT operations
3018af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3028af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3038af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
3048af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3058af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
3069e030fde05352ec4385d7baf6cc2af89e95e039cJakub Pawlowskivoid BTA_HfClientOpen(const RawAddress& bd_addr, tBTA_SEC sec_mask,
307744eeca761b6d52d4e5fbbfa49c2d2adde0e6981Jakub Pawlowski                      uint16_t* p_handle);
30841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
30941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
3108af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3118af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientClose
3128af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3138af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      Close the current connection to an audio gateway.
3148af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  Any current audio connection will also be closed
3158af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3168af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3178af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
3188af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3198af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
320e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssenvoid BTA_HfClientClose(uint16_t handle);
32141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
32241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
3238af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3248af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfCllientAudioOpen
3258af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3268af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      Opens an audio connection to the currently connected
3278af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                 audio gateway
3288af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3298af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3308af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
3318af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3328af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
333e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssenvoid BTA_HfClientAudioOpen(uint16_t handle);
33441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
33541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
3368af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3378af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientAudioClose
3388af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3398af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      Close the currently active audio connection to an audio
3408af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *                  gateway. The data connection remains open
3418af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3428af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3438af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
3448af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3458af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
346e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssenvoid BTA_HfClientAudioClose(uint16_t handle);
34741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
34841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/*******************************************************************************
3498af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3508af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Function         BTA_HfClientSendAT
3518af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3528af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Description      send AT command
3538af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3548af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3558af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Returns          void
3568af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson *
3578af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ******************************************************************************/
358cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsonvoid BTA_HfClientSendAT(uint16_t handle, tBTA_HF_CLIENT_AT_CMD_TYPE at,
359cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson                        uint32_t val1, uint32_t val2, const char* str);
36041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta
3615eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal/*******************************************************************************
3625eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal *
3635eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal * Function         BTA_HfClientDumpStatistics
3645eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal *
3655eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal * Description      Dump statistics about the various control blocks
3665eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal *                  and other relevant connection statistics
3675eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal *
3685eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal * Returns          Void
3695eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal *
3705eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal ******************************************************************************/
3715eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwalvoid BTA_HfClientDumpStatistics(int fd);
3725eccd90936d606e0070872b247fd3462e9c9c19bSanket Agarwal
37341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#endif /* BTA_HF_CLIENT_API_H */
374