4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * GirishAshok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef _BLUETOOTH_TELEPHONY_API_H_
25 #define _BLUETOOTH_TELEPHONY_API_H_
33 #endif /*__cplusplus*/
35 typedef void (*bt_telephony_func_ptr)(int, void *, void *);
37 #define BLUETOOTH_TELEPHONY_ERROR_NONE ((int)0)
38 #define BLUETOOTH_TELEPHONY_ERROR_INTERNAL \
39 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x01)
40 #define BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM \
41 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x02)
42 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_INITIALIZED \
43 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x03)
44 #define BLUETOOTH_TELEPHONY_ERROR_NOT_INITIALIZED \
45 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x04)
46 #define BLUETOOTH_TELEPHONY_ERROR_AUDIO_NOT_CONNECTED \
47 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x05)
48 #define BLUETOOTH_TELEPHONY_ERROR_NOT_ENABLED \
49 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x06)
50 #define BLUETOOTH_TELEPHONY_ERROR_NOT_AVAILABLE \
51 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x07)
52 #define BLUETOOTH_TELEPHONY_ERROR_NOT_CONNECTED \
53 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x08)
54 #define BLUETOOTH_TELEPHONY_ERROR_BUSY \
55 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x09)
56 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_EXSIST \
57 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0A)
58 #define BLUETOOTH_TELEPHONY_ERROR_NO_MEMORY \
59 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0B)
60 #define BLUETOOTH_TELEPHONY_ERROR_I_O_ERROR \
61 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0C)
62 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_CONNECTED \
63 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0D)
64 #define BLUETOOTH_TELEPHONY_ERROR_OPERATION_NOT_AVAILABLE \
65 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0E)
66 #define BLUETOOTH_TELEPHONY_ERROR_PERMISSION_DENIED \
67 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0F)
69 #define BT_ADDRESS_STR_LEN 18
70 #define BT_ADAPTER_PATH_LEN 50
71 #define BT_AUDIO_CALL_PATH_LEN 50
77 } telephony_event_param_t;
81 } telephony_event_callid_t;
85 } telephony_event_dtmf_t;
88 BLUETOOTH_STATE_CONNECTED,
89 BLUETOOTH_STATE_PLAYING,
90 BLUETOOTH_STATE_DISCONNETED,
91 } bluetooth_headset_state_t;
94 BLUETOOTH_TELEPHONY_ERROR_INVALID_CHLD_INDEX,
95 BLUETOOTH_TELEPHONY_ERROR_BATTERY_STATUS,
96 BLUETOOTH_TELEPHONY_ERROR_SIGNAL_STATUS,
97 BLUETOOTH_TELEPHONY_ERROR_NOT_SUPPORTED,
98 BLUETOOTH_TELEPHONY_ERROR_APPLICATION,
99 BLUETOOTH_TELEPHONY_ERROR_INVALID_DTMF,
100 } bluetooth_telephony_error_t;
103 CSD_CALL_STATUS_IDLE,
104 CSD_CALL_STATUS_CREATE,
105 CSD_CALL_STATUS_COMING,
106 CSD_CALL_STATUS_PROCEEDING,
107 CSD_CALL_STATUS_MO_ALERTING,
108 CSD_CALL_STATUS_MT_ALERTING,
109 CSD_CALL_STATUS_WAITING,
110 CSD_CALL_STATUS_ANSWERED,
111 CSD_CALL_STATUS_ACTIVE,
112 CSD_CALL_STATUS_MO_RELEASE,
113 CSD_CALL_STATUS_MT_RELEASE,
114 CSD_CALL_STATUS_HOLD_INITIATED,
115 CSD_CALL_STATUS_HOLD,
116 CSD_CALL_STATUS_RETRIEVE_INITIATED,
117 CSD_CALL_STATUS_RECONNECT_PENDING,
118 CSD_CALL_STATUS_TERMINATED,
119 CSD_CALL_STATUS_SWAP_INITIATED,
120 } bt_telephony_call_status_t;
122 #define BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE (unsigned int)(0x00500)
125 BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL = BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE,
126 BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL,
127 BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL,
128 BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL,
129 BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL,
130 BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL,
131 BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL,
132 BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER,
133 BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF,
134 BLUETOOTH_EVENT_TELEPHONY_HFP_CONNECTED,
135 BLUETOOTH_EVENT_TELEPHONY_HFP_DISCONNECTED,
136 BLUETOOTH_EVENT_TELEPHONY_AUDIO_CONNECTED,
137 BLUETOOTH_EVENT_TELEPHONY_AUDIO_DISCONNECTED,
138 BLUETOOTH_EVENT_TELEPHONY_SET_SPEAKER_GAIN,
139 BLUETOOTH_EVENT_TELEPHONY_SET_MIC_GAIN,
140 BLUETOOTH_EVENT_TELEPHONY_NREC_CHANGED,
141 BLUETOOTH_EVENT_TELEPHONY_VENDOR_AT_CMD,
142 } bluetooth_telephony_event_type;
145 BLUETOOTH_CALL_STATE_NONE,
146 BLUETOOTH_CALL_STATE_CONNECTED,
147 BLUETOOTH_CALL_STATE_HELD,
148 BLUETOOTH_CALL_STATE_DIALLING,
149 BLUETOOTH_CALL_STATE_ALERTING,
150 BLUETOOTH_CALL_STATE_INCOMING,
151 BLUETOOTH_CALL_STATE_WAITING,
152 BLUETOOTH_CALL_STATE_ERROR,
153 } bt_telephony_call_state_t;
156 unsigned int call_id;
157 bt_telephony_call_state_t call_status;
159 } bt_telephony_call_status_info_t;
162 * @brief The function bluetooth_telephony_init is initialize telephony calls.
164 * @param[in] cb Callback function
165 * @param[in] user_data Data sent by application, which will be
166 * returned in event handler.
167 * @return int Zero on Success or reason for error if any.
170 int bluetooth_telephony_init(bt_telephony_func_ptr cb, void *user_data);
173 * @brief The function bluetooth_telephony_deinit is deinitialize telephony calls.
175 * @return int Zero on Success or reason for error if any.
178 int bluetooth_telephony_deinit(void);
181 * @brief The function bluetooth_telephony_audio_open is to open SCO channel
183 * @return int Zero on Success or reason for error if any.
186 int bluetooth_telephony_audio_open(void);
189 * @brief The function bluetooth_telephony_audio_close is to close SCO channel.
190 * that the Volume on AG is changed.
192 * @return int Zero on Success or reason for error if any.
195 int bluetooth_telephony_audio_close(void);
198 * @brief The function bluetooth_telephony_call_remote_ringing is send
201 * @param[in] call_id Call Id.
202 * @return int Zero on Success or reason for error if any.
205 int bluetooth_telephony_call_remote_ringing(unsigned int call_id);
208 * @brief The function bluetooth_telephony_call_answered is called to
211 * @param[in] call_id Call Id.
212 * @param[in] bt_audio flag
213 * @return int Zero on Success or reason for error if any.
216 int bluetooth_telephony_call_answered(unsigned int call_id,
217 unsigned int bt_audio);
220 * @brief The function bluetooth_telephony_call_end to end call
222 * @param[in] call_id Call Id.
223 * @return int Zero on Success or reason for error if any.
226 int bluetooth_telephony_call_end(unsigned int call_id);
229 * @brief The function bluetooth_telephony_call_held to hold call
231 * @param[in] call_id Call Id.
232 * @return int Zero on Success or reason for error if any.
235 int bluetooth_telephony_call_held(unsigned int call_id);
238 * @brief The function bluetooth_telephony_call_retrieved to retrieve call
240 * @param[in] call_id Call Id.
241 * @return int Zero on Success or reason for error if any.
244 int bluetooth_telephony_call_retrieved(unsigned int call_id);
247 * @brief The function bluetooth_telephony_call_swapped to swap call
249 * @param[in] call_list Call info such as id and status.
250 * @param[in] call_count Call count.
251 * @return int Zero on Success or reason for error if any.
254 int bluetooth_telephony_call_swapped(void *call_list,
255 unsigned int call_count);
258 * @brief The function bluetooth_telephony_set_call_status to set call status
260 * @param[in] call_list Call info such as id and status.
261 * @param[in] call_count Call count.
262 * @return int Zero on Success or reason for error if any.
265 int bluetooth_telephony_set_call_status(void *call_list,
266 unsigned int call_count);
269 * @brief The function bluetooth_telephony_indicate_outgoing_call toindicate
272 * @param[in] ph_number Phone number of the outgoing call.
273 * @param[in] call_id Call ID.
274 * @param[in] bt_audio Flag.
275 * @return int Zero on Success or reason for error if any.
278 int bluetooth_telephony_indicate_outgoing_call(
279 const char *ph_number, unsigned int call_id,
280 unsigned int bt_audio);
283 * @brief The function bluetooth_telephony_indicate_incoming_call to indicate
286 * @param[in] call_info Call info such as id and status.
287 * @param[in] call_count Call count.
288 * @return int Zero on Success or reason for error if any.
291 int bluetooth_telephony_indicate_incoming_call(
292 const char *ph_number, unsigned int call_id);
295 * @brief The function bluetooth_telephony_is_sco_connected to check
296 * if SCO channel is connected.
298 * @return gboolean TRUE if headset playing else FALSE.
301 gboolean bluetooth_telephony_is_sco_connected(void);
304 * @brief The function bluetooth_telephony_is_nrec_enabled to check
305 * for noise reduction and echo cancelation(nrec) status
307 * @return int Zero on Success or reason for error if any.
310 int bluetooth_telephony_is_nrec_enabled(gboolean *status);
313 * @brief The function bluetooth_telephony_is_nrec_enabled to check
314 * for wide band speech status
316 * @return int Zero on Success or reason for error if any.
319 int bluetooth_telephony_is_wbs_mode(gboolean *status);
322 * @brief This function send XSAT vendor specific AT command
324 * @return int Zero on Success or reason for error if any.
326 int bluetooth_telephony_send_vendor_cmd(const char *cmd);
330 * @brief This function sends request to enable voice recognition feature
332 * @return int Zero on Success or reason for error if any.
334 int bluetooth_telephony_start_voice_recognition(void);
337 * @brief This function sends request to disable voice recognition feature
339 * @return int Zero on Success or reason for error if any.
341 int bluetooth_telephony_stop_voice_recognition(void);
345 * @brief The function bluetooth_telephony_get_headset_volume is called to get
346 * the changed Volume on AG.
348 * @param[out] speaker_gain Speaker gain.
349 * @return int Zero on Success or reason for error if any.
352 int bluetooth_telephony_get_headset_volume(unsigned int *speaker_gain);
355 * @brief The function bluetooth_telephony_set_speaker_gain is called to indicate
356 * that the Volume on AG is changed.
358 * @param[in] speaker_gain Speaker gain.
359 * @return int Zero on Success or reason for error if any.
362 int bluetooth_telephony_set_speaker_gain(unsigned short speaker_gain);
365 * @brief The function bluetooth_telephony_is_connected is called to get
366 * the connection state on AG.
368 * @param[in] ag_connnected Connection state.
369 * @return int Zero on Success or reason for error if any.
372 int bluetooth_telephony_is_connected(gboolean *ag_connected);
376 #endif /*__cplusplus*/
377 #endif/*_BLUETOOTH_TELEPHONY_API_H_*/