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.
22 #include "vc-core-engine.h"
23 #include "vc-core-svcall.h"
24 #include "vc-core-util.h"
26 #include "status-interface.h"
28 /*Local Function Decleration*/
30 * This function checks whether csp is enabled in the cphs group
33 * @return TRUE if customer service profile is enabled -FALSE otherwise
34 * @param[in] pcall_agent Handle to Voicecall Call Agent
36 static gboolean __call_vcsv_cphs_is_csp_enabled(call_vc_callagent_state_t *pcall_agent);
39 * This function returns the csp index of the given csp service from the cphs cspprofile
42 * @return index to the specified csp service
43 * @param[in] pcphs_csp_profile Handle to csp profile entry table
44 * @param[in] csp_group_max_count maximumm service entry
45 * @param[in] csp_service csp service to be found
47 static int __call_vcsv_cphs_find_csp_index(TelSimCphsCustomerServiceProfileEntry_t *pcphs_csp_profile, int csp_group_max_count, TelSimCphsCustomerServiceGroup_t csp_service);
50 * This function retrieves cphs information from the Telephony and stores with the engine
52 * @return Returns TRUE on success and FALSE on failure
53 * @param[in] pcall_agent Handle to Voicecall Call Agent
55 gboolean _vc_core_svcall_init_cphs_info(call_vc_callagent_state_t *pcall_agent)
57 gboolean ret_val = FALSE;
59 CALL_ENG_DEBUG(ENG_DEBUG, "");
61 memset(&pcall_agent->cphs_status, 0, sizeof(status_class_cphs_type));
65 ret_val = nps_get_cphs_status(&pcall_agent->cphs_status);
68 if (FALSE == ret_val) {
69 CALL_ENG_DEBUG(ENG_DEBUG, "nps_get_cphs_status failed or CPHS feature not enabled");
70 pcall_agent->bcphs_read_success = FALSE;
74 pcall_agent->bcphs_read_success = TRUE;
80 * This function retrieves status of the given csp service type
82 * @return Returns TRUE on success and FALSE on failure
83 * @param[in] csp_service csp service whose status to be retreived
85 gboolean _vc_core_svcall_cphs_csp_get_status(call_vc_callagent_state_t *pcall_agent, voicecall_cphs_csp_service csp_service)
87 status_class_cphs_type *pcphs_status_info = (status_class_cphs_type *) &pcall_agent->cphs_status;
90 if (FALSE == __call_vcsv_cphs_is_csp_enabled(pcall_agent)) {
91 CALL_ENG_DEBUG(ENG_DEBUG, "CPHS CSP Not enabled");
93 if (VC_CPHS_CSP_ALS == csp_service) {
96 /*If CPHS is not supported, then by default return TRUE for the client to have default action */
101 switch (csp_service) {
102 case VC_CPHS_CSP_ALS: /*CPHS Teleservices */
104 csp_index = __call_vcsv_cphs_find_csp_index(pcphs_status_info->csp.serviceProfileEntry, TAPI_SIM_CPHS_CUSTOMER_SERVICE_PROFILE_ENTRY_COUNT_MAX, TAPI_SIM_CPHS_CSP_SERVICE_GROUP_CPHS_TELESERVICES);
107 case VC_CPHS_CSP_HOLD: /*Call Completion Services */
109 case VC_CPHS_CSP_CBS:
110 case VC_CPHS_CSP_UUS:
112 csp_index = __call_vcsv_cphs_find_csp_index(pcphs_status_info->csp.serviceProfileEntry, TAPI_SIM_CPHS_CUSTOMER_SERVICE_PROFILE_ENTRY_COUNT_MAX, TAPI_SIM_CPHS_CSP_SERVICE_GROUP_CALL_COMPLETION);
115 case VC_CPHS_CSP_CT: /*Call Offering Services */
116 case VC_CPHS_CSP_CFU:
117 case VC_CPHS_CSP_CFB:
118 case VC_CPHS_CSP_CFNRY:
119 case VC_CPHS_CSP_CFNRC:
121 csp_index = __call_vcsv_cphs_find_csp_index(pcphs_status_info->csp.serviceProfileEntry, TAPI_SIM_CPHS_CUSTOMER_SERVICE_PROFILE_ENTRY_COUNT_MAX, TAPI_SIM_CPHS_CSP_SERVICE_GROUP_CALL_OFFERING);
124 case VC_CPHS_CSP_MPTY: /*Other Supplementary Services */
125 case VC_CPHS_CSP_CUG:
126 case VC_CPHS_CSP_AOC:
127 case VC_CPHS_CSP_PREFCUG:
128 case VC_CPHS_CSP_CUGOA:
130 csp_index = __call_vcsv_cphs_find_csp_index(pcphs_status_info->csp.serviceProfileEntry, TAPI_SIM_CPHS_CUSTOMER_SERVICE_PROFILE_ENTRY_COUNT_MAX, TAPI_SIM_CPHS_CSP_SERVICE_GROUP_OTHER_SUPP_SERVICES);
134 CALL_ENG_DEBUG(ENG_DEBUG, "No Actions defined for service type: %d", csp_service);
138 if (-1 == csp_index) {
139 CALL_ENG_DEBUG(ENG_DEBUG, "csp_index failed for csp service: %d", csp_service);
143 switch (csp_service) {
144 case VC_CPHS_CSP_ALS:
146 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.cphsTeleservices.bAlternativeLineService;
149 case VC_CPHS_CSP_HOLD:
151 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCallHold;
156 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCallWaiting;
159 case VC_CPHS_CSP_CBS:
161 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCompletionOfCallToBusySubscriber;
164 case VC_CPHS_CSP_UUS:
166 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bUserUserSignalling;
169 case VC_CPHS_CSP_CFU:
171 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingUnconditional;
174 case VC_CPHS_CSP_CFB:
176 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnUserBusy;
179 case VC_CPHS_CSP_CFNRY:
181 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnNoReply;
184 case VC_CPHS_CSP_CFNRC:
186 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnUserNotReachable;
191 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallTransfer;
194 case VC_CPHS_CSP_MPTY:
196 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bMultiPartyService;
199 case VC_CPHS_CSP_CUG:
201 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bClosedUserGroup;
204 case VC_CPHS_CSP_AOC:
206 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bAdviceOfCharge;
209 case VC_CPHS_CSP_PREFCUG:
211 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bPreferentialClosedUserGroup;
214 case VC_CPHS_CSP_CUGOA:
216 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bPreferentialClosedUserGroup;
220 CALL_ENG_DEBUG(ENG_DEBUG, "Action not defined for csp service: %d", csp_service);
227 voice_call_cphs_alsline_t _vc_core_svcall_get_cphs_als_active_line(call_vc_callagent_state_t *pcall_agent)
229 status_class_cphs_type *pcphs_status_info = (status_class_cphs_type *) &pcall_agent->cphs_status;
231 if (FALSE == __call_vcsv_cphs_is_csp_enabled(pcall_agent)) {
232 CALL_ENG_DEBUG(ENG_DEBUG, "CPHS CSP Not enabled");
233 return VC_CALL_CPHS_ALS_LINE1;
236 if (TAPI_SIM_DYNAMIC_FLAGS_LINE1 == pcphs_status_info->dflagsinfo.dynamicFlags) {
237 return VC_CALL_CPHS_ALS_LINE1;
238 } else if (TAPI_SIM_DYNAMIC_FLAGS_LINE2 == pcphs_status_info->dflagsinfo.dynamicFlags) {
239 return VC_CALL_CPHS_ALS_LINE2;
242 return VC_CALL_CPHS_ALS_LINE1;
246 /*Local Function Decleration*/
247 static gboolean __call_vcsv_cphs_is_csp_enabled(call_vc_callagent_state_t *pcall_agent)
249 status_class_cphs_type *pnps_cphs_status = NULL;
251 CALL_ENG_DEBUG(ENG_DEBUG, "");
253 if (pcall_agent->bcphs_read_success == FALSE) {
254 CALL_ENG_DEBUG(ENG_DEBUG, "CSP Status not read");
258 pnps_cphs_status = &pcall_agent->cphs_status;
260 if (FALSE == pnps_cphs_status->cphsinfo.CphsServiceTable.bCustomerServiceProfile) {
267 static int __call_vcsv_cphs_find_csp_index(TelSimCphsCustomerServiceProfileEntry_t *pcphs_csp_profile, int csp_group_max_count, TelSimCphsCustomerServiceGroup_t csp_service)
270 CALL_ENG_DEBUG(ENG_DEBUG, "");
272 for (index = 0; index < csp_group_max_count; index++) {
273 if (pcphs_csp_profile[index].customerServiceGroup == csp_service) {
280 #endif /*_CPHS_DEFINED_*/