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_CALL_MANAGER_H_
19 #define __VC_CORE_CALL_MANAGER_H_
21 #include "vc-core-util.h"
22 #include "vc-core-engine-types.h"
24 #ifdef CALLDETAILS_DUMP
25 #define CALL_VC_DUMP_CALLDETAILS(call_manager) _vc_core_cm_test_dump(call_manager)
27 #define CALL_VC_DUMP_CALLDETAILS(call_manager)
31 * This enumeration defines the Call Group
33 typedef enum __call_vc_group_t {
36 CALL_VC_CALL_GROUP_MAX
40 * This enumeration has types of sat call control
43 CALL_VC_SAT_CC_NONE, /**< No SAT call control */
44 CALL_VC_SAT_CC_ALLOWED, /**< SAT call control Allowed */
45 CALL_VC_SAT_CC_NOT_ALLOWED, /**< SAT call control Not Allowed */
46 CALL_VC_SAT_CC_ALLOWED_WITH_MODIFIED /**< SAT call control allowed with modification */
47 } call_vc_callcontrol_type_t;
50 * This structure is used to handle the call group information
53 int num; /**< The number of members in the group */
54 int callobject_index[VC_MAX_CALL_GROUP_MEMBER]; /**< Index to the call object for each member */
55 call_vc_groupstate_t state; /**< State of the group */
56 } call_vc_groupinfo_t;
59 * This structure is used to handle SAT setup information
62 TelSatSetupCallIndCallData_t satengine_setupcall_data; /**< Sat call setup proactive command*/
63 TelSatCallCtrlIndData_t satengine_callctrl_data; /**< Sat call control confirm data*/
64 TelSatSendDtmfIndDtmfData_t satengine_dtmf_data; /**< Sat send dtmf data*/
65 int satengine_event_type; /**< Event type of Sat engine */
66 gboolean redial; /**< Redial yes? or No? */
67 TelCallCause_t tapi_cause; /**< Tapi Success / Error Cause */
68 call_vc_handle call_handle; /**< Tapi call handle */
69 gboolean bduration; /**< Duration */
70 unsigned long remaining_duration; /**< Remaining duration */
71 /*guchar sat_rgb_data[64*64];*/
72 guchar *psat_rgb_data;
73 } call_vc_satsetup_info_t;
76 * This structure is used to handle call setup information
79 int mocall_index; /**< Index for originated call */
80 gboolean no_service_state; /**< No service? */
81 call_vc_callcontrol_type_t call_control_type; /**< SAT call control type */
82 char modified_number[VC_PHONE_NUMBER_LENGTH_MAX]; /**< Phone number */
83 voicecall_call_orig_type_t call_type; /**< Type of the voice call */
85 call_vc_satsetup_info_t satcall_setup_info; /**<applies when call_type is VC_CALL_ORIG_TYPE_SAT */
86 } call_vc_setupcall_info_t;
89 * This structure holds the status of call members
92 call_vc_call_objectinfo_t callobject_info[VC_MAX_CALL_MEMBER]; /**< CallObject having details of Single Call */
93 call_vc_groupinfo_t callgroup_info[CALL_VC_CALL_GROUP_MAX]; /**< Maintains the Call Group Details */
94 call_vc_setupcall_info_t setupcall_info; /**< MO Call Details */
95 int mtcall_index; /**< Index for the MT Call Object */
99 * This function initializes the call manager
102 * @param[out] pMng Pointer to the call manager structure
104 void _vc_core_call_manager_init(call_vc_manager_t *pMng);
107 * This function adds the given call object info to a free slot.
109 * @return This function returns the call object index on success and -1 on failure
110 * @param[in] pMng Pointer to the call manager structure
111 * @param[in] pcall_object Pointer to the call object info structure that need to be added
112 * @see _vc_core_cm_set_call_object, _vc_core_cm_remove_call_object
114 int _vc_core_cm_add_call_object(call_vc_manager_t *pMng, call_vc_call_objectinfo_t *pcall_object);
117 * This function sets the given call object info to the given slot
119 * @return This function returns the call object index on success and -1 on failure
120 * @param[in] pMng Pointer to the call manager structure
121 * @param[in] pcall_object Pointer to the call object info structure that need to be modified
122 * @see _vc_core_cm_add_call_object, _vc_core_cm_remove_call_object, _vc_core_cm_get_call_object
124 int _vc_core_cm_set_call_object(call_vc_manager_t *pMng, call_vc_call_objectinfo_t *pcall_object);
127 * This function removes the specified call object info of a given call handle
129 * @return This function returns TRUE on success and FALSE on failure
130 * @param[in] pMng Pointer to the call manager structure
131 * @param[in] call_handle Handle of the call object to be removed
132 * @see _vc_core_cm_add_call_object, _vc_core_cm_set_call_object
134 gboolean _vc_core_cm_remove_call_object(call_vc_manager_t *pMng, call_vc_handle call_handle);
137 * This function retrieves the given call object info
139 * @return This function returns TRUE on success and FALSE on failure
140 * @param[in] pMng Pointer to the call manager structure
141 * @param[in] call_handle Call handle of the object info to be retrieved
142 * @param[out] pcall_object Pointer to the call object info structure that should be retrieved
143 * @see _vc_core_cm_add_call_object, _vc_core_cm_remove_call_object, _vc_core_cm_set_call_object
145 gboolean _vc_core_cm_get_call_object(call_vc_manager_t *pMng, call_vc_handle call_handle, call_vc_call_objectinfo_t *pcall_object);
148 * This function retrieves the given call object info for the given index
150 * @return This function returns TRUE on success and FALSE on failure
151 * @param[in] pMng Pointer to the call manager structure
152 * @param[in] index index of the object info to be retrieved
153 * @param[out] pcall_object Pointer to the call object info structure that should be retrieved
154 * @see _vc_core_cm_add_call_object, _vc_core_cm_remove_call_object, _vc_core_cm_set_call_object
156 gboolean _vc_core_cm_get_call_object_byindex(call_vc_manager_t *pMng, int index, call_vc_call_objectinfo_t *pcall_object);
159 * This function retrieves the call state of a given call handle
161 * @return This function returns the call state
162 * @param[in] pMng Pointer to the call manager structure
163 * @param[in] call_handle Call handle for which the state has to be retrieved
165 voicecall_call_state_t _vc_core_cm_get_call_state(call_vc_manager_t *pMng, call_vc_handle call_handle);
168 * This function returns the number of calls in a given call state
170 * @return This function returns the number of calls in the given state
171 * @param[in] pMng Pointer to the call manager structure
172 * @param[in] state The call state the number of which has to be retrieved
174 int _vc_core_cm_get_call_state_num(call_vc_manager_t *pMng, voicecall_call_state_t state);
177 * This function clears the information of a given call state
180 * @param[in] pcall_object Pointer to the call object which has to be cleared
182 void _vc_core_cm_clear_call_object(call_vc_call_objectinfo_t *pcall_object);
185 * This function clears the information of the callobject available in the given index
187 * @return TRUE, if the object cleared, otherwise FALSE
188 * @param[in] pMng Pointer to the call manager structure
189 * @param[in] index Index of the call object to be cleared
191 gboolean _vc_core_cm_clear_call_object_byindex(call_vc_manager_t *pMng, int index);
194 * This function clears the call object information of the ended and finished calls
196 * @return This function returns TRUE on success and FALSE on failure
197 * @param[in] pMng Pointer to the call manager structure
199 gboolean _vc_core_cm_clear_endcall_member(call_vc_manager_t *pMng);
202 * This function adds a call member to a group
204 * @return This function returns TRUE on success and FALSE on failure
205 * @param[in] pMng Pointer to the call manager structure
206 * @param[in] callobject_index The object index of the call object to be added
207 * @see __vc_core_cm_remove_call_member_fromgroup
209 gboolean _vc_core_cm_add_call_member_togroup(call_vc_manager_t *pMng, int callobject_index);
212 * This function retreives the group state for the given group index
214 * @return This function returns the group state
215 * @param[in] pMng Pointer to the call manager structure
216 * @param[in] nGroup group index
218 call_vc_groupstate_t _vc_core_cm_get_group_state(call_vc_manager_t *pMng, int nGroup);
221 * This function sets the state of a given group
224 * @param[in] pMng Pointer to the call manager structure
225 * @param[in] nGroup The call group for which the state needs to be changed
226 * @param[in] state The state to be set
227 * @see _vc_core_cm_swap_group_state, _vc_core_cm_get_call_pos_ingroup
229 void _vc_core_cm_set_group_state(call_vc_manager_t *pMng, int nGroup, call_vc_groupstate_t state);
232 * This function retrieves the index of the group given the call handle
234 * @return Returns group index on success and -1 on failure
235 * @param[in] pMng Pointer to the call manager structure
236 * @param[in] call_handle The for which the group index has to be retrieved
237 * @see _vc_core_cm_set_group_state, _vc_core_cm_get_call_pos_ingroup
239 int _vc_core_cm_get_group_index(call_vc_manager_t *pMng, call_vc_handle call_handle);
242 * This function retrieves the index/position of the call info in the object info table for a given call handle
244 * @return Returns index on success and -1 on failure
245 * @param[in] pMng Pointer to the call manager structure
246 * @param[in] nGroup Group ID
247 * @param[in] call_handle The call handle for which the call index has to be retrieved
248 * @see _vc_core_cm_get_group_index
250 int _vc_core_cm_get_call_pos_ingroup(call_vc_manager_t *pMng, int nGroup, call_vc_handle call_handle);
253 * This function swaps the state of the groups
255 * @return Returns TRUE on success and FALSE on failure
256 * @param[in] pMng Pointer to the call manager structure
257 * @see _vc_core_cm_set_group_state
259 gboolean _vc_core_cm_swap_group_state(call_vc_manager_t *pMng);
262 * This function joins the groups
264 * @return Returns TRUE on success and FALSE on failure
265 * @param[in] pMng Pointer to the call manager structure
266 * @see _vc_core_cm_split_group
268 gboolean _vc_core_cm_join_group(call_vc_manager_t *pMng);
271 * This function splits the group given a call handle
273 * @return Returns TRUE on success and FALSE on failure
274 * @param[in] pMng Pointer to the call manager structure
275 * @param[in] call_handle Call handle
276 * @see _vc_core_cm_join_group
278 gboolean _vc_core_cm_split_group(call_vc_manager_t *pMng, call_vc_handle call_handle);
281 * This function retrieves the total number of members in all the groups
283 * @return Returns the total number of members
284 * @param[in] pMng Pointer to the call manager structure
286 int _vc_core_cm_get_total_members_ingroup(call_vc_manager_t *pMng);
289 * This function retrieves the total number of groups
291 * @return Returns the total number of groups
292 * @param[in] pMng Pointer to the call manager structure
294 int _vc_core_cm_get_group_count(call_vc_manager_t *pMng);
297 * This function clears the outgoing call information
299 * @return Returns TRUE on success and FALSE on failure
300 * @param[in] pMng Pointer to the call manager structure
301 * @see _vc_core_cm_set_outgoing_call
303 gboolean _vc_core_cm_clear_outgoing_call(call_vc_manager_t *pMng);
306 * This function sets the out going call index
308 * @return Returns TRUE on success and FALSE on failure
309 * @param[in] pMng Pointer to the call manager structure
310 * @param[in] callIndex Call index that needs to be set
311 * @see _vc_core_cm_clear_outgoing_call
313 gboolean _vc_core_cm_set_outgoing_call(call_vc_manager_t *pMng, int callIndex);
316 * This function retrieves the outgoing call handle
318 * @return Returns out going call handle on success and TAPI_INVALID_CALLHANDLE on failure
319 * @param[in] pMng Pointer to the call manager structure
321 call_vc_handle _vc_core_cm_get_outgoing_call_handle(call_vc_manager_t *pMng);
324 * This function retrieves the outgoing call information
326 * @return Returns TRUE on success and FALSE on failure
327 * @param[in] pMng Pointer to the call manager structure
328 * @param[out] pcall_object Pointer to the call object info structure
329 * @see _vc_core_cm_set_outgoing_call_info
331 gboolean _vc_core_cm_get_outgoing_call_info(call_vc_manager_t *pMng, call_vc_call_objectinfo_t *pcall_object);
334 * This function sets the given outgoing call information
336 * @return Returns TRUE on success and FALSE on failure
337 * @param[in] pMng Pointer to the call manager structure
338 * @param[in] pcall_object Pointer to the call object info structure
339 * @see _vc_core_cm_get_outgoing_call_info
341 gboolean _vc_core_cm_set_outgoing_call_info(call_vc_manager_t *pMng, call_vc_call_objectinfo_t *pcall_object);
344 * This function sets the incoming call index
346 * @return Returns TRUE on success and FALSE on failure
347 * @param[in] pMng Pointer to the call manager structure
348 * @param[in] callIndex Call index of the incoming call
350 gboolean _vc_core_cm_set_incoming_call(call_vc_manager_t *pMng, int callIndex);
353 * This function retrieves the call handle of the incoming call
355 * @return Returns the call handle if success, TAPI_INVALID_CALLHANDLE on failure
356 * @param[in] pMng Pointer to the call manager structure
357 * @see _vc_core_cm_get_incoming_call_info
359 call_vc_handle _vc_core_cm_get_incoming_call_handle(call_vc_manager_t *pMng);
362 * This function retrieves the call information of the incoming call
364 * @return Returns TRUE on success and FALSE on failure
365 * @param[in] pMng Pointer to the call manager structure
366 * @param[out] pcall_object Pointer to the call object info structure
367 * @see _vc_core_cm_get_incoming_call_info, call_vc_cm_set_incomingcall_info
369 gboolean _vc_core_cm_get_incoming_call_info(call_vc_manager_t *pMng, call_vc_call_objectinfo_t *pcall_object);
372 * This function checks if incoming call exists
374 * @return Returns TRUE if call exist FALSE otherwise
375 * @param[in] pMng Pointer to the call manager structure
376 * @see call_vc_cm_outgoing_call_exist, _vc_core_cm_isexists_connected_call
378 gboolean _vc_core_cm_isexists_incoming_call(call_vc_manager_t *pMng);
381 * This function checks if active/ held exists
383 * @return Returns TRUE if success else FALSE
384 * @param[in] pMng Pointer to the call manager structure
385 * @param[out] active_calls TRUE if active call exists, FALSE if held call exists
386 * @param[out] held_calls TRUE if held call exists, FALSE if held call exists
387 * @see call_vc_cm_outgoing_call_exist, _vc_core_cm_isexists_connected_call
389 gboolean _vc_core_cm_isexists_call_ingroup(call_vc_manager_t *pMng, int *active_calls, int *held_calls);
392 * This function changes the call state of the call object corresponds to the given call handle
394 * @return Returns TRUE if success else FALSE
395 * @param[in] pMng Pointer to the call manager structure
396 * @param[out] call_handle Call Handle of the Callobject to be modified
397 * @param[out] callState New call state to be set
399 gboolean _vc_core_cm_change_call_object_state(call_vc_manager_t *pMng, call_vc_handle call_handle, voicecall_call_state_t callState);
402 * This function returns the status of currently being ended call
404 * @return Returns TRUE if any calls are being ended, FALSE otherwise
405 * @param[in] pMng Pointer to the call manager structure
407 gboolean _vc_core_cm_get_ending_call_info(call_vc_manager_t *pMng);
410 * This function retrieves the number of members in a group
412 * @return Returns number of members in the group
413 * @param[in] pMng Pointer to the call manager structure
414 * @param[in] nGroup Group index
416 int _vc_core_cm_get_member_count_ingroup(call_vc_manager_t *pMng, int nGroup);
419 * This function retrieves the number of connected members in a group
421 * @return Returns number of connected members in the group
422 * @param[in] pMng Pointer to the call manager structure
423 * @param[in] nGroup Group index
425 int _vc_core_cm_get_connected_member_count_ingroup(call_vc_manager_t *pMng, int nGroup);
428 * This function retrieves the call object info of a given group and object position
430 * @return Returns TRUE on success and FALSE on failure
431 * @param[in] pMng Pointer to the call manager structure
432 * @param[in] nGroup Group index
433 * @param[in] nPos Call object index
434 * @param[out] pcall_object Pointer to the call object info structure
436 gboolean _vc_core_cm_get_call_info_ingroup_byposition(call_vc_manager_t *pMng, int nGroup, int nPos, call_vc_call_objectinfo_t *pcall_object);
439 * This function retrieves the call state of a given group and object position
441 * @return Returns call state of the object
442 * @param[in] pMng Pointer to the call manager structure
443 * @param[in] nGroup Group index
444 * @param[in] nPos Call object index
446 voicecall_call_state_t _vc_core_cm_get_call_state_ingroup_byposition(call_vc_manager_t *pMng, int nGroup, int nPos);
449 * This function retrieves the call handle of a given group and object position
451 * @return Returns call handle of the object
452 * @param[in] pMng Pointer to the call manager structure
453 * @param[in] nGroup Group index
454 * @param[in] nPos Call object index
456 call_vc_handle _vc_core_cm_get_call_handle_ingroup_byposition(call_vc_manager_t *pMng, int nGroup, int nPos);
459 * This function retrieves the call handle of a given call ID
461 * @return Returns call handle of the object
462 * @param[in] pMng Pointer to the call manager structure
463 * @param[in] callID Call ID for a given call object
465 call_vc_handle _vc_core_cm_get_call_handle_ingroup_bycallId(call_vc_manager_t *pMng, int callID);
468 * This function checks if connected call exists
470 * @return Returns TRUE if call exist FALSE otherwise
471 * @param[in] pMng Pointer to the call manager structure
472 * @see call_vc_cm_outgoing_call_exist, _vc_core_cm_isexists_incoming_call
474 gboolean _vc_core_cm_isexists_connected_call(call_vc_manager_t *pMng);
477 * This function retrieves the group state for a given call ID of an
479 * @return This function returns the group state
480 * @param[in] pMng Pointer to the call manager structure
481 * @param[in] callID The call ID of the object
483 call_vc_groupstate_t _vc_core_cm_get_group_state_callid(call_vc_manager_t *pMng, int callID);
486 * This function retrieves the call handle of the first active call
488 * @return Returns the call handle on sucess, -1 on failure
489 * @param[in] pMng Pointer to the call manager structure
490 * @param[in] pCall Pointer to the call handle where the retrieved call handle need to be stored
491 * @see _vc_core_cm_get_next_active_call_handle
493 int _vc_core_cm_get_first_active_call_handle(call_vc_manager_t *pMng, call_vc_handle *pCall);
496 * This function retrieves the call handle of the first held call
498 * @return Returns the call handle on sucess, -1 on failure
499 * @param[in] pMng Pointer to the call manager structure
500 * @param[in] pCall Pointer to the call handle where the retrieved call handle need to be stored
501 * @see _vc_core_cm_get_next_held_call_handle
503 int _vc_core_cm_get_first_held_call_handle(call_vc_manager_t *pMng, call_vc_handle *pCall);
506 * This function retrieves the next active call handle
508 * @return Returns the call handle on sucess, -1 on failure
509 * @param[in] pMng Pointer to the call manager structure
510 * @param[in] pCall Pointer to the call handle where the retrieved call handle need to be stored
511 * @param[in] nPos Current position of the call object index
512 * @see _vc_core_cm_get_first_active_call_handle
514 int _vc_core_cm_get_next_active_call_handle(call_vc_manager_t *pMng, call_vc_handle *pCall, int nPos);
517 * This function retrieves the next held call handle
519 * @return Returns the call handle on sucess, -1 on failure
520 * @param[in] pMng Pointer to the call manager structure
521 * @param[in] pCall Pointer to the call handle where the retrieved call handle need to be stored
522 * @param[in] nPos Current position of the call object index
523 * @see _vc_core_cm_get_first_held_call_handle
525 int _vc_core_cm_get_next_held_call_handle(call_vc_manager_t *pMng, call_vc_handle *pCall, int nPos);
528 * This function checks if active call exists
530 * @return Returns TRUE if call exist FALSE otherwise
531 * @param[in] pMng Pointer to the call manager structure
532 * @see _vc_core_cm_isexists_held_call
534 gboolean _vc_core_cm_isexists_active_call(call_vc_manager_t *pMng);
537 * This function checks if held call exists
539 * @return Returns TRUE if call exist FALSE otherwise
540 * @param[in] pMng Pointer to the call manager structure
541 * @see _vc_core_cm_isexists_active_call
543 gboolean _vc_core_cm_isexists_held_call(call_vc_manager_t *pMng);
546 * This function retrieves the number of active calls
548 * @return Returns number of active calls
549 * @param[in] pMng Pointer to the call manager structure
550 * @see _vc_core_cm_get_held_call_count
552 int _vc_core_cm_get_active_call_count(call_vc_manager_t *pMng);
555 * This function retrieves the number of held calls
557 * @return Returns number of held calls
558 * @param[in] pMng Pointer to the call manager structure
559 * @see _vc_core_cm_get_held_call_count
561 int _vc_core_cm_get_held_call_count(call_vc_manager_t *pMng);
564 * This function retrieves the group index of active calls
566 * @return Returns the group index
567 * @param[in] pMng Pointer to the call manager structure
568 * @see _vc_core_cm_get_held_group_index
570 int _vc_core_cm_get_active_group_index(call_vc_manager_t *pMng);
573 * This function retrieves the group index of held calls
575 * @return Returns the group index
576 * @param[in] pMng Pointer to the call manager structure
577 * @see _vc_core_cm_get_active_group_index
579 int _vc_core_cm_get_held_group_index(call_vc_manager_t *pMng);
582 * This function changes the state of the given onject info
585 * @param[in] info Pointer to the call object into structure for which the state has to be changed
586 * @param[in] callState State that needs to be set
588 void inline _vc_core_cm_change_call_state(call_vc_call_objectinfo_t *info, voicecall_call_state_t callState);
591 * This function dumps the complete information in the call manager
594 * @param[in] info Pointer to the call manager structure
596 void _vc_core_cm_test_dump(call_vc_manager_t *info);
598 /*========================================================================================*/
600 * This function retrieves the number of call members in various states of a call
602 * @return Number of call members available
603 * @param[in] pMng Pointer to the call manager structure
605 int _vc_core_cm_get_call_member_count(call_vc_manager_t *pMng);
608 unsigned long call_vc_cm_search_oldcall(call_vc_manager_t *pMng, gboolean activegroup);
609 unsigned long call_vc_cm_search_next_oldcall(call_vc_manager_t *pMng, gboolean activegroup, call_vc_handle call_handle);
610 unsigned long call_vc_cm_gp_get_calltm_connected(call_vc_manager_t *pMng, int nGroup, int nPos);
611 gboolean call_vc_cm_search_activecall(call_vc_manager_t *pMng, call_vc_handle call_handle);
612 gboolean call_vc_cm_search_activecall_ctinfo(call_vc_manager_t *pMng, call_vc_handle call_handle);
613 gboolean call_vc_cm_search_holdcall(call_vc_manager_t *pMng, call_vc_handle call_handle);
614 gboolean call_vc_cm_search_holdcall_ctinfo(call_vc_manager_t *pMng, call_vc_handle call_handle);
618 * This function retrieves an available call ID
620 * @return Call ID on success, -1 on failure
621 * @param[in] pMng Pointer to the call manager structure
623 int _vc_core_cm_get_new_callId(call_vc_manager_t *pMng);
624 #endif /* __VC_CORE_CALL_MANAGER_H_ */