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.
21 #include "vc-core-engine.h"
22 #include "vc-core-svcall.h"
23 #include "vc-core-util.h"
25 #include "status-interface.h"
27 /*Local Function Decleration*/
29 * This function checks whether csp is enabled in the cphs group
32 * @return TRUE if customer service profile is enabled -FALSE otherwise
33 * @param[in] pcall_agent Handle to Voicecall Call Agent
35 static gboolean __call_vcsv_cphs_is_csp_enabled(call_vc_callagent_state_t *pcall_agent);
38 * This function returns the csp index of the given csp service from the cphs cspprofile
41 * @return index to the specified csp service
42 * @param[in] pcphs_csp_profile Handle to csp profile entry table
43 * @param[in] csp_group_max_count maximumm service entry
44 * @param[in] csp_service csp service to be found
46 static int __call_vcsv_cphs_find_csp_index(TelSimCphsCustomerServiceProfileEntry_t *pcphs_csp_profile, int csp_group_max_count, TelSimCphsCustomerServiceGroup_t csp_service);
49 * This function retrieves cphs information from the Telephony and stores with the engine
51 * @return Returns TRUE on success and FALSE on failure
52 * @param[in] pcall_agent Handle to Voicecall Call Agent
54 gboolean _vc_core_svcall_init_cphs_info(call_vc_callagent_state_t *pcall_agent)
56 gboolean ret_val = FALSE;
58 CALL_ENG_DEBUG(ENG_DEBUG, "");
60 memset(&pcall_agent->cphs_status, 0, sizeof(status_class_cphs_type));
64 ret_val = nps_get_cphs_status(&pcall_agent->cphs_status);
67 if (FALSE == ret_val) {
68 CALL_ENG_DEBUG(ENG_DEBUG, "nps_get_cphs_status failed or CPHS feature not enabled");
69 pcall_agent->bcphs_read_success = FALSE;
73 pcall_agent->bcphs_read_success = TRUE;
79 * This function retrieves status of the given csp service type
81 * @return Returns TRUE on success and FALSE on failure
82 * @param[in] csp_service csp service whose status to be retreived
84 gboolean _vc_core_svcall_cphs_csp_get_status(call_vc_callagent_state_t *pcall_agent, voicecall_cphs_csp_service csp_service)
86 status_class_cphs_type *pcphs_status_info = (status_class_cphs_type *) &pcall_agent->cphs_status;
89 if (FALSE == __call_vcsv_cphs_is_csp_enabled(pcall_agent)) {
90 CALL_ENG_DEBUG(ENG_DEBUG, "CPHS CSP Not enabled");
92 if (VC_CPHS_CSP_ALS == csp_service) {
95 /*If CPHS is not supported, then by default return TRUE for the client to have default action */
100 switch (csp_service) {
101 case VC_CPHS_CSP_ALS: /*CPHS Teleservices */
103 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);
106 case VC_CPHS_CSP_HOLD: /*Call Completion Services */
108 case VC_CPHS_CSP_CBS:
109 case VC_CPHS_CSP_UUS:
111 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);
114 case VC_CPHS_CSP_CT: /*Call Offering Services */
115 case VC_CPHS_CSP_CFU:
116 case VC_CPHS_CSP_CFB:
117 case VC_CPHS_CSP_CFNRY:
118 case VC_CPHS_CSP_CFNRC:
120 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);
123 case VC_CPHS_CSP_MPTY: /*Other Supplementary Services */
124 case VC_CPHS_CSP_CUG:
125 case VC_CPHS_CSP_AOC:
126 case VC_CPHS_CSP_PREFCUG:
127 case VC_CPHS_CSP_CUGOA:
129 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);
133 CALL_ENG_DEBUG(ENG_DEBUG, "No Actions defined for service type: %d", csp_service);
137 if (-1 == csp_index) {
138 CALL_ENG_DEBUG(ENG_DEBUG, "csp_index failed for csp service: %d", csp_service);
142 switch (csp_service) {
143 case VC_CPHS_CSP_ALS:
145 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.cphsTeleservices.bAlternativeLineService;
148 case VC_CPHS_CSP_HOLD:
150 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCallHold;
155 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCallWaiting;
158 case VC_CPHS_CSP_CBS:
160 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bCompletionOfCallToBusySubscriber;
163 case VC_CPHS_CSP_UUS:
165 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callComplete.bUserUserSignalling;
168 case VC_CPHS_CSP_CFU:
170 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingUnconditional;
173 case VC_CPHS_CSP_CFB:
175 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnUserBusy;
178 case VC_CPHS_CSP_CFNRY:
180 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnNoReply;
183 case VC_CPHS_CSP_CFNRC:
185 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallForwardingOnUserNotReachable;
190 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.callOffering.bCallTransfer;
193 case VC_CPHS_CSP_MPTY:
195 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bMultiPartyService;
198 case VC_CPHS_CSP_CUG:
200 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bClosedUserGroup;
203 case VC_CPHS_CSP_AOC:
205 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bAdviceOfCharge;
208 case VC_CPHS_CSP_PREFCUG:
210 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bPreferentialClosedUserGroup;
213 case VC_CPHS_CSP_CUGOA:
215 return pcphs_status_info->csp.serviceProfileEntry[csp_index].u.otherSuppServices.bPreferentialClosedUserGroup;
219 CALL_ENG_DEBUG(ENG_DEBUG, "Action not defined for csp service: %d", csp_service);
226 voice_call_cphs_alsline_t _vc_core_svcall_get_cphs_als_active_line(call_vc_callagent_state_t *pcall_agent)
228 status_class_cphs_type *pcphs_status_info = (status_class_cphs_type *) &pcall_agent->cphs_status;
230 if (FALSE == __call_vcsv_cphs_is_csp_enabled(pcall_agent)) {
231 CALL_ENG_DEBUG(ENG_DEBUG, "CPHS CSP Not enabled");
232 return VC_CALL_CPHS_ALS_LINE1;
235 if (TAPI_SIM_DYNAMIC_FLAGS_LINE1 == pcphs_status_info->dflagsinfo.dynamicFlags) {
236 return VC_CALL_CPHS_ALS_LINE1;
237 } else if (TAPI_SIM_DYNAMIC_FLAGS_LINE2 == pcphs_status_info->dflagsinfo.dynamicFlags) {
238 return VC_CALL_CPHS_ALS_LINE2;
241 return VC_CALL_CPHS_ALS_LINE1;
245 /*Local Function Decleration*/
246 static gboolean __call_vcsv_cphs_is_csp_enabled(call_vc_callagent_state_t *pcall_agent)
248 status_class_cphs_type *pnps_cphs_status = NULL;
250 CALL_ENG_DEBUG(ENG_DEBUG, "");
252 if (pcall_agent->bcphs_read_success == FALSE) {
253 CALL_ENG_DEBUG(ENG_DEBUG, "CSP Status not read");
257 pnps_cphs_status = &pcall_agent->cphs_status;
259 if (FALSE == pnps_cphs_status->cphsinfo.CphsServiceTable.bCustomerServiceProfile) {
266 static int __call_vcsv_cphs_find_csp_index(TelSimCphsCustomerServiceProfileEntry_t *pcphs_csp_profile, int csp_group_max_count, TelSimCphsCustomerServiceGroup_t csp_service)
269 CALL_ENG_DEBUG(ENG_DEBUG, "");
271 for (index = 0; index < csp_group_max_count; index++) {
272 if (pcphs_csp_profile[index].customerServiceGroup == csp_service) {
279 #endif /*_CPHS_DEFINED_*/