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_
29 #include <dbus/dbus-glib.h>
30 #include <dbus/dbus-glib-lowlevel.h>
35 #endif /*__cplusplus*/
37 typedef void (*bt_telephony_func_ptr)(int, void *, void *);
39 #define BLUETOOTH_TELEPHONY_ERROR_NONE ((int)0)
40 #define BLUETOOTH_TELEPHONY_ERROR_INTERNAL \
41 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x01)
42 #define BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM \
43 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x02)
44 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_INITIALIZED \
45 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x03)
46 #define BLUETOOTH_TELEPHONY_ERROR_NOT_INITIALIZED \
47 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x04)
48 #define BLUETOOTH_TELEPHONY_ERROR_AUDIO_NOT_CONNECTED \
49 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x05)
50 #define BLUETOOTH_TELEPHONY_ERROR_NOT_ENABLED \
51 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x06)
52 #define BLUETOOTH_TELEPHONY_ERROR_NOT_AVAILABLE \
53 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x07)
54 #define BLUETOOTH_TELEPHONY_ERROR_NOT_CONNECTED \
55 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x08)
56 #define BLUETOOTH_TELEPHONY_ERROR_BUSY \
57 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x09)
58 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_EXSIST \
59 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0A)
60 #define BLUETOOTH_TELEPHONY_ERROR_NO_MEMORY \
61 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0B)
62 #define BLUETOOTH_TELEPHONY_ERROR_I_O_ERROR \
63 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0C)
64 #define BLUETOOTH_TELEPHONY_ERROR_ALREADY_CONNECTED \
65 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0D)
66 #define BLUETOOTH_TELEPHONY_ERROR_OPERATION_NOT_AVAILABLE \
67 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0E)
68 #define BLUETOOTH_TELEPHONY_ERROR_PERMISSION_DENIED \
69 ((int)BLUETOOTH_TELEPHONY_ERROR_NONE - 0x0F)
71 #define BT_ADDRESS_STR_LEN 18
72 #define BT_ADAPTER_PATH_LEN 50
73 #define BT_AUDIO_CALL_PATH_LEN 50
79 } telephony_event_param_t;
83 } telephony_event_callid_t;
87 } telephony_event_dtmf_t;
90 BLUETOOTH_STATE_CONNECTED,
91 BLUETOOTH_STATE_PLAYING,
92 BLUETOOTH_STATE_DISCONNETED,
93 } bluetooth_headset_state_t;
96 BLUETOOTH_TELEPHONY_ERROR_INVALID_CHLD_INDEX,
97 BLUETOOTH_TELEPHONY_ERROR_BATTERY_STATUS,
98 BLUETOOTH_TELEPHONY_ERROR_SIGNAL_STATUS,
99 BLUETOOTH_TELEPHONY_ERROR_NOT_SUPPORTED,
100 BLUETOOTH_TELEPHONY_ERROR_APPLICATION,
101 BLUETOOTH_TELEPHONY_ERROR_INVALID_DTMF,
102 } bluetooth_telephony_error_t;
105 CSD_CALL_STATUS_IDLE,
106 CSD_CALL_STATUS_CREATE,
107 CSD_CALL_STATUS_COMING,
108 CSD_CALL_STATUS_PROCEEDING,
109 CSD_CALL_STATUS_MO_ALERTING,
110 CSD_CALL_STATUS_MT_ALERTING,
111 CSD_CALL_STATUS_WAITING,
112 CSD_CALL_STATUS_ANSWERED,
113 CSD_CALL_STATUS_ACTIVE,
114 CSD_CALL_STATUS_MO_RELEASE,
115 CSD_CALL_STATUS_MT_RELEASE,
116 CSD_CALL_STATUS_HOLD_INITIATED,
117 CSD_CALL_STATUS_HOLD,
118 CSD_CALL_STATUS_RETRIEVE_INITIATED,
119 CSD_CALL_STATUS_RECONNECT_PENDING,
120 CSD_CALL_STATUS_TERMINATED,
121 CSD_CALL_STATUS_SWAP_INITIATED,
122 } bt_telephony_call_status_t;
124 #define BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE (unsigned int)(0x00500)
127 BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL = BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE,
128 BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL,
129 BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL,
130 BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL,
131 BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL,
132 BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL,
133 BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL,
134 BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER,
135 BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF,
136 BLUETOOTH_EVENT_TELEPHONY_HFP_CONNECTED,
137 BLUETOOTH_EVENT_TELEPHONY_HFP_DISCONNECTED,
138 BLUETOOTH_EVENT_TELEPHONY_AUDIO_CONNECTED,
139 BLUETOOTH_EVENT_TELEPHONY_AUDIO_DISCONNECTED,
140 BLUETOOTH_EVENT_TELEPHONY_SET_SPEAKER_GAIN,
141 BLUETOOTH_EVENT_TELEPHONY_SET_MIC_GAIN,
142 BLUETOOTH_EVENT_TELEPHONY_NREC_CHANGED,
143 BLUETOOTH_EVENT_TELEPHONY_VENDOR_AT_CMD,
144 } bluetooth_telephony_event_type;
147 BLUETOOTH_CALL_STATE_NONE,
148 BLUETOOTH_CALL_STATE_CONNECTED,
149 BLUETOOTH_CALL_STATE_HELD,
150 BLUETOOTH_CALL_STATE_DIALLING,
151 BLUETOOTH_CALL_STATE_ALERTING,
152 BLUETOOTH_CALL_STATE_INCOMING,
153 BLUETOOTH_CALL_STATE_WAITING,
154 BLUETOOTH_CALL_STATE_ERROR,
155 } bt_telephony_call_state_t;
158 unsigned int call_id;
159 bt_telephony_call_state_t call_status;
161 } bt_telephony_call_status_info_t;
164 * @brief The function bluetooth_telephony_init is initialize telephony calls.
166 * @param[in] cb Callback function
167 * @param[in] user_data Data sent by application, which will be
168 * returned in event handler.
169 * @return int Zero on Success or reason for error if any.
172 int bluetooth_telephony_init(bt_telephony_func_ptr cb, void *user_data);
175 * @brief The function bluetooth_telephony_deinit is deinitialize telephony calls.
177 * @return int Zero on Success or reason for error if any.
180 int bluetooth_telephony_deinit(void);
183 * @brief The function bluetooth_telephony_audio_open is to open SCO channel
185 * @return int Zero on Success or reason for error if any.
188 int bluetooth_telephony_audio_open(void);
191 * @brief The function bluetooth_telephony_audio_close is to close SCO channel.
192 * that the Volume on AG is changed.
194 * @return int Zero on Success or reason for error if any.
197 int bluetooth_telephony_audio_close(void);
200 * @brief The function bluetooth_telephony_call_remote_ringing is send
203 * @param[in] call_id Call Id.
204 * @return int Zero on Success or reason for error if any.
207 int bluetooth_telephony_call_remote_ringing(unsigned int call_id);
210 * @brief The function bluetooth_telephony_call_answered is called to
213 * @param[in] call_id Call Id.
214 * @param[in] bt_audio flag
215 * @return int Zero on Success or reason for error if any.
218 int bluetooth_telephony_call_answered(unsigned int call_id,
219 unsigned int bt_audio);
222 * @brief The function bluetooth_telephony_call_end to end call
224 * @param[in] call_id Call Id.
225 * @return int Zero on Success or reason for error if any.
228 int bluetooth_telephony_call_end(unsigned int call_id);
231 * @brief The function bluetooth_telephony_call_held to hold call
233 * @param[in] call_id Call Id.
234 * @return int Zero on Success or reason for error if any.
237 int bluetooth_telephony_call_held(unsigned int call_id);
240 * @brief The function bluetooth_telephony_call_retrieved to retrieve call
242 * @param[in] call_id Call Id.
243 * @return int Zero on Success or reason for error if any.
246 int bluetooth_telephony_call_retrieved(unsigned int call_id);
249 * @brief The function bluetooth_telephony_call_swapped to swap call
251 * @param[in] call_list Call info such as id and status.
252 * @param[in] call_count Call count.
253 * @return int Zero on Success or reason for error if any.
256 int bluetooth_telephony_call_swapped(void *call_list,
257 unsigned int call_count);
260 * @brief The function bluetooth_telephony_set_call_status to set call status
262 * @param[in] call_list Call info such as id and status.
263 * @param[in] call_count Call count.
264 * @return int Zero on Success or reason for error if any.
267 int bluetooth_telephony_set_call_status(void *call_list,
268 unsigned int call_count);
271 * @brief The function bluetooth_telephony_indicate_outgoing_call toindicate
274 * @param[in] ph_number Phone number of the outgoing call.
275 * @param[in] call_id Call ID.
276 * @param[in] bt_audio Flag.
277 * @return int Zero on Success or reason for error if any.
280 int bluetooth_telephony_indicate_outgoing_call(
281 const char *ph_number, unsigned int call_id,
282 unsigned int bt_audio);
285 * @brief The function bluetooth_telephony_indicate_incoming_call to indicate
288 * @param[in] call_info Call info such as id and status.
289 * @param[in] call_count Call count.
290 * @return int Zero on Success or reason for error if any.
293 int bluetooth_telephony_indicate_incoming_call(
294 const char *ph_number, unsigned int call_id);
297 * @brief The function bluetooth_telephony_is_sco_connected to check
298 * if SCO channel is connected.
300 * @return gboolean TRUE if headset playing else FALSE.
303 gboolean bluetooth_telephony_is_sco_connected(void);
306 * @brief The function bluetooth_telephony_is_nrec_enabled to check
307 * for noise reduction and echo cancelation(nrec) status
309 * @return int Zero on Success or reason for error if any.
312 int bluetooth_telephony_is_nrec_enabled(gboolean *status);
315 * @brief The function bluetooth_telephony_is_nrec_enabled to check
316 * for wide band speech status
318 * @return int Zero on Success or reason for error if any.
321 int bluetooth_telephony_is_wbs_mode(gboolean *status);
324 * @brief This function send XSAT vendor specific AT command
326 * @return int Zero on Success or reason for error if any.
328 int bluetooth_telephony_send_vendor_cmd(const char *cmd);
332 * @brief This function sends request to enable voice recognition feature
334 * @return int Zero on Success or reason for error if any.
336 int bluetooth_telephony_start_voice_recognition(void);
339 * @brief This function sends request to disable voice recognition feature
341 * @return int Zero on Success or reason for error if any.
343 int bluetooth_telephony_stop_voice_recognition(void);
347 * @brief The function bluetooth_telephony_get_headset_volume is called to get
348 * the changed Volume on AG.
350 * @param[out] speaker_gain Speaker gain.
351 * @return int Zero on Success or reason for error if any.
354 int bluetooth_telephony_get_headset_volume(unsigned int *speaker_gain);
357 * @brief The function bluetooth_telephony_set_speaker_gain is called to indicate
358 * that the Volume on AG is changed.
360 * @param[in] speaker_gain Speaker gain.
361 * @return int Zero on Success or reason for error if any.
364 int bluetooth_telephony_set_speaker_gain(unsigned short speaker_gain);
367 * @brief The function bluetooth_telephony_is_connected is called to get
368 * the connection state on AG.
370 * @param[in] ag_connnected Connection state.
371 * @return int Zero on Success or reason for error if any.
374 int bluetooth_telephony_is_connected(gboolean *ag_connected);
378 #endif /*__cplusplus*/
379 #endif/*_BLUETOOTH_TELEPHONY_API_H_*/