2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Sung Joon Won <sungjoon.won@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef __TIZEN_CALL_MANAGER_H__
20 #define __TIZEN_CALL_MANAGER_H__
23 * @file call_manager.h
24 * @brief This file contains Call Manager APIs and related enumerations.
34 * @file call_manager.h
35 * @brief This file contains the Call Manager API.
39 * @addtogroup CAPI_CALL_MANAGER_MODULE
44 * @brief The Call Manager API handle.
47 typedef struct __cm_client *cm_client_h;
50 // Below define will be removed when Call Manager error included in tizen_error.h during ACR
51 #ifndef TIZEN_ERROR_CALL_MANAGER
52 #define TIZEN_ERROR_CALL_MANAGER -0x00000000
56 * @brief Enumeration for Call Manager error.
60 CM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
61 CM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
62 CM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
63 CM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
64 CM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
65 CM_ERROR_NOT_REGISTERED = TIZEN_ERROR_CALL_MANAGER | 0x01, /**< Callback not registered */
66 CM_ERROR_ALREADY_REGISTERED = TIZEN_ERROR_CALL_MANAGER | 0x02, /**< Callback already registered */
67 CM_ERROR_OPERATION_FAILED = TIZEN_ERROR_CALL_MANAGER | 0x03, /**< Operation failed */
71 * @brief Enumeration for Call status.
75 CM_CALL_STATUS_IDLE, /**< Call is in idle state */
76 CM_CALL_STATUS_RINGING, /**< A new call arrived and is ringing or waiting */
77 CM_CALL_STATUS_OFFHOOK, /**< At least one call exist that is in dialing, alerting, active, on hold state */
82 * @brief Enumeration for Mute status.
86 CM_MUTE_STATUS_OFF, /**< Mute state is off */
87 CM_MUTE_STATUS_ON, /**<Mute state is on */
93 * @brief Called when the call status changes.
95 * @param[in] call_status The changed call status
96 * @param[in] call_num The call number with changed call status
97 * @param[in] user_data The user data passed from the callback registration function
98 * @pre You should register this callback using cm_set_call_status_cb().
99 * @see cm_set_call_status_cb()
100 * @see cm_unset_call_status_cb()
102 typedef void (*cm_call_status_cb) (cm_call_status_e call_status, const char *call_num, void *user_data);
106 * @brief Called when the mute status changes.
108 * @param[in] mute_status The changed mute status
109 * @param[in] user_data The user data passed from the callback registration function
110 * @pre You should register this callback using cm_set_mute_status_cb().
111 * @see cm_set_mute_status_cb()
112 * @see cm_unset_mute_status_cb()
114 typedef void (*cm_mute_status_cb) (cm_mute_status_e mute_status, void *user_data);
118 * @brief Acquires the handle to use the Call Manager API.
122 * @param[out] handle The handle to use the Call Manager API
124 * @return @c 0 on success,
125 * otherwise a negative error value
127 * @retval #CM_ERROR_NONE Successful
128 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
129 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
130 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
134 int cm_init (cm_client_h *handle);
137 * @brief Deinitializes the Call Manager handle.
141 * @param[in] handle The handle to be deinitialized
143 * @return @c 0 on success,
144 * otherwise a negative error value
146 * @retval #CM_ERROR_NONE Successful
147 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
148 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
149 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
153 int cm_deinit (cm_client_h handle);
156 * @brief Rejects the incoming call.
159 * @privlevel platform
162 * @param[in] handle The handle from cm_init()
164 * @return @c 0 on success,
165 * otherwise a negative error value
167 * @retval #CM_ERROR_NONE Successful
168 * @retval #CM_ERROR_INVALID_PARAMETER Out of memory
169 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
170 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
171 * @retval #CM_ERROR_OPERATION_FAILED Invalid parameter
174 int cm_reject_call(cm_client_h handle);
177 * @brief Stops incoming call alert ringtone.
180 * @privlevel platform
183 * @param[in] handle The handle from cm_init()
185 * @return @c 0 on success,
186 * otherwise a negative error value
188 * @retval #CM_ERROR_NONE Successful
189 * @retval #CM_ERROR_INVALID_PARAMETER Out of memory
190 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
191 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
192 * @retval #CM_ERROR_OPERATION_FAILED Invalid parameter
195 int cm_stop_alert(cm_client_h handle);
198 * @brief Gets the call status.
204 * @param[in] handle The handle from #cm_init()
205 * @param[out] call_status The status of the call (#cm_call_status_e)
207 * @return @c 0 on success,
208 * otherwise a negative error value
210 * @retval #CM_ERROR_NONE Successful
211 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
212 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
213 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
214 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
216 * @pre The handle should be obtained from #cm_init()
217 * @post The should be released by using #cm_deinit()
219 int cm_get_call_status (cm_client_h handle, cm_call_status_e *call_status);
222 * @brief Sets a callback function to be invoked when the call status changes.
228 * @param[in] handle The handle to use the Call Manager API
229 * @param[in] cb The callback to be invoked when the call status changes
230 * @param[in] user_data The user data passed to the callback function
232 * @return @c 0 on success,
233 * otherwise a negative error value
235 * @retval #CM_ERROR_NONE Successful
236 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
237 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
238 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
239 * @retval #CM_ERROR_ALREADY_REGISTERED Callback already registered
240 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
242 * @post cm_call_status_cb() will be invoked.
244 * @see cm_unset_call_status_cb()
246 int cm_set_call_status_cb (cm_client_h handle, cm_call_status_cb cb, void *user_data);
249 * @brief Unsets a callback function.
255 * @param[in] handle The handle to use the Call Manager API
257 * @return @c 0 on success,
258 * otherwise a negative error value
260 * @retval #CM_ERROR_NONE Successful
261 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
262 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
263 * @retval #CM_ERROR_NOT_SUPPORTED Not supported
264 * @retval #CM_ERROR_NOT_REGISTERED Callback not registered
265 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
267 * @see cm_set_call_status_cb()
269 int cm_unset_call_status_cb (cm_client_h handle);
272 * @brief Gets the mute status.
276 * @privilege %http://tizen.org/privilege/telephony
278 * @param[in] handle The handle from #cm_init()
279 * @param[out] mutel_status The status of the call (#cm_mute_status_e)
281 * @return @c 0 on success,
282 * otherwise a negative error value
284 * @retval #CM_ERROR_NONE Successful
285 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
286 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
287 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
289 * @pre The handle should be obtained from #cm_init()
290 * @post The should be released by using #cm_deinit()
292 int cm_get_mute_status (cm_client_h handle, cm_mute_status_e *mutel_status);
295 * @brief Sets a callback function to be invoked when the mute status changes.
299 * @privilege %http://tizen.org/privilege/telephony
301 * @param[in] handle The handle to use the Call Manager API
302 * @param[in] cb The callback to be invoked when the mute status changes
303 * @param[in] user_data The user data passed to the callback function
305 * @return @c 0 on success,
306 * otherwise a negative error value
308 * @retval #CM_ERROR_NONE Successful
309 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
310 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
311 * @retval #CM_ERROR_ALREADY_REGISTERED Callback already registered
312 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
314 * @post cm_mute_status_cb() will be invoked.
316 * @see cm_unset_mute_status_cb()
318 int cm_set_mute_status_cb (cm_client_h handle, cm_mute_status_cb cb, void *user_data);
321 * @brief Unsets a callback function.
325 * @privilege %http://tizen.org/privilege/telephony
327 * @param[in] handle The handle to use the Call Manager API
329 * @return @c 0 on success,
330 * otherwise a negative error value
332 * @retval #CM_ERROR_NONE Successful
333 * @retval #CM_ERROR_INVALID_PARAMETER Invalid parameter
334 * @retval #CM_ERROR_PERMISSION_DENIED Permission denied
335 * @retval #CM_ERROR_NOT_REGISTERED Callback not registered
336 * @retval #CM_ERROR_OPERATION_FAILED Operation failed
338 * @see cm_set_mute_status_cb()
340 int cm_unset_mute_status_cb (cm_client_h handle);
351 #endif /* __TIZEN_CALL_MANAGER_H__ */