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