643f27b0839e0eede216d805c84b0775b1871c03
[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 call answer types
91  */
92 typedef enum _vcall_engine_vol_type_t {
93         VCALL_ENGINE_VOL_TYPE_RINGTONE,         /**< ringtone volume*/
94         VCALL_ENGINE_VOL_TYPE_VOICE,            /**< voice volume*/
95         VCALL_ENGINE_VOL_TYPE_HEADSET           /**< headset volume*/
96 } vcall_engine_vol_type_t;
97
98 /**
99 * This enumeration defines names of the on call audio status
100 */
101 typedef enum _vcall_engine_audio_type_t {
102         VCALL_ENGINE_AUDIO_NONE,                                /**< none*/
103         VCALL_ENGINE_AUDIO_SPEAKER,                     /**< System LoudSpeaker Audio */
104         VCALL_ENGINE_AUDIO_RECEIVER,            /**< System receiver Audio */
105         VCALL_ENGINE_AUDIO_HEADSET,                     /**< System Headset Audio */
106         VCALL_ENGINE_AUDIO_EARJACK,                     /**< System Earjack Audio */
107         VCALL_ENGINE_AUDIO_MAX,
108 } vcall_engine_audio_type_t;
109
110 /**
111 * This enumeration defines names of lcd control
112 */
113 typedef enum _vcall_engine_lcd_control_t {
114         VCALL_ENGINE_LCD_OFF,           /**< LCD Off*/
115         VCALL_ENGINE_LCD_ON,            /**< LCD On */
116         VCALL_ENGINE_LCD_ON_LOCK,               /**< LCD ON lock */
117         VCALL_ENGINE_LCD_ON_UNLOCK,             /**< LCD ON unlock */
118         VCALL_ENGINE_LCD_MAX,
119 } vcall_engine_lcd_control_t;
120
121 typedef enum {
122         VC_LCD_OFF = 1,
123         VC_LCD_ON,
124         VC_LCD_ON_LOCK,
125         VC_LCD_ON_UNLOCK,
126 } voicecall_lcd_control_t;
127
128 /** 
129  * This struct provides a structure for call setup info data.
130  */
131 typedef struct _vcall_engine_setup_info_t {
132         int contact_index;
133         int storage_type;
134         int phone_type;
135         int bemergency;
136         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];
137         char call_name[VC_DISPLAY_NAME_LENGTH_MAX];
138         char call_file_path[VC_IMAGE_PATH_LENGTH_MAX];
139         char call_full_file_path[VC_IMAGE_PATH_LENGTH_MAX];
140 } vcall_engine_setup_info_t;
141
142 /** 
143  * This struct provides a structure for sat setup call info data.
144  */
145 typedef struct _vcall_engine_sat_setup_call_info_t {
146         int command_id;                                                         /**<Proactive Command Number sent by USIM*/
147         int command_qualifier;  /**<call type*/
148         char disp_text[500 + 1];        /**<character data*/
149         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];;                                                     /**<call number*/
150         unsigned int duration;                                          /**<maximum repeat duration*/
151 } vcall_engine_sat_setup_call_info_t;
152
153 /** 
154  * This struct provides a structure for call incoming info data.
155  */
156 typedef struct _vcall_engine_incoming_info_t {
157         int call_handle;
158         int call_type;
159         int cli_presentation_indicator;
160         char call_num[VC_PHONE_NUMBER_LENGTH_MAX];
161         int calling_name_mode;
162         char calling_name[VC_PHONE_NAME_LENGTH_MAX];
163         char redirected_number[VC_PHONE_NUMBER_LENGTH_MAX];
164         char redirected_sub_address[VC_PHONE_SUBADDRESS_LENGTH_MAX];
165         int cli_cause;
166         int bfwded;
167         int active_line;
168 } vcall_engine_incoming_info_t;
169
170 /**< This is the prototype of the client callback function  */
171 typedef gboolean(*vcall_engine_app_cb) (int event, void *pdata, void *puser_data);
172
173 gboolean vcall_engine_send_event_to_client(int event, void *pdata);
174
175 /**
176  * This function initialize voice call engine.
177  *
178  * @return      int     API Result Code.
179  * @param[in]           
180 */
181 int vcall_engine_init(vcall_engine_app_cb pcb_func, void *pusr_data);
182
183 /**
184  * This function processes mo nomal call.
185  *
186  * @return      int     API Result Code.
187  * @param[in]           
188 */
189 int vcall_engine_process_normal_call(char *number, int ct_index, gboolean b_download_call);
190
191 /**
192  * This function processes mo emergency call.
193  *
194  * @return      int     API Result Code.
195  * @param[in]           
196 */
197 int vcall_engine_process_emergency_call(char *number);
198
199 int vcall_engine_process_sat_setup_call(vcall_engine_sat_setup_call_info_t *sat_setup_call_info);
200
201 /**
202  * This function processes incoming call.
203  *
204  * @return      int     API Result Code.
205  * @param[in]           
206 */
207 int vcall_engine_process_incoming_call(vcall_engine_incoming_info_t *incoming_call_info);
208
209 /**
210  * This function answers an incoming call
211  *
212  * @return      int     API Result Code.
213  * @param[in]           none
214 */
215 int vcall_engine_answer_call(void);
216
217 /**
218  * This function answers an incoming call  according to the given type
219  *
220  * @return      int     API Result Code.
221  * @param[in]           answer_type             answer type
222  */
223 int vcall_engine_answer_call_by_type(vcall_engine_answer_type_t answer_type);
224
225 /**
226  * This function cancel outgoing call
227  *
228  * @return      int     API Result Code.
229  * @param[in]           none
230  */
231 int vcall_engine_cancel_call(void);
232
233 /**
234  * This function reject incoming call
235  *
236  * @return      int     API Result Code.
237  * @param[in]           none
238  */
239 int vcall_engine_reject_call(void);
240
241 /**
242  * This function release a active or held call
243  *
244  * @return      int     API Result Code.
245  * @param[in]           none
246  */
247 int vcall_engine_release_call(void);
248
249 /**
250  * This function release a call by handle
251  *
252  * @return      int     API Result Code.
253  * @param[in]           int     call_handle
254  */
255 int vcall_engine_release_call_by_handle(int call_handle);
256
257 /**
258  * This function release calls by type
259  *
260  * @return      int     API Result Code.
261  * @param[in]           release_type release_type
262  */
263 int vcall_engine_release_call_by_type(vcall_engine_release_type_t release_type);
264
265 /**
266  * This function processes hold/retrive/swap calls.
267  *
268  * @return      int     API Result Code.
269  * @param[in]           none
270  */
271 int vcall_engine_process_hold_call(void);
272
273  /**
274  * This function processes in call SS code..
275  *
276  * @return      NONE
277  * @param[in]           none
278  */
279 void vcall_engine_process_incall_ss(char *number);
280
281 /**
282  * This function sets up a conference calls
283  *
284  * @return      int     API Result Code.
285  * @param[in]           none
286  */
287 int vcall_engine_join_call(void);
288
289 /**
290  * This function make a private call in conference calls.
291  *
292  * @return      int     API Result Code.
293  * @param[in]           int     call_handle
294  */
295 int vcall_engine_split_call(int call_handle);
296
297 /**
298  * This function transfers the call from active call to the held call
299  *
300  * @return      int     API Result Code.
301  * @param[in]           int     call_handle
302  */
303 int vcall_engine_transfer_call(void);
304
305 /**
306  * This function processed loud speaker.
307  *
308  * @return      int     API Result Code.
309  * @param[in]           int     bstatus
310  */
311 int vcall_engine_process_loudspeaker(int bstatus);
312
313 /**
314  * This function processed voice mute status.
315  *
316  * @return      int     API Result Code.
317  * @param[in]           int     bstatus
318  */
319 int vcall_engine_process_voice_mute(int bstatus);
320
321 /**
322  * This function gets the volume level
323  *
324  * @return      int     API Result Code.
325  * @param[in]           vcall_engine_vol_type_t vol_type
326  */
327 int vcall_engine_get_volume_level(vcall_engine_vol_type_t vol_type);
328
329 /**
330  * This function sets the volume level
331  *
332  * @return      int     API Result Code.
333  * @param[in]           vcall_engine_vol_type_t vol_type
334  * @param[in]           int vol_level
335  */
336 int vcall_engine_set_volume_level(vcall_engine_vol_type_t vol_type, int vol_level);
337
338 /**
339  * This function stop alert
340  *
341  * @return      int     API Result Code.
342  * @param[in]           none
343  */
344 int vcall_engine_stop_alert(void);
345
346 /**
347  * This function mute alert.
348  *
349  * @return      int     API Result Code.
350  * @param[in]           none
351  */
352 int vcall_engine_mute_alert(void);
353
354 /**
355  * This function process auto redial.
356  *
357  * @return      int     API Result Code.
358  * @param[in]           int bstatus
359  */
360 int vcall_engine_process_auto_redial(int bstatus);
361
362 /**
363  * This function process voice record.
364  *
365  * @return      int     API Result Code.
366  * @param[in]           int bstatus
367  */
368 int vcall_engine_process_voice_record(int bstatus);
369
370 /**
371  * This function send the DTMF number
372  *
373  * @return      int     API Result Code.
374  * @param[in]           char* dtmf_number
375  */
376 int vcall_engine_send_dtmf_number(char *dtmf_number);
377
378 /**
379  * This function processed sound path
380  *
381  * @return      int     API Result Code.
382  * @param[in]           int     sound_path
383  */
384 int vcall_engine_change_sound_path(vcall_engine_audio_type_t sound_path);
385
386 /**
387  * This function get sound path
388  *
389  * @return      int     API Result Code.
390  * @param[out]          int     sound_path
391  */
392 int vcall_engine_get_sound_path(int *sound_path);
393
394 int vcall_engine_set_to_default();
395
396 /**
397  * This function retrieves the core state instance
398  *
399  * @return      instance of the core state
400  * @param[in]           void
401  */
402 gpointer vcall_engine_get_core_state(void);
403
404 /**
405  * This function is interface to call-utility to perform string copy
406  *
407  * @return      instance of the core state
408  * @param[out]  pbuffer         Target Buffer
409  * @param[in]           buf_count       Size of Target Buffer
410  * @param[in]           pstring         Source String
411  */
412 gboolean vcall_engine_util_strcpy(char *pbuffer, int buf_count, const char *pstring);
413
414 /**
415  * This function returns the number of groups
416  *
417  * @param[in]           pcount          count of the groups
418  */
419 gboolean vcall_engine_get_group_count(int *pcount);
420
421 /**
422  * This function is interface to call-utility to perform string copy
423  *
424  * @return      instance of the core state
425  * @param[out]  pbuffer         Target Buffer
426  * @param[in]   time            time
427  */
428 char *vcall_engine_util_get_date_time(time_t time);
429
430 /**
431  * This function is force reset all engine status.
432  *
433  * @return      void
434  * @param[in] void
435  */
436 void vcall_engine_force_reset(void);
437 #endif                          /* _VOICE_CALL_ENGINE_H_ */