Make TIZEN 2.0
[apps/home/call.git] / call-engine / core / include / vc-core-callagent.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 #ifndef __VC_CORE_CALL_AGENT_H_
18 #define __VC_CORE_CALL_AGENT_H_
19
20 #include <stdbool.h>
21 #include "vc-core-callmanager.h"
22 #ifdef _CPHS_DEFINED_
23 #include "status-interface.h"
24 #endif
25
26 /**< Maximum Telephony Event */
27 #define CALL_VC_TAPI_CALL_EVENT_MAX_NUM 33
28 #define CALL_VC_SIMATK_EVENT_MAX_NUM    3       /**< Maximum SIM ATK Event */
29 #define CALL_VC_TAPI_READY_EVENT_NUM    1       /**< Tapi Service Ready Event */
30 #define CALL_VC_TAPI_FACTORY_EVENT_NUM  1       /**< Tapi Service FACTORY Event */
31 #define CALL_VC_TAPI_SUBSCRIPTION_MAX           (CALL_VC_TAPI_CALL_EVENT_MAX_NUM+CALL_VC_TAPI_READY_EVENT_NUM+CALL_VC_SIMATK_EVENT_MAX_NUM+CALL_VC_TAPI_FACTORY_EVENT_NUM)
32
33 /**
34  * This enumeration provides CA STATEs
35  */
36 typedef enum {
37         CALL_VC_CA_STATE_NORMAL,                                                        /**< Normal state */
38         CALL_VC_CA_STATE_SPLIT_CALLBOX,                                         /**< Call split state */
39         CALL_VC_CA_STATE_WAIT_SPLIT,                                            /**< Waiting for call split state */
40         CALL_VC_CA_STATE_DROP_CALLBOX,                                          /**< Call drop state */
41         CALL_VC_CA_STATE_WAIT_DROP,                                                     /**< Waiting for drop state */
42 #ifdef SWAP_SUPPORT
43         CALL_VC_CA_STATE_WAIT_SWAP_HOLD_OR_ACTIVATE,            /**< Wait for swapping activce/hold call state */
44         CALL_VC_CA_STATE_WAIT_SWAP_HOLD,                                        /**< Wait for swapping held call state */
45         CALL_VC_CA_STATE_WAIT_SWAP_ACTIVE,                                      /**< Wait for swapping active call state */
46 #endif
47         CALL_VC_CA_STATE_WAIT_SWAP,                                                     /**< Wait for swap state */
48         CALL_VC_CA_STATE_WAIT_HOLD,                                                     /**< Wait for hold state */
49         CALL_VC_CA_STATE_WAIT_UNHOLD,                                           /**< Wait for unhold state */
50         CALL_VC_CA_STATE_WAIT_JOIN,                                                     /**< Wait for join state */
51         CALL_VC_CA_STATE_WAIT_TRANSFER_CNF,                                     /**< Wait for transfer confirmation state */
52         CALL_VC_CA_STATE_WAIT_TRANSFER_CALLEND,                         /**< Wait for transfer callend state */
53         CALL_VC_CA_STATE_WAIT_RELEASE_ALL_ACTIVECALL,           /**< Wait for release all active call state */
54         CALL_VC_CA_STATE_WAIT_RELEASE_ALL_HOLDCALL,                     /**< Wait for release all held call state */
55         CALL_VC_CA_STATE_SENDMSG_CALLBOX,                                       /**< Message send callbox active state */
56         CALL_VC_CA_STATE_VIEW_CONTACT_DETAIL_CALLBOX,           /**< Contact detail view state */
57         CALL_VC_CA_STATE_SAVE_TO_CONTACT_CALLBOX,                       /**< Save to contact state */
58         CALL_VC_CA_STATE_SS_WAIT_RELEASE_ALL_ACTIVECALL,        /**< Wait for release all active calls */
59         CALL_VC_CA_STATE_WAIT_RELEASE_ALL_CALLS,                        /**< Wait for release all calls */
60         CALL_VC_CA_STATE_WAIT_RELEASE_ALL_CALLS_TO_SETUP,       /**< Wait for release all calls to setup */
61         CALL_VC_CA_STATE_WAIT_RELEASE_ALL_CALLS_TO_SWITCH_TO_VIDEO_CALL,/**< Wait for release all calls to setup videocall */
62         CALL_VC_CA_STATE_MAX_NUM                                                        /**< Max value for the state */
63 } call_vc_ca_state_t;
64
65 /**
66  * This structure defines voicecall agent data
67  */
68 typedef struct _voicecall_engine_t {
69         TapiHandle *tapi_handle;
70         call_vc_ca_state_t callagent_state;                     /**< Call Agent State */
71         voicecall_inout_state_t io_state;               /**< Voicecall Engine IO State */
72         call_vc_manager_t call_manager;                 /**< Handle for the Call Manager */
73         TelSimCardType_t card_type;                             /**< SIM Card Type */
74
75         gboolean bdtmf_ring;                                    /**< dtmf ring? */
76
77         gboolean bis_no_sim;                                            /**< SIM not available , if TRUE */
78         gboolean bdownload_call;                                        /**< Automated call test after binary download , if TRUE */
79
80         /*No structure in TAPI  14Mar08 */
81         /*tapi_call_ccbs_info_t ccbs_info[CALL_VC_CCBS_NUMBER_MAX]; < call control for busy subscriber info */
82         int ccbs_index;                                                                                           /**< Index for  ccbs_info*/
83
84         int barring_ind_type;                                                                   /* barring ind type */
85         /*AOC*/
86         float aoc_ppm;                                                                                          /**< Price per unit value of currency meter */
87
88         /*CPHS Info*/
89 #ifdef _CPHS_DEFINED_
90         status_class_cphs_type cphs_status;                              /**< stores the cphs status information*/
91         gboolean bcphs_read_success;                                                            /**< Flag for CPHS read status*/
92 #endif
93
94         /*Subscription Information */
95         unsigned int subscription_id[CALL_VC_TAPI_SUBSCRIPTION_MAX];
96         int curr_tapi_path;
97
98         /*Client Information */
99         voicecall_cb client_callback;                                   /**<Callback fucntion to send event to client*/
100         void *puser_data;                                               /**<Stores the User data set during engine initialization*/
101
102 } call_vc_callagent_state_t;
103
104 /**
105  * This function intializes the call agent
106  *
107  * @return              Pointer to call agent state.
108  */
109 call_vc_callagent_state_t *_vc_core_ca_init_agent();
110
111 /**
112  * This function changes the in out state of the call agent
113  *
114  * @return              This function returns TRUE on success and FALSE on failure
115  * @param[in]           pAgent          Pointer to the call agent structure
116  * @param[in]           new_state               The new i/o state that should be set
117  * @see                 _vc_core_ca_change_agent_state
118  */
119 gboolean _vc_core_ca_change_inout_state(call_vc_callagent_state_t *pAgent, voicecall_inout_state_t new_state);
120
121 /**
122  * This function changes the in call agent state
123  *
124  * @return              This function returns TRUE on success and FALSE on failure
125  * @param[in]           pAgent          Pointer to the call agent structure
126  * @param[in]           new_state               The new call agent state that should be set
127  * @see                 _vc_core_ca_change_inout_state
128  */
129 gboolean _vc_core_ca_change_agent_state(call_vc_callagent_state_t *pAgent, call_vc_ca_state_t new_state);
130
131 /**
132  * This function finalizes the call agent
133  *
134  * @return              Returns void
135  * @param[in]           pcall_agent Pointer to the call agent structure
136  */
137 void _vc_core_ca_finish_agent(call_vc_callagent_state_t *pcall_agent);
138
139 /**
140  * This function checks if all the call members have terminated or not
141  *
142  * @return              Returns TRUE if no call members exist, FALSE otherwise
143  * @param[in]   pagent          Pointer to the call agent structure
144  */
145 gboolean _vc_core_ca_check_end(call_vc_callagent_state_t *pagent);
146
147 /**
148  * This function ends all the calls
149  *
150  * @return              Returns TRUE on success and FALSE on failure
151  * @param[in]   pagent  Handle to voicecall engine
152  */
153 gboolean _vc_core_ca_end_all_calls(call_vc_callagent_state_t *pagent);
154
155 /**
156  * This function ends all the active calls
157  *
158  * @return              Returns TRUE on success and FALSE on failure
159  * @param[in]   pagent  Handle to voicecall engine
160  */
161 gboolean _vc_core_ca_end_active_calls(call_vc_callagent_state_t *pagent);
162
163 /**
164  * This function ends all the held calls
165  *
166  * @return              Returns TRUE on success and FALSE on failure
167  * @param[in]   pagent        Handle to voicecall engine
168  */
169 gboolean _vc_core_ca_end_held_calls(call_vc_callagent_state_t *pagent);
170
171 /**
172  * This function sends the response to the SAT engine
173  *
174  * @return              This function returns TRUE on success and FALSE on failure
175  * @param[in]   pagent                          Pointer to the call agent structure
176  * @param[in]   sat_rqst_resp_type      sat rquest/response type used by the client
177  * @param[in]   sat_response_type       response to be sent to sat
178  */
179 gboolean _vc_core_ca_send_sat_response(call_vc_callagent_state_t *pagent, voicecall_engine_sat_rqst_resp_type sat_rqst_Resp_type, call_vc_sat_reponse_type_t sat_response_type);
180
181 /**
182  * This function intializes the callagent data
183  *
184  * @return              void
185  * @param[in]           pagent                                  Pointer to the call agent structure
186  */
187 void _vc_core_ca_init_data(call_vc_callagent_state_t *pagent);
188
189 /**
190  * This function sends response event to the registered client
191  *
192  * @return              This function returns TRUE on success and FALSE on failure
193  * @param[in]   pcall_agent     Pointer to the call agent structure
194  * @param[in]   event           response event type
195  * @param[in]   param1          param 1 to be passed to the client
196  * @param[in]   param2          param 2 to be passed to the client
197  * @param[in]   param3          param 3 to be passed to the client
198  */
199 gboolean _vc_core_ca_send_event_to_client(call_vc_callagent_state_t *pcall_agent, int event, int param1, int param2, void *param3);
200
201 /**
202  * This function checks whether outgoing call is possible
203  *
204  * @return              This function returns TRUE if outgoing call is possible or else FALSE
205  * @param[in]   pcall_agent                     Pointer to the call agent structure
206  * @param[in]   bemergency_number       TRUE - if outgoing call being made is emergency call or else FALSE
207  */
208 gboolean _vc_core_ca_is_mocall_possible(call_vc_callagent_state_t *pcall_agent, gboolean bemergency_number);
209
210 /**
211  * This function checks whether private call is possible or not
212  *
213  * @return              This function returns TRUE if private call is possible or else FALSE
214  * @param[in]   pcall_agent                     Pointer to the call agent structure
215  */
216 gboolean _vc_core_ca_is_private_call_possible(call_vc_callagent_state_t *pcall_agent);
217
218 /**
219  * This function checks whether call transfer is possible
220  *
221  * @return              This function returns TRUE if transfer is possible or else FALSE
222  * @param[in]   pcall_agent                     Pointer to the call agent structure
223  */
224 gboolean _vc_core_ca_is_transfer_call_possible(call_vc_callagent_state_t *pcall_agent);
225
226 /**
227  * This function checks whether conference call is possible
228  *
229  * @return              This function returns TRUE if transfer is possible or else FALSE
230  * @param[in]   pcall_agent                     Pointer to the call agent structure
231  */
232 gboolean _vc_core_ca_is_conf_call_possible(call_vc_callagent_state_t *pcall_agent);
233
234 /**
235  * This function clears the data of a connected call givenits call handle
236  *
237  * @return              Returns TRUE on success and FALSE on failure
238  * @param[in]   pcall_agent     Handle to voicecall engine
239  * @param[in]   call_handle     Call handle of the connected call to be cleared
240  */
241 gboolean _vc_core_ca_clear_connected_call(call_vc_callagent_state_t *pcall_agent, int call_handle);
242
243 #endif                          /* __VC_CORE_CALL_AGENT_H_ */