2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 __VC_CORE_ENGINE_H_
19 #define __VC_CORE_ENGINE_H_
21 #include "vc-core-engine-types.h"
22 #include "vc-core-error.h"
23 #include "vc-core-engine-group.h"
24 #include "vc-core-engine-status.h"
26 #include <tapi_common.h>
28 /*Voicecall Engine Exposed API's */
30 void _vc_core_engine_handle_sat_events_cb(void *sat_setup_call_data, void *userdata);
32 void _vc_core_engine_handle_incoming_tapi_events(void *mt_data, void *userdata);
35 * This function initializes the voicecall engine
37 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
38 * @param[out] pcall_agent_out Pointer to the address of call agent
39 * @param[in] pcallback_func Call back function
40 * @param[in] puser_data Data set by user
41 * @remarks pcall_agent_out and pcallback_func cannot be NULL.
43 voicecall_error_t _vc_core_engine_init(voicecall_engine_t **pcall_agent_out, voicecall_cb pcallback_func, void *puser_data);
46 * This function prepares the call setup info structure for making call
48 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
49 * @param[in] pvoicecall_agent Handle to voicecall engine
50 * @param[in] psetup_call_info Pointer to the call setup info structure.
51 * @remarks pvoicecall_agent and psetup_call_info cannot be NULL
52 * Only on successfull completion of this API, _vc_core_engine_make_call can be made
53 * @see See following API's also
54 * -_vc_core_engine_make_call
55 * -voicecall_clear_prepared_call
57 voicecall_error_t _vc_core_engine_prepare_call(voicecall_engine_t *pvoicecall_agent, voicecall_setup_info_t *psetup_call_info);
60 * This function establishes an outgoing call with the details prepared using _vc_core_engine_prepare_call
62 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
63 * @param[in] pvoicecall_agent Handle to voicecall engine
64 * @param[in] mo_call_index Index of the prepare mo call
65 * @param[out] pcall_handle Handle of the MO Call Made
66 * @remarks pvoicecall_agent and pcall_handle cannot be NULL
67 * @see _vc_core_engine_end_call
69 voicecall_error_t _vc_core_engine_make_call(voicecall_engine_t *pvoicecall_agent, int mo_call_index, int *pcall_handle);
72 * This function answers a call according to the given answer type
74 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
75 * @param[in] pvoicecall_agent Handle to voicecall engine
76 * @param[in] answer_type The answer type to be used
77 * @remarks pvoicecall_agent and pcall_handle cannot be NULL
78 * @see _vc_core_engine_reject_call
80 voicecall_error_t _vc_core_engine_answer_call(voicecall_engine_t *pvoicecall_agent, voicecall_answer_type_t answer_type);
83 * This function rejects the incoming call if any
85 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
86 * @param[in] pvoicecall_agent Handle to voicecall engine
87 * @param[in] budub User Determined User Busy - TRUE, Else - FALSE
88 * @exception In case of exceptions return value contains appropriate error code.
89 * @remarks pvoicecall_agent cannot be NULL
90 * @see _vc_core_engine_answer_call
92 voicecall_error_t _vc_core_engine_reject_call(voicecall_engine_t *pvoicecall_agent, gboolean budub);
95 * This function ends the call according to the given end call type
97 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
98 * @param[in] pvoicecall_agent Handle to voicecall engine
99 * @param[in] end_call_type End Call Type
100 * @remarks pvoicecall_agent cannot be NULL
101 * @see See also following functions
102 * - _vc_core_engine_make_call
103 * - _vc_core_engine_end_call_byhandle
104 * - _vc_core_engine_end_call_bycallId
107 voicecall_error_t _vc_core_engine_end_call(voicecall_engine_t *pvoicecall_agent, _vc_core_engine_end_call_type_t end_call_type);
110 * This function ends only the connected call corresponding to the given call handle
112 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
113 * @param[in] pvoicecall_agent Handle to voicecall engine
114 * @param[in] call_handle Call handle of the call to be ended
115 * @remarks pvoicecall_agent cannot be NULL
116 * @see See also following functions
117 * - _vc_core_engine_make_call
118 * - _vc_core_engine_end_call
119 * - _vc_core_engine_end_call_bycallId
121 voicecall_error_t _vc_core_engine_end_call_byhandle(voicecall_engine_t *pvoicecall_agent, int call_handle);
124 * This function ends a call corresponding to the given call ID
126 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
127 * @param[in] pvoicecall_agent Handle to voicecall engine
128 * @param[in] call_id call id of the call to be ended
129 * @remarks pvoicecall_agent cannot be NULL
130 * @see See also following functions
131 * - _vc_core_engine_make_call
132 * - _vc_core_engine_end_call
133 * - _vc_core_engine_end_call_byhandle
135 voicecall_error_t _vc_core_engine_end_call_bycallId(voicecall_engine_t *pvoicecall_agent, int call_id);
138 * This function puts the active call if any on hold
140 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
141 * @param[in] pvoicecall_agent Handle to voicecall engine
142 * @remarks pvoicecall_agent cannot be NULL
143 * @see voicecall_retreive_call
145 voicecall_error_t _vc_core_engine_hold_call(voicecall_engine_t *pvoicecall_agent);
148 * This function retrieves/activates the held call
150 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
151 * @param[in] pvoicecall_agent Handle to voicecall engine
152 * @remarks pvoicecall_agent cannot be NULL
153 * @see _vc_core_engine_hold_call
155 voicecall_error_t _vc_core_engine_retrieve_call(voicecall_engine_t *pvoicecall_agent);
158 * This function swaps the active and held calls if any available
160 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
161 * @param[in] pvoicecall_agent Handle to voicecall engine
162 * @remarks pvoicecall_agent cannot be NULL
163 * @see See also the following APIs
164 * - _vc_core_engine_hold_call
165 * - _vc_core_engine_retrieve_call
168 voicecall_error_t _vc_core_engine_swap_calls(voicecall_engine_t *pvoicecall_agent);
171 * This function does the explicit call transfer
173 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
174 * @param[in] pvoicecall_agent Handle to voicecall engine
175 * @remarks pvoicecall_agent cannot be NULL
177 voicecall_error_t _vc_core_engine_transfer_calls(voicecall_engine_t *pvoicecall_agent);
180 * This function sets up a conference beween the currently available active and held calls
182 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
183 * @param[in] pvoicecall_agent Handle to voicecall engine
184 * @remarks pvoicecall_agent cannot be NULL
185 * @see See also the following APIs
186 * - _vc_core_engine_private_call
187 * - _vc_core_engine_private_call_by_callid
190 voicecall_error_t _vc_core_engine_setup_conference(voicecall_engine_t *pvoicecall_agent);
193 * This function makes a private call to the given call member from the currently available active conference call
195 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
196 * @param[in] pvoicecall_agent Handle to voicecall engine
197 * @param[in] call_handle call handle of the call to be made private
198 * @remarks pvoicecall_agent cannot be NULL
199 * @see See also the following APIs
200 * - _vc_core_engine_setup_conference
201 * - _vc_core_engine_private_call_by_callid
204 voicecall_error_t _vc_core_engine_private_call(voicecall_engine_t *pvoicecall_agent, int call_handle);
207 * This function makes a private call to the call member corressponding to the given call id.
209 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
210 * @param[in] pvoicecall_agent Handle to voicecall engine
211 * @param[in] call_id Call ID of the call to be made private
212 * @remarks pvoicecall_agent cannot be NULL
213 * @see See also the following APIs
214 * - _vc_core_engine_setup_conference
215 * - _vc_core_engine_private_call
218 voicecall_error_t _vc_core_engine_private_call_by_callid(voicecall_engine_t *pvoicecall_agent, int call_id);
221 * This function sends the given dtmf digits
223 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
224 * @param[in] pvoicecall_agent Handle to voicecall engine
225 * @param[in] pdtmf_string dtmf digits to be sent
226 * @remarks pvoicecall_agent and pdtmf_string cannot be NULL
228 voicecall_error_t _vc_core_engine_send_dtmf(voicecall_engine_t *pvoicecall_agent, char *pdtmf_string);
231 * This function clears the data of the given call type.
233 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
234 * @param[in] pvoicecall_agent Handle to voicecall engine
235 * @param[in] call_type call type
236 * @param[in] call_handle Call handle of the connected call to be cleared
237 * @remarks This will clear the call data only when the call data are currently not being used
238 * i,e) the data will be cleared only if the corresponding call is ended or the call data is not used at all.
239 * call_handle argument is required only in case of connected call, Engine ignores call_handle for other
242 voicecall_error_t _vc_core_engine_finalize_call(voicecall_engine_t *pvoicecall_agent, voicecall_call_type_t call_type, int call_handle);
245 * This function changes the inout state of the engine to the given state
247 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
248 * @param[in] pvoicecall_agent Handle to voicecall engine
249 * @param[in] io_state Inout state to be set
250 * @remarks pvoicecall_agent cannot be NULL
251 * @see _vc_core_engine_status_get_engine_iostate
253 voicecall_error_t _vc_core_engine_change_engine_iostate(voicecall_engine_t *pvoicecall_agent, int io_state);
256 * This function extracts the call number from the given number
258 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
259 * @param[in] source_tel_number source number
260 * @param[out] phone_number target number
261 * @param[in] buf_size target number buffer size
263 voicecall_error_t _vc_core_engine_extract_phone_number(const char *source_tel_number, char *phone_number, const int buf_size);
266 * This function finalizes the voiecall engine and removes all allocated resources
269 * @param[in] pvoicecall_agent Handle to Voicecall Engine
270 * @remarks pvoicecall_agent cannot be NULL
272 void _vc_core_engine_engine_finish(voicecall_engine_t *pvoicecall_agent);
275 * This function changes the voice audio path
277 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
278 * @param[in] pvoicecall_agent Handle to Voicecall Engine
279 * @param[in] audio_path audio path to be changed
280 * @param[in] bextra_volume TRUE - extra volume on, FALSE - extra volume off
281 * @remarks pvoicecall_agent cannot be NULL
283 voicecall_error_t _vc_core_engine_change_audio_path(voicecall_engine_t *pvoicecall_agent, voicecall_audio_path_t audio_path, gboolean bextra_volume);
286 * This function sets the voice call audio volume for the given audio path type
288 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
289 * @param[in] pvoicecall_agent Handle to Voicecall Engine
290 * @param[in] audio_path_type audio path for the volume to be set
291 * @param[in] vol_level volume level
292 * @remarks pvoicecall_agent cannot be NULL
294 voicecall_error_t _vc_core_engine_set_audio_volume(voicecall_engine_t *pvoicecall_agent, voicecall_audio_path_t audio_path_type, voicecall_audio_volume_t vol_level);
297 * This function sets the modem mute status
299 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
300 * @param[in] pvoicecall_agent Handle to Voicecall Engine
301 * @param[in] bmute_audio TRUE - mure audio, FALSE - unmute audio
302 * @remarks pvoicecall_agent cannot be NULL
304 voicecall_error_t _vc_core_engine_set_audio_mute(voicecall_engine_t *pvoicecall_agent, gboolean bmute_audio);
307 * This function retreives the voice call audio volume for the given audio path type
309 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
310 * @param[in] pvoicecall_agent Handle to Voicecall Engine
311 * @param[in] audio_path_type audio path for the volume to be retreived
312 * @remarks pvoicecall_agent cannot be NULL
314 voicecall_error_t _vc_core_engine_get_audio_volume(voicecall_engine_t *pvoicecall_agent, voicecall_audio_path_t audio_path_type);
319 * This function requests SAT Engine to setup SIM services Menu
321 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
322 * @param[in] pvoicecall_agent Handle to Voicecall Engine
323 * @remarks Voicecall Engine only requests the SAT engine to display the menu.
325 voicecall_error_t voicecall_request_sat_menu(voicecall_engine_t *pvoicecall_agent);
328 * This function retreives the SIM Menu Title from the SAT Engine
330 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
331 * @param[in] pvoicecall_agent Handle to Voicecall Engine
332 * @param[out] title contains the sat menu title on sucess
334 voicecall_error_t voicecall_request_sat_menu_title(voicecall_engine_t *pvoicecall_agent, char *title);
338 * This function prepares the engine for the redial call. It preserves the previsouly made call object to be used for the next make call
340 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
341 * @param[in] pvoicecall_agent Handle to Voicecall Engine
342 * @param[in] call_handle call handle
343 * @remarks If this API is used, _vc_core_engine_prepare_call is not reqired for making the call again. The last prepared call details will
344 * be used for the redialling. Application has to just use _vc_core_engine_make_call API to redial the call
346 voicecall_error_t _vc_core_engine_prepare_redial(voicecall_engine_t *pvoicecall_agent, int call_handle);
350 * This function checks whether SAT redial duration is valid
352 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
353 * @param[in] pvoicecall_agent Handle to Voicecall Engine
354 * @param[out] bredial_duration Contains TRUE if SAT redial duration is enabled, FALSE otherwise
355 * @remarks pvoicecall_agent and bredial_duration cannot be NULL
357 voicecall_error_t voicecall_get_sat_redial_duration_status(voicecall_engine_t *pvoicecall_agent, gboolean *bredial_duration);
360 * This function sets the current duration and retireives the modified remaining SAT redial duration
362 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
363 * @param[in] pvoicecall_agent Handle to Voicecall Engine
364 * @param[out] remaining_duration remaining sat duration
365 * @remarks pvoicecall_agent and remaining_duration cannot be NULL
367 voicecall_error_t voicecall_get_set_sat_remaining_duration(voicecall_engine_t *pvoicecall_agent, long *remaining_duration);
370 voicecall_error_t _vc_core_engine_get_sat_dtmf_hidden_mode(voicecall_engine_t *pvoicecall_agent, gboolean *bhidden_mode);
373 * This function sends response to sat based on the given sat response type
375 * @return ERROR_VOICECALL_NONE on success or return value contains appropriate error code on failure
376 * @param[in] pvoicecall_agent Handle to voicecall engine
377 * @param[in] sat_rqst_resp_type sat rqst/response type sent by client
378 * @param[in] sat_response_type sat response type to be sent to SAT
380 voicecall_error_t _vc_core_engine_send_sat_response(voicecall_engine_t *pvoicecall_agent, voicecall_engine_sat_rqst_resp_type sat_rqst_resp_type, call_vc_sat_reponse_type_t sat_response_type);
382 voicecall_error_t _vc_core_engine_set_to_default_values(voicecall_engine_t *pvoicecall_agent);
384 /* Tapi response call back */
385 void _vc_core_engine_dial_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
386 void _vc_core_engine_answer_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
387 void _vc_core_engine_end_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
388 void _vc_core_engine_hold_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
389 void _vc_core_engine_active_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
390 void _vc_core_engine_swap_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
391 void _vc_core_engine_join_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
392 void _vc_core_engine_split_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
393 void _vc_core_engine_transfer_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
394 void _vc_core_engine_dtmf_call_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
395 void _vc_core_engine_set_volume_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
396 void _vc_core_engine_get_volume_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
397 void _vc_core_engine_set_sound_path_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
398 void _vc_core_engine_set_mute_status_resp_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
399 void _vc_core_engine_get_aoc_info_cb(TapiHandle *handle, int result, void *tapi_data, void *user_data);
400 /* Tapi response call back end */
402 #endif /* __VC_CORE_ENGINE_H_ */