2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _BLUETOOTH_TELEPHONY_API_H_
19 #define _BLUETOOTH_TELEPHONY_API_H_
27 #endif /*__cplusplus*/
29 typedef void (*bt_telephony_func_ptr)(int, void *, void *);
31 #define BLUETOOTH_TELEPHONY_ERROR_NONE ((int)0)
32 #define BLUETOOTH_TELEPHONY_ERROR_INTERNAL \
33 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x01)
34 #define BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM \
35 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x02)
36 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_INITIALIZED \
37 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x03)
38 #define BLUETOOTH_TELEPHONY_ERROR_NOT_INITIALIZED \
39 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x04)
40 #define BLUETOOTH_TELEPHONY_ERROR_AUDIO_NOT_CONNECTED \
41 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x05)
42 #define BLUETOOTH_TELEPHONY_ERROR_NOT_ENABLED \
43 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x06)
44 #define BLUETOOTH_TELEPHONY_ERROR_NOT_AVAILABLE \
45 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x07)
46 #define BLUETOOTH_TELEPHONY_ERROR_NOT_CONNECTED \
47 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x08)
48 #define BLUETOOTH_TELEPHONY_ERROR_BUSY \
49 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x09)
50 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_EXSIST \
51 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0A)
52 #define BLUETOOTH_TELEPHONY_ERROR_NO_MEMORY \
53 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0B)
54 #define BLUETOOTH_TELEPHONY_ERROR_I_O_ERROR \
55 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0C)
56 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_CONNECTED \
57 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0D)
58 #define BLUETOOTH_TELEPHONY_ERROR_OPERATION_NOT_AVAILABLE \
59 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0E)
60 #define BLUETOOTH_TELEPHONY_ERROR_PERMISSION_DENIED \
61 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0F)
63 #define BT_ADDRESS_STR_LEN 18
64 #define BT_ADAPTER_PATH_LEN 50
65 #define BT_AUDIO_CALL_PATH_LEN 50
71 } telephony_event_param_t;
75 } telephony_event_callid_t;
79 } telephony_event_dtmf_t;
82 BLUETOOTH_STATE_CONNECTED,
83 BLUETOOTH_STATE_PLAYING,
84 BLUETOOTH_STATE_DISCONNETED,
85 } bluetooth_headset_state_t;
88 BLUETOOTH_TELEPHONY_ERROR_INVALID_CHLD_INDEX,
89 BLUETOOTH_TELEPHONY_ERROR_BATTERY_STATUS,
90 BLUETOOTH_TELEPHONY_ERROR_SIGNAL_STATUS,
91 BLUETOOTH_TELEPHONY_ERROR_NOT_SUPPORTED,
92 BLUETOOTH_TELEPHONY_ERROR_APPLICATION,
93 BLUETOOTH_TELEPHONY_ERROR_INVALID_DTMF,
94 } bluetooth_telephony_error_t;
98 CSD_CALL_STATUS_CREATE,
99 CSD_CALL_STATUS_COMING,
100 CSD_CALL_STATUS_PROCEEDING,
101 CSD_CALL_STATUS_MO_ALERTING,
102 CSD_CALL_STATUS_MT_ALERTING,
103 CSD_CALL_STATUS_WAITING,
104 CSD_CALL_STATUS_ANSWERED,
105 CSD_CALL_STATUS_ACTIVE,
106 CSD_CALL_STATUS_MO_RELEASE,
107 CSD_CALL_STATUS_MT_RELEASE,
108 CSD_CALL_STATUS_HOLD_INITIATED,
109 CSD_CALL_STATUS_HOLD,
110 CSD_CALL_STATUS_RETRIEVE_INITIATED,
111 CSD_CALL_STATUS_RECONNECT_PENDING,
112 CSD_CALL_STATUS_TERMINATED,
113 CSD_CALL_STATUS_SWAP_INITIATED,
114 } bt_telephony_call_status_t;
116 #define BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE (unsigned int)(0x00500)
119 BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL = BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE,
120 BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL,
121 BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL,
122 BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL,
123 BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL,
124 BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL,
125 BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL,
126 BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER,
127 BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF,
128 BLUETOOTH_EVENT_TELEPHONY_HFP_CONNECTED,
129 BLUETOOTH_EVENT_TELEPHONY_HFP_DISCONNECTED,
130 BLUETOOTH_EVENT_TELEPHONY_AUDIO_CONNECTED,
131 BLUETOOTH_EVENT_TELEPHONY_AUDIO_DISCONNECTED,
132 BLUETOOTH_EVENT_TELEPHONY_SET_SPEAKER_GAIN,
133 BLUETOOTH_EVENT_TELEPHONY_SET_MIC_GAIN,
134 BLUETOOTH_EVENT_TELEPHONY_NREC_CHANGED,
135 BLUETOOTH_EVENT_TELEPHONY_VENDOR_AT_CMD,
136 } bluetooth_telephony_event_type;
139 BLUETOOTH_CALL_STATE_NONE,
140 BLUETOOTH_CALL_STATE_CONNECTED,
141 BLUETOOTH_CALL_STATE_HELD,
142 BLUETOOTH_CALL_STATE_DIALLING,
143 BLUETOOTH_CALL_STATE_ALERTING,
144 BLUETOOTH_CALL_STATE_INCOMING,
145 BLUETOOTH_CALL_STATE_WAITING,
146 BLUETOOTH_CALL_STATE_ERROR,
147 } bt_telephony_call_state_t;
150 unsigned int call_id;
151 bt_telephony_call_state_t call_status;
153 } bt_telephony_call_status_info_t;
156 * @brief The function bluetooth_telephony_init is initialize telephony calls.
158 * @param[in] cb Callback function
159 * @param[in] user_data Data sent by application, which will be
160 * returned in event handler.
161 * @return int Zero on Success or reason for error if any.
164 int bluetooth_telephony_init(bt_telephony_func_ptr cb, void *user_data);
167 * @brief The function bluetooth_telephony_deinit is deinitialize telephony calls.
169 * @return int Zero on Success or reason for error if any.
172 int bluetooth_telephony_deinit(void);
175 * @brief The function bluetooth_telephony_audio_open is to open SCO channel
177 * @return int Zero on Success or reason for error if any.
180 int bluetooth_telephony_audio_open(void);
183 * @brief The function bluetooth_telephony_audio_close is to close SCO channel.
184 * that the Volume on AG is changed.
186 * @return int Zero on Success or reason for error if any.
189 int bluetooth_telephony_audio_close(void);
192 * @brief The function bluetooth_telephony_call_remote_ringing is send
195 * @param[in] call_id Call Id.
196 * @return int Zero on Success or reason for error if any.
199 int bluetooth_telephony_call_remote_ringing(unsigned int call_id);
202 * @brief The function bluetooth_telephony_call_answered is called to
205 * @param[in] call_id Call Id.
206 * @param[in] bt_audio flag
207 * @return int Zero on Success or reason for error if any.
210 int bluetooth_telephony_call_answered(unsigned int call_id,
211 unsigned int bt_audio);
214 * @brief The function bluetooth_telephony_call_end to end call
216 * @param[in] call_id Call Id.
217 * @return int Zero on Success or reason for error if any.
220 int bluetooth_telephony_call_end(unsigned int call_id);
223 * @brief The function bluetooth_telephony_call_held to hold call
225 * @param[in] call_id Call Id.
226 * @return int Zero on Success or reason for error if any.
229 int bluetooth_telephony_call_held(unsigned int call_id);
232 * @brief The function bluetooth_telephony_call_retrieved to retrieve call
234 * @param[in] call_id Call Id.
235 * @return int Zero on Success or reason for error if any.
238 int bluetooth_telephony_call_retrieved(unsigned int call_id);
241 * @brief The function bluetooth_telephony_call_swapped to swap call
243 * @param[in] call_list Call info such as id and status.
244 * @param[in] call_count Call count.
245 * @return int Zero on Success or reason for error if any.
248 int bluetooth_telephony_call_swapped(void *call_list,
249 unsigned int call_count);
252 * @brief The function bluetooth_telephony_set_call_status to set call status
254 * @param[in] call_list Call info such as id and status.
255 * @param[in] call_count Call count.
256 * @return int Zero on Success or reason for error if any.
259 int bluetooth_telephony_set_call_status(void *call_list,
260 unsigned int call_count);
263 * @brief The function bluetooth_telephony_indicate_outgoing_call toindicate
266 * @param[in] ph_number Phone number of the outgoing call.
267 * @param[in] call_id Call ID.
268 * @param[in] bt_audio Flag.
269 * @return int Zero on Success or reason for error if any.
272 int bluetooth_telephony_indicate_outgoing_call(
273 const char *ph_number, unsigned int call_id,
274 unsigned int bt_audio);
277 * @brief The function bluetooth_telephony_indicate_incoming_call to indicate
280 * @param[in] call_info Call info such as id and status.
281 * @param[in] call_count Call count.
282 * @return int Zero on Success or reason for error if any.
285 int bluetooth_telephony_indicate_incoming_call(
286 const char *ph_number, unsigned int call_id);
289 * @brief The function bluetooth_telephony_is_sco_connected to check
290 * if SCO channel is connected.
292 * @return gboolean TRUE if headset playing else FALSE.
295 gboolean bluetooth_telephony_is_sco_connected(void);
298 * @brief The function bluetooth_telephony_is_nrec_enabled to check
299 * for noise reduction and echo cancelation(nrec) status
301 * @return int Zero on Success or reason for error if any.
304 int bluetooth_telephony_is_nrec_enabled(gboolean *status);
307 * @brief The function bluetooth_telephony_is_nrec_enabled to check
308 * for wide band speech status
310 * @return int Zero on Success or reason for error if any.
313 int bluetooth_telephony_is_wbs_mode(gboolean *status);
316 * @brief This function send XSAT vendor specific AT command
318 * @return int Zero on Success or reason for error if any.
320 int bluetooth_telephony_send_vendor_cmd(const char *cmd);
324 * @brief This function sends request to enable voice recognition feature
326 * @return int Zero on Success or reason for error if any.
328 int bluetooth_telephony_start_voice_recognition(void);
331 * @brief This function sends request to disable voice recognition feature
333 * @return int Zero on Success or reason for error if any.
335 int bluetooth_telephony_stop_voice_recognition(void);
339 * @brief The function bluetooth_telephony_get_headset_volume is called to get
340 * the changed Volume on AG.
342 * @param[out] speaker_gain Speaker gain.
343 * @return int Zero on Success or reason for error if any.
346 int bluetooth_telephony_get_headset_volume(unsigned int *speaker_gain);
349 * @brief The function bluetooth_telephony_set_speaker_gain is called to indicate
350 * that the Volume on AG is changed.
352 * @param[in] speaker_gain Speaker gain.
353 * @return int Zero on Success or reason for error if any.
356 int bluetooth_telephony_set_speaker_gain(unsigned short speaker_gain);
359 * @brief The function bluetooth_telephony_is_connected is called to get
360 * the connection state on AG.
362 * @param[in] ag_connnected Connection state.
363 * @return int Zero on Success or reason for error if any.
366 int bluetooth_telephony_is_connected(gboolean *ag_connected);
370 #endif /*__cplusplus*/
371 #endif/*_BLUETOOTH_TELEPHONY_API_H_*/