telephonyutils/etel3rdpartyapi/src/TelephonyFuncSupplServices.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2009 Sony Ericsson Mobile Communications AB
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Sony Ericsson Mobile Communications AB - initial contribution.
       
    11 * Nokia Corporation - additional changes.
       
    12 * 
       
    13 * Contributors:
       
    14 * 
       
    15 * Description:
       
    16 * Code for CTelephonyFunctions class, used by CTelephony class.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #include <e32def.h>
       
    26 #include "TelephonyFunctions.h"
       
    27 #include "TelephonyActSupplServices.h"
       
    28 
       
    29 TInt CTelephonyFunctions::GetCFSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, const CTelephony::TCallForwardingCondition aCondition, TDes8& aDes,const CTelephony::TServiceGroup aServiceGroup)
       
    30 /**
       
    31 Initiate async request to interrogate the call forwarding status for a specified service group and condition.
       
    32 */
       
    33 	{
       
    34 	if(IsRequestPending(EGetCFSupplServicesStatus)!=EFalse)
       
    35 		{
       
    36 		return KErrInUse;
       
    37 		}
       
    38 	else
       
    39 		{
       
    40 		SetRequestPending(CTelephonyFunctions::EGetCFSupplServicesStatus, ETrue);		
       
    41 		}
       
    42 			
       
    43 	if(IsFlightModeOn())
       
    44 		{
       
    45 		return KErrAccessDenied;
       
    46 		}
       
    47 		
       
    48 	iReqStatusTable[EGetCFSupplServicesStatus] = &aRequestStatus;
       
    49 	
       
    50 	if(!iGetCFSupplementaryServiceStatus)
       
    51 		{
       
    52 		iGetCFSupplementaryServiceStatus = CGetSupplementaryServiceStatusAct::NewL(this);	
       
    53 		}
       
    54 	
       
    55 	return iGetCFSupplementaryServiceStatus->GetCFSupplementaryServiceStatus(aCondition, aDes, aServiceGroup);
       
    56 	}
       
    57 	
       
    58 EXPORT_C void CTelephony::GetCallBarringStatus(TRequestStatus& aRequestStatus, const TCallBarringCondition aCondition, TDes8& aDes, const TServiceGroup aServiceGroup) const
       
    59 /**
       
    60 Interrogate the current status of the call barring services. 
       
    61 
       
    62 Specify the condition for enquiry via the aCondition argument. 
       
    63 Upon successful completion the status information is returned via the aSSInfo argument. 
       
    64 Support is available only for the voice line.
       
    65 
       
    66 This functionality is not available when the phone is in "flight" mode.
       
    67 
       
    68 @param aRequestStatus Returns the result code after the asynchronous call completes. Pass CTelephony::CancelAsync() CTelephony::EGetCallBarringStatusCancel to cancel.
       
    69 
       
    70 @param aCondition Call barring condition to be interrogated.
       
    71 @param aDes  Contains a CTelephony::TCallBarringSupplServicesV1Pckg, a packaged version of the CTelephony::TCallBarringSupplServicesV1 class which is filled on completion.
       
    72 @param aServiceGroup Service group to be interrogated.
       
    73 
       
    74 @capability ReadDeviceData
       
    75 @capability NetworkServices
       
    76 */
       
    77 	{
       
    78 	TRequestStatus* reqStatusPtr = &aRequestStatus;
       
    79 	
       
    80 	__ASSERT_ALWAYS(aRequestStatus != KRequestPending,
       
    81 		User::Panic(KTelephonyCategory, KTelephonyPanicIllegalReuse) );
       
    82 
       
    83 	aRequestStatus = KRequestPending;
       
    84 	TInt rc=KErrInUse;	
       
    85 		
       
    86 	TRAPD(leaveCode, rc=iTelephonyFunctions->GetCBSupplementaryServiceStatusL(aRequestStatus, aCondition, aDes, aServiceGroup));
       
    87 
       
    88 	if(leaveCode != KErrNone)
       
    89 		{	
       
    90 		iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetCBSupplServicesStatus, EFalse);	
       
    91 		User::RequestComplete(reqStatusPtr, leaveCode);
       
    92 		}
       
    93 	else if (rc != KErrNone)
       
    94 		{
       
    95 		if(rc != KErrInUse)	//this means request already pending, so do not reset
       
    96 			{
       
    97 			iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetCBSupplServicesStatus, EFalse);
       
    98 			}
       
    99 		User::RequestComplete(reqStatusPtr, rc);
       
   100 		}
       
   101 	}
       
   102 	
       
   103 TInt CTelephonyFunctions::GetCBSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, const CTelephony::TCallBarringCondition aCondition, TDes8& aDes, const CTelephony::TServiceGroup aServiceGroup)
       
   104 /**
       
   105 Initiate async request to interrogate the call barring status for a specified service group and condition.
       
   106 */
       
   107 	{
       
   108 	if(IsRequestPending(EGetCBSupplServicesStatus)!=EFalse)
       
   109 		{
       
   110 		return KErrInUse;
       
   111 		}
       
   112 	else
       
   113 		{
       
   114 		SetRequestPending(CTelephonyFunctions::EGetCBSupplServicesStatus, ETrue);
       
   115 		}
       
   116 			
       
   117 	if(IsFlightModeOn())
       
   118 		{
       
   119 		return KErrAccessDenied;
       
   120 		}
       
   121 		
       
   122 	iReqStatusTable[EGetCBSupplServicesStatus] = &aRequestStatus;
       
   123 	
       
   124 	if(!iGetCBSupplementaryServiceStatus)
       
   125 		{
       
   126 		iGetCBSupplementaryServiceStatus = CGetSupplementaryServiceStatusAct::NewL(this);	
       
   127 		}
       
   128 	
       
   129 	return iGetCBSupplementaryServiceStatus->GetCBSupplementaryServiceStatus(aCondition, aDes, aServiceGroup);
       
   130 	}
       
   131 	
       
   132 EXPORT_C void CTelephony::GetCallWaitingStatus(TRequestStatus& aRequestStatus, TDes8& aDes, const TServiceGroup aServiceGroup) const
       
   133 /**
       
   134 Interrogate the current status of the call waiting services. 
       
   135 
       
   136 Upon successful completion the status information is returned via the aSSInfo argument. 
       
   137 Support is available only for the voice line.
       
   138 
       
   139 This functionality is not available when the phone is in "flight" mode.
       
   140 
       
   141 @param aRequestStatus Returns the result code after the asynchronous call completes. Pass CCTelephony::ancelAsync() CTelephony::EGetCallWaitingStatusCancel to cancel.
       
   142 @param aDes  Contains a CTelephony::TCallWaitingSupplServicesV1Pckg, a packaged version of the CTelephony::TCallWaitingSupplServicesV1 class which is filled on completion.
       
   143 @param aServiceGroup Service group to be interrogated.
       
   144 
       
   145 @capability ReadDeviceData
       
   146 @capability NetworkServices
       
   147 */
       
   148 	{
       
   149 	TRequestStatus* reqStatusPtr = &aRequestStatus;
       
   150 	
       
   151 	__ASSERT_ALWAYS(aRequestStatus != KRequestPending,
       
   152 		User::Panic(KTelephonyCategory, KTelephonyPanicIllegalReuse) );
       
   153 
       
   154 	aRequestStatus = KRequestPending;
       
   155 	TInt rc=KErrInUse;	
       
   156 		
       
   157 	TRAPD(leaveCode, rc=iTelephonyFunctions->GetCWSupplementaryServiceStatusL(aRequestStatus, aDes, aServiceGroup));
       
   158 
       
   159 	if(leaveCode != KErrNone)
       
   160 		{	
       
   161 		iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetCWSupplServicesStatus, EFalse);
       
   162 		User::RequestComplete(reqStatusPtr, leaveCode);
       
   163 		}
       
   164 	else if (rc != KErrNone)
       
   165 		{
       
   166 		if(rc != KErrInUse)	//this means request already pending, so do not reset
       
   167 			{
       
   168 			iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetCWSupplServicesStatus, EFalse);
       
   169 			}
       
   170 		User::RequestComplete(reqStatusPtr, rc);
       
   171 		}
       
   172 	}
       
   173 	
       
   174 TInt CTelephonyFunctions::GetCWSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, TDes8& aDes, const CTelephony::TServiceGroup aServiceGroup)
       
   175 /**
       
   176 Initiate async request to interrogate the call waiting status for a specified service group.
       
   177 */
       
   178 	{
       
   179 	if(IsRequestPending(EGetCWSupplServicesStatus)!=EFalse)
       
   180 		{
       
   181 		return KErrInUse;
       
   182 		}
       
   183 	else
       
   184 		{
       
   185 		SetRequestPending(CTelephonyFunctions::EGetCWSupplServicesStatus, ETrue);
       
   186 		}
       
   187 			
       
   188 	if(IsFlightModeOn())
       
   189 		{
       
   190 		return KErrAccessDenied;
       
   191 		}
       
   192 		
       
   193 	iReqStatusTable[EGetCWSupplServicesStatus] = &aRequestStatus;
       
   194 	
       
   195 	if(!iGetCWSupplementaryServiceStatus)
       
   196 		{
       
   197 		iGetCWSupplementaryServiceStatus = CGetSupplementaryServiceStatusAct::NewL(this);	
       
   198 		}
       
   199 	
       
   200 	return iGetCWSupplementaryServiceStatus->GetCWSupplementaryServiceStatus(aDes, aServiceGroup);
       
   201 	}
       
   202 	
       
   203 EXPORT_C CTelephony::TIdentityServiceV1::TIdentityServiceV1()
       
   204 /**
       
   205 Default constructor.
       
   206 */
       
   207 	{
       
   208 	iVersionId=KEtelISVV1;
       
   209 	}
       
   210 
       
   211 EXPORT_C void CTelephony::GetIdentityServiceStatus(TRequestStatus& aRequestStatus, const CTelephony::TIdentityService& aService, TDes8& aStatus) const
       
   212 /**
       
   213 Interrogate the current status of the identity services. 
       
   214 
       
   215 Specify the service for enquiry via the aService argument. 
       
   216 Upon successful completion the service status is returned via the aStatus argument.
       
   217 
       
   218 This functionality is not available when the phone is in "flight" mode.
       
   219 
       
   220 Note: This information is only available on GSM/WCDMA networks.
       
   221 
       
   222 @param aRequestStatus Returns the result code after the asynchronous call completes. Pass CTelephony::CancelAsync() CTelephony::EGetIdentityServiceStatusCancel to cancel.
       
   223 @param aService  
       
   224 @param aStatus Contains a CTelephony::TIdentityServiceV1Pckg, a packaged version of the CTelephony::TIdentityServiceV1 class which is filled on completion.
       
   225 
       
   226 @capability None
       
   227 */
       
   228 	{
       
   229 	TRequestStatus* reqStatusPtr = &aRequestStatus;
       
   230 	
       
   231 	__ASSERT_ALWAYS(aRequestStatus != KRequestPending,
       
   232 		User::Panic(KTelephonyCategory, KTelephonyPanicIllegalReuse) );
       
   233 
       
   234 	aRequestStatus = KRequestPending;
       
   235 	TInt rc=KErrInUse;	
       
   236 		
       
   237 	TRAPD(leaveCode, rc=iTelephonyFunctions->GetIdentityServiceStatusL(aRequestStatus, aService, aStatus));
       
   238 
       
   239 	if(leaveCode != KErrNone)
       
   240 		{
       
   241 		iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetIdentityServiceStatus, EFalse);	
       
   242 		User::RequestComplete(reqStatusPtr, leaveCode);
       
   243 		}
       
   244 	else if (rc != KErrNone)
       
   245 		{
       
   246 		if(rc != KErrInUse)	//this means request already pending, so do not reset
       
   247 			{
       
   248 			iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetIdentityServiceStatus, EFalse);
       
   249 			}
       
   250 		User::RequestComplete(reqStatusPtr, rc);
       
   251 		}
       
   252 	}
       
   253 
       
   254 TInt CTelephonyFunctions::GetIdentityServiceStatusL(TRequestStatus& aRequestStatus, const CTelephony::TIdentityService& aService, TDes8& aStatus)
       
   255 /**
       
   256 Initiate async request to retrieve the identity service status.
       
   257 */
       
   258 	{
       
   259 	if(IsRequestPending(EGetIdentityServiceStatus)!=EFalse)
       
   260 		{
       
   261 		return KErrInUse;
       
   262 		}
       
   263 	else
       
   264 		{
       
   265 		SetRequestPending(CTelephonyFunctions::EGetIdentityServiceStatus, ETrue);
       
   266 		}
       
   267 			
       
   268 	if(IsFlightModeOn())
       
   269 		{
       
   270 		return KErrAccessDenied;
       
   271 		}
       
   272 		
       
   273 	iReqStatusTable[EGetIdentityServiceStatus] = &aRequestStatus;
       
   274 	
       
   275 	if(!iGetIdentityServiceStatus)
       
   276 		iGetIdentityServiceStatus = CGetIdentityServiceStatusAct::NewL(this);
       
   277 
       
   278 	iGetIdentityServiceStatus->GetIdentityServiceStatus(aService, aStatus);	
       
   279 
       
   280 	return KErrNone;
       
   281 	}
       
   282