Make TIZEN 2.0
[apps/home/call.git] / call-engine / include / voice-call-engine.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
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
7  *
8  * http://www.tizenopensource.org/license
9  *
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.
15  */
16
17
18 #ifndef _VOICE_CALL_ENGINE_H_
19 #define _VOICE_CALL_ENGINE_H_
20
21 #include <glib.h>
22 #include "vc-core-engine-types.h"
23
24 #define VCALL_SENSOR_NEAR       1
25 #define VCALL_SENSOR_FAR        2
26
27 /**
28  * Voicecall Engine API result values
29  */
30 typedef enum _vcall_engine_api_result_t {
31         VCALL_ENGINE_API_FAILED = -1,
32         VCALL_ENGINE_API_SUCCESS,
33
34         VCALL_ENGINE_API_ACTIVE_CALL_EXIST,
35         VCALL_ENGINE_API_ACTIVE_AND_HELD_CALL_EXIST,
36
37         VCALL_ENGINE_API_CALLNOTALLOWED,
38         VCALL_ENGINE_API_VOICE_CALL_IS_NOT_ALLOWED_DURING_VIDEO_CALL,
39         VCALL_ENGINE_API_UNAVAILABLE,
40         VCALL_ENGINE_API_CHANGEOFFLINEMODETOCALL,
41         VCALL_ENGINE_API_CALLING_EMERG_ONLY,
42         VCALL_ENGINE_API_FDNCALLONLY,
43         VCALL_ENGINE_API_CALLFAILED,
44         VCALL_ENGINE_API_CALLENDED,
45         VCALL_ENGINE_API_SOS_CALL_ONLY_IN_NO_SIM_MODE,
46         VCALL_ENGINE_API_PHONE_NOT_INITIALISED,
47         VCALL_ENGINE_API_CAUSE_WRONG_NUMBER,
48
49         VCALL_ENGINE_API_DTMFSENDING_FAIL,
50         VCALL_ENGINE_API_HOLD_FAILED,
51         VCALL_ENGINE_API_UNABLE_TO_RETRIEVE,
52         VCALL_ENGINE_API_SWAP_FAILED,
53         VCALL_ENGINE_API_SPLIT_FAILED,
54         VCALL_ENGINE_API_JOIN_FAILED,
55         VCALL_ENGINE_API_TRANSFER_FAILED,
56         VCALL_ENGINE_API_SWAP_NOT_SUPPORTED,
57         VCALL_ENGINE_API_HOLD_NOT_SUPPORTED,
58         VCALL_ENGINE_API_UNHOLD_NOT_SUPPORTED,
59         VCALL_ENGINE_API_JOIN_NOT_SUPPORTED,
60         VCALL_ENGINE_API_SPLIT_NOT_SUPPORTED,
61         VCALL_ENGINE_API_TRANSFER_NOT_SUPPORTED,
62         VCALL_ENGINE_API_INCOMPLETE,
63
64         VCALL_ENGINE_API_NOT_ENOUGH_MEMORY_FOR_RECORDING,
65         VCALL_ENGINE_API_NO_CONNECTED_CALL_FOR_RECORDING,
66
67         VCALL_ERROR_MAX
68 } vcall_engine_api_result_t;
69
70 /**
71  * This enum defines call answer types
72  */
73 typedef enum _vcall_engine_answer_type_t {
74         VCALL_ENGINE_ANSWER_HOLD_ACTIVE_AND_ACCEPT = 1,                 /**< Puts the active call on hold and accepts the call (Only CONNECTED will be sent to client) */
75         VCALL_ENGINE_ANSWER_RELEASE_ACTIVE_AND_ACCEPT,  /**< Releases the active call and accept the call (END and CONNECTED will be sent to Client) */
76         VCALL_ENGINE_ANSWER_RELEASE_HOLD_AND_ACCEPT,    /**< Releases the active call and accept the call (END and  CONNECTED will be sent to client) */
77         VCALL_ENGINE_ANSWER_RELEASE_ALL_AND_ACCEPT              /**< Releases the all calls and accept the call (END and  CONNECTED will be sent to client) */
78 } vcall_engine_answer_type_t;
79
80 /**
81  * This enum defines call release types
82  */
83 typedef enum _vcall_engine_release_type_t {
84         VCALL_ENGINE_RELEASE_ALL_ACTIVE_CALLS,          /**< To end all available active calls*/
85         VCALL_ENGINE_RELEASE_ALL_HELD_CALLS,            /**< To end all available held calls*/
86         VCALL_ENGINE_RELEASE_ALL_CALLS,                                 /**< To end all available calls(active,held,incoming/outgoing*/
87 } vcall_engine_release_type_t;
88
89 /**
90 * This enum defines the command type sent by recorder to the client view through update signal
91 */
92 typedef enum _vcall_engine_record_stop_type_t {
93         VCALL_ENGINE_RECORD_STOP_BY_NORMAL,                                             /**< BY_NORMAL*/
94         VCALL_ENGINE_RECORD_STOP_BY_MAX_SIZE,                                   /**< by MAX_SIZE*/
95         VCALL_ENGINE_RECORD_STOP_BY_NO_FREE_SPACE,              /**< BY_NO_FREE_SPACE*/
96         VCALL_ENGINE_RECORD_STOP_BY_TIME_LIMIT,                         /**< BY_TIME_LIMIT*/
97         VCALL_ENGINE_RECORD_STOP_ERROR,                                                         /**< ERROR*/
98 } vcall_engine_record_stop_type_t;
99
100 /**
101  * This enum defines call answer types
102  */
103 typedef enum _vcall_engine_vol_type_t {
104         VCALL_ENGINE_VOL_TYPE_RINGTONE,         /**< ringtone volume*/
105         VCALL_ENGINE_VOL_TYPE_VOICE,            /**< voice volume*/
106         VCALL_ENGINE_VOL_TYPE_HEADSET           /**< headset volume*/
107 } vcall_engine_vol_type_t;
108
109 /**
110 * This enumeration defines names of the on call audio status
111 */
112 typedef enum _vcall_engine_audio_type_t {
113         VCALL_ENGINE_AUDIO_NONE,                                /**< none*/
114         VCALL_ENGINE_AUDIO_SPEAKER,                     /**< System LoudSpeaker Audio */
115         VCALL_ENGINE_AUDIO_RECEIVER_EARJACK,            /**< System receiver or earjack Audio */
116         VCALL_ENGINE_AUDIO_HEADSET,                     /**< System Headset Audio */
117         VCALL_ENGINE_AUDIO_MAX,
118 } vcall_engine_audio_type_t;
119
120 /**
121 * This enumeration defines names of lcd control
122 */
123 typedef enum _vcall_engine_lcd_control_t {
124         VCALL_ENGINE_LCD_OFF,           /**< LCD Off*/
125         VCALL_ENGINE_LCD_ON,            /**< LCD On */
126         VCALL_ENGINE_LCD_ON_LOCK,               /**< LCD ON lock */
127         VCALL_ENGINE_LCD_ON_UNLOCK,             /**< LCD ON unlock */
128         VCALL_ENGINE_LCD_MAX,
129 } vcall_engine_lcd_control_t;
130
131 typedef enum {
132         VC_LCD_OFF = 1,
133         VC_LCD_ON,
134         VC_LCD_ON_LOCK,
135         VC_LCD_ON_UNLOCK,
136 } voicecall_lcd_control_t;
137
138 /**
139  * This struct provides a structure for call setup info data.
140  */
141 typedef struct _vcall_engine_setup_info_t {
142         int contact_index;
143         int storage_type;
144         int phone_type;
145         int bemergency;
146         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];
147         char call_name[VC_DISPLAY_NAME_LENGTH_MAX];
148         char call_file_path[VC_IMAGE_PATH_LENGTH_MAX];
149         char call_full_file_path[VC_IMAGE_PATH_LENGTH_MAX];
150 } vcall_engine_setup_info_t;
151
152 /**
153  * This struct provides a structure for sat setup call info data.
154  */
155 typedef struct _vcall_engine_sat_setup_call_info_t {
156         int command_id;                                                         /**<Proactive Command Number sent by USIM*/
157         int command_qualifier;  /**<call type*/
158         char disp_text[500 + 1];        /**<character data*/
159         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];;                                                     /**<call number*/
160         unsigned int duration;                                          /**<maximum repeat duration*/
161 } vcall_engine_sat_setup_call_info_t;
162
163 /**
164  * This struct provides a structure for call incoming info data.
165  */
166 typedef struct _vcall_engine_incoming_info_t {
167         int call_handle;
168         int call_type;
169         int cli_presentation_indicator;
170         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];
171         int calling_name_mode;
172         char calling_name[VC_PHONE_NAME_LENGTH_MAX];
173         char redirected_number[VC_PHONE_NUMBER_LENGTH_MAX];
174         char redirected_sub_address[VC_PHONE_SUBADDRESS_LENGTH_MAX];
175         int cli_cause;
176         int bfwded;
177         int active_line;
178 } vcall_engine_incoming_info_t;
179
180 /**< This is the prototype of the client callback function  */
181 typedef gboolean(*vcall_engine_app_cb) (int event, void *pdata, void *puser_data);
182
183 gboolean vcall_engine_send_event_to_client(int event, void *pdata);
184
185 /**
186  * This function initialize voice call engine.
187  *
188  * @return      int     API Result Code.
189  * @param[in]
190 */
191 int vcall_engine_init(vcall_engine_app_cb pcb_func, void *pusr_data);
192
193 /**
194  * This function processes mo nomal call.
195  *
196  * @return      int     API Result Code.
197  * @param[in]
198 */
199 int vcall_engine_process_normal_call(char *number, int ct_index, gboolean b_download_call);
200
201 /**
202  * This function processes mo emergency call.
203  *
204  * @return      int     API Result Code.
205  * @param[in]
206 */
207 int vcall_engine_process_emergency_call(char *number);
208
209 int vcall_engine_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info);
210
211 /**
212  * This function processes incoming call.
213  *
214  * @return      int     API Result Code.
215  * @param[in]
216 */
217 int vcall_engine_process_incoming_call(vcall_engine_incoming_info_t *incoming_call_info);
218
219 /**
220  * This function answers an incoming call
221  *
222  * @return      int     API Result Code.
223  * @param[in]           none
224 */
225 int vcall_engine_answer_call(void);
226
227 /**
228  * This function answers an incoming call  according to the given type
229  *
230  * @return      int     API Result Code.
231  * @param[in]           answer_type             answer type
232  */
233 int vcall_engine_answer_call_by_type(vcall_engine_answer_type_t answer_type);
234
235 /**
236  * This function cancel outgoing call
237  *
238  * @return      int     API Result Code.
239  * @param[in]           none
240  */
241 int vcall_engine_cancel_call(void);
242
243 /**
244  * This function reject incoming call
245  *
246  * @return      int     API Result Code.
247  * @param[in]           none
248  */
249 int vcall_engine_reject_call(void);
250
251 /**
252  * This function release a active or held call
253  *
254  * @return      int     API Result Code.
255  * @param[in]           none
256  */
257 int vcall_engine_release_call(void);
258
259 /**
260  * This function release a call by handle
261  *
262  * @return      int     API Result Code.
263  * @param[in]           int     call_handle
264  */
265 int vcall_engine_release_call_by_handle(int call_handle);
266
267 /**
268  * This function release calls by type
269  *
270  * @return      int     API Result Code.
271  * @param[in]           release_type release_type
272  */
273 int vcall_engine_release_call_by_type(vcall_engine_release_type_t release_type);
274
275 /**
276  * This function processes hold/retrive/swap calls.
277  *
278  * @return      int     API Result Code.
279  * @param[in]           none
280  */
281 int vcall_engine_process_hold_call(void);
282
283  /**
284  * This function processes in call SS code..
285  *
286  * @return      NONE
287  * @param[in]           none
288  */
289 void vcall_engine_process_incall_ss(char *number);
290
291 /**
292  * This function sets up a conference calls
293  *
294  * @return      int     API Result Code.
295  * @param[in]           none
296  */
297 int vcall_engine_join_call(void);
298
299 /**
300  * This function make a private call in conference calls.
301  *
302  * @return      int     API Result Code.
303  * @param[in]           int     call_handle
304  */
305 int vcall_engine_split_call(int call_handle);
306
307 /**
308  * This function transfers the call from active call to the held call
309  *
310  * @return      int     API Result Code.
311  * @param[in]           int     call_handle
312  */
313 int vcall_engine_transfer_call(void);
314
315 /**
316  * This function processed loud speaker.
317  *
318  * @return      int     API Result Code.
319  * @param[in]           int     bstatus
320  */
321 int vcall_engine_process_loudspeaker(int bstatus);
322
323 /**
324  * This function processed voice mute status.
325  *
326  * @return      int     API Result Code.
327  * @param[in]           int     bstatus
328  */
329 int vcall_engine_process_voice_mute(int bstatus);
330
331 /**
332  * This function gets the volume level
333  *
334  * @return      int     API Result Code.
335  * @param[in]           vcall_engine_vol_type_t vol_type
336  */
337 int vcall_engine_get_volume_level(vcall_engine_vol_type_t vol_type);
338
339 /**
340  * This function sets the volume level
341  *
342  * @return      int     API Result Code.
343  * @param[in]           vcall_engine_vol_type_t vol_type
344  * @param[in]           int vol_level
345  */
346 int vcall_engine_set_volume_level(vcall_engine_vol_type_t vol_type, int vol_level);
347
348 /**
349  * This function stop alert
350  *
351  * @return      int     API Result Code.
352  * @param[in]           none
353  */
354 int vcall_engine_stop_alert(void);
355
356 /**
357  * This function mute alert.
358  *
359  * @return      int     API Result Code.
360  * @param[in]           none
361  */
362 int vcall_engine_mute_alert(void);
363
364 /**
365  * This function process auto redial.
366  *
367  * @return      int     API Result Code.
368  * @param[in]           int bstatus
369  */
370 int vcall_engine_process_auto_redial(int bstatus);
371
372 /**
373  * This function process voice record.
374  *
375  * @return      int     API Result Code.
376  * @param[in]           int bstatus
377  */
378 int vcall_engine_process_voice_record(int bstatus);
379
380 /**
381  * This function send the DTMF number
382  *
383  * @return      int     API Result Code.
384  * @param[in]           char* dtmf_number
385  */
386 int vcall_engine_send_dtmf_number(char *dtmf_number);
387
388 /**
389  * This function processed sound path
390  *
391  * @return      int     API Result Code.
392  * @param[in]           int     sound_path
393  */
394 int vcall_engine_change_sound_path(vcall_engine_audio_type_t sound_path);
395
396 /**
397  * This function get sound path
398  *
399  * @return      int     API Result Code.
400  * @param[out]          int     sound_path
401  */
402 int vcall_engine_get_sound_path(int *sound_path);
403
404 int vcall_engine_set_to_default();
405
406 /**
407  * This function retrieves the core state instance
408  *
409  * @return      instance of the core state
410  * @param[in]           void
411  */
412 gpointer vcall_engine_get_core_state(void);
413
414 /**
415  * This function is interface to call-utility to perform string copy
416  *
417  * @return      instance of the core state
418  * @param[out]  pbuffer         Target Buffer
419  * @param[in]           buf_count       Size of Target Buffer
420  * @param[in]           pstring         Source String
421  */
422 gboolean vcall_engine_util_strcpy(char *pbuffer, int buf_count, const char *pstring);
423
424 /**
425  * This function returns the number of groups
426  *
427  * @param[in]           pcount          count of the groups
428  */
429 gboolean vcall_engine_get_group_count(int *pcount);
430
431 /**
432  * This function is interface to call-utility to perform string copy
433  *
434  * @return      instance of the core state
435  * @param[out]  pbuffer         Target Buffer
436  * @param[in]   time            time
437  */
438 char *vcall_engine_util_get_date_time(time_t time);
439
440 /**
441  * This function is force reset all engine status.
442  *
443  * @return      void
444  * @param[in] void
445  */
446 void vcall_engine_force_reset(void);
447
448 /**
449  * This function will process the dtmf send request from UI
450  * It is executed when wait(w/W/;) is finished while sending a dtmf string
451  *
452  * @return      void
453  * @param[in] void
454  */
455 void vcall_engine_send_dtmf(gboolean bsuccess);
456
457 /**
458  * This function processes emergency call for testing purpose.
459  *
460  * @return      int     API Result Code.
461  * @param[in]
462 */
463 int vcall_engine_process_emergency_call_test(char *number);
464
465 /**
466  * This function is interface to call-utility to check for ss string
467  *
468  * @return      TRUE or FALSE if success/failure
469  * @param[in]   call_number     pointer to the number
470  */
471 gboolean vcall_engine_check_incall_ss_string(char *call_number);
472
473 /**
474  * This function checks whether a given number is a SS string or not
475  *
476  * @return      TRUE or FALSE if success/failure
477  * @param[in]   call_number     pointer to the number
478  */
479 gboolean vcall_engine_check_ss_string(char *call_number);
480
481 /**
482  * This function controls the lcd state
483  *
484  * @return void
485  * @param[in]   lcd_state       state of the lcd control
486  */
487 void vcall_engine_device_control_lcd_state(voicecall_lcd_control_t lcd_state);
488
489 #endif /* _VOICE_CALL_ENGINE_H_ */