telephonyutils/etel3rdpartyapi/src/TelephonyFuncNetwork.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 "TelephonyActNetwork.h"
       
    28 
       
    29 TInt CTelephonyFunctions::GetNetworkRegistrationStatusL(TRequestStatus& aRequestStatus, TDes8& aDes)
       
    30 /**
       
    31 Initiate async request to retrieve the network registration status.
       
    32 */
       
    33 	{
       
    34 	if(IsRequestPending(EGetNetworkRegistrationStatus)!=EFalse)
       
    35 		{
       
    36 		return KErrInUse;
       
    37 		}
       
    38 	else
       
    39 		{
       
    40 		SetRequestPending(CTelephonyFunctions::EGetNetworkRegistrationStatus, ETrue);
       
    41 		}
       
    42 			
       
    43 	iReqStatusTable[EGetNetworkRegistrationStatus] = &aRequestStatus;
       
    44 	
       
    45 	if(!iGetNetworkRegistrationStatus)
       
    46 		{
       
    47 		iGetNetworkRegistrationStatus = CGetNetworkRegistrationStatusAct::NewL(this);
       
    48 		}
       
    49 		
       
    50 	iGetNetworkRegistrationStatus->GetNetworkRegistrationStatus(aDes);	
       
    51 	 
       
    52 	return KErrNone;
       
    53 	}
       
    54 	
       
    55 TInt CTelephonyFunctions::GetCurrentNetworkInfoL(TRequestStatus& aRequestStatus, TDes8& aDes)
       
    56 /**
       
    57 Initiate async request to retrieve current network information.
       
    58 */
       
    59 	{
       
    60 	if(IsRequestPending(EGetCurrentNetworkInfo)!=EFalse)
       
    61 		{
       
    62 		return KErrInUse;
       
    63 		}
       
    64 	else
       
    65 		{
       
    66 		SetRequestPending(CTelephonyFunctions::EGetCurrentNetworkInfo, ETrue);
       
    67 		}
       
    68 			
       
    69 	if(IsFlightModeOn())
       
    70 		{
       
    71 		return KErrAccessDenied;
       
    72 		}
       
    73 		
       
    74 	iReqStatusTable[EGetCurrentNetworkInfo] = &aRequestStatus;
       
    75 	
       
    76 	if(!iGetCurrentNetworkInfo)
       
    77 		{
       
    78 		iGetCurrentNetworkInfo = CGetCurrentNetworkInfoAct::NewL(this);
       
    79 		}
       
    80 		
       
    81 	iGetCurrentNetworkInfo->GetCurrentNetworkInfo(aDes);	
       
    82 	 
       
    83 	return KErrNone;
       
    84 	}
       
    85 
       
    86 /**
       
    87 Initiate async request to retrieve the ICC-stored current network name.
       
    88 
       
    89 This functionality is not available when the phone is in "flight" mode.
       
    90 
       
    91 @param aRequestStatus Returns the result code after the asynchronous call completes. 
       
    92                       KErrAccessDenied will be returned if the phone is in flight mode.
       
    93 
       
    94 @param aDes Contains a CTelephony::TNetworkNameV1Pckg, a packaged version of the
       
    95             CTelephony::TNetworkNameV1 class which is filled on completion.
       
    96 
       
    97 @capability None
       
    98 */
       
    99 TInt CTelephonyFunctions::GetCurrentNetworkNameL(TRequestStatus& aRequestStatus, TDes8& aDes)
       
   100 	{
       
   101 	if(IsRequestPending(EGetCurrentNetworkName)!=EFalse)
       
   102 		{
       
   103 		return KErrInUse;
       
   104 		}
       
   105 	else
       
   106 		{
       
   107 		SetRequestPending(CTelephonyFunctions::EGetCurrentNetworkName, ETrue);
       
   108 		}
       
   109 
       
   110 	if(IsFlightModeOn())
       
   111 		{
       
   112 		return KErrAccessDenied;
       
   113 		}
       
   114 
       
   115 	if(iTsyVersion == KNoMultimodeTsy || iTsyVersion == KETelExtMultimodeV1 || iTsyVersion == KETelExtMultimodeV2)	//GetCurrentNetworkName not suported in V1/V2 TSY
       
   116 		{
       
   117 		return KErrNotSupported;
       
   118 		}
       
   119 			
       
   120 	iReqStatusTable[EGetCurrentNetworkName] = &aRequestStatus;
       
   121 	
       
   122 	if(!iGetCurrentNetworkName)
       
   123 		{
       
   124 		iGetCurrentNetworkName = CGetCurrentNetworkNameAct::NewL(this);
       
   125 		}
       
   126 		
       
   127 	iGetCurrentNetworkName->GetCurrentNetworkName(aDes);	
       
   128 	 
       
   129 	return KErrNone;
       
   130 	}
       
   131 	
       
   132 EXPORT_C CTelephony::TOperatorNameV1::TOperatorNameV1()
       
   133 /**
       
   134 Default constructor.
       
   135 */
       
   136 	{
       
   137 	iVersionId=KEtelISVV1;
       
   138 	}
       
   139 
       
   140 /**
       
   141 Retrieve ICC stored information about the currently registered mobile network. 
       
   142 Upon successful completion the retrieved network name(s) is returned via the aOperator argument. 
       
   143 
       
   144 This functionality is not available when the phone is in "flight" mode.
       
   145 
       
   146 Cancellation of the request can be achieved by passing
       
   147 CTelephony::EGetOperatorNameCancel to the function CTelephony::CancelAsync().
       
   148 
       
   149 Note: This information is only available on GSM/WCDMA networks.
       
   150 
       
   151 @param aRequestStatus Returns the result code after the asynchronous call completes. 
       
   152                       KErrAccessDenied will be returned if the phone is in flight mode.
       
   153 
       
   154 @param aDes Contains a CTelephony::TOperatorNameV1Pckg, a packaged version
       
   155             of the CTelephony::TOperatorNameV1 class which is filled on completion.
       
   156 
       
   157 @capability None
       
   158 */
       
   159 EXPORT_C void CTelephony::GetOperatorName(TRequestStatus& aRequestStatus, TDes8& aDes) const
       
   160 	{
       
   161 	TRequestStatus* reqStatusPtr = &aRequestStatus;
       
   162 	
       
   163 	__ASSERT_ALWAYS(aRequestStatus != KRequestPending,
       
   164 		User::Panic(KTelephonyCategory, KTelephonyPanicIllegalReuse) );
       
   165 
       
   166 	aRequestStatus = KRequestPending;
       
   167 	TInt rc=KErrInUse;	
       
   168 		
       
   169 	TRAPD(leaveCode, rc=iTelephonyFunctions->GetOperatorNameL(aRequestStatus, aDes));
       
   170 
       
   171 	if(leaveCode != KErrNone)
       
   172 		{
       
   173 		iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetOperatorName, EFalse);	
       
   174 		User::RequestComplete(reqStatusPtr, leaveCode);
       
   175 		}
       
   176 	else if (rc != KErrNone)
       
   177 		{
       
   178 		if(rc != KErrInUse)	//this means request already pending, so do not reset
       
   179 			{
       
   180 			iTelephonyFunctions->SetRequestPending(CTelephonyFunctions::EGetOperatorName, EFalse);
       
   181 			}
       
   182 		User::RequestComplete(reqStatusPtr, rc);
       
   183 		}
       
   184 	}
       
   185 
       
   186 /**
       
   187 Initiate async request to retrieve the operator name.
       
   188 
       
   189 This functionality is not available when the phone is in "flight" mode.
       
   190 
       
   191 Note: This information is only available on GSM/WCDMA networks.
       
   192 
       
   193 @param aRequestStatus Returns the result code after the asynchronous call completes. 
       
   194                       KErrAccessDenied will be returned if the phone is in flight mode.
       
   195 
       
   196 @param aDes Contains a CTelephony::TOperatorNameV1Pckg, a packaged version
       
   197             of the CTelephony::TOperatorNameV1 class which is filled on completion.
       
   198 
       
   199 @capability None
       
   200 */
       
   201 TInt CTelephonyFunctions::GetOperatorNameL(TRequestStatus& aRequestStatus, TDes8& aDes)
       
   202 	{
       
   203 	if(IsRequestPending(EGetOperatorName)!=EFalse)
       
   204 		{
       
   205 		return KErrInUse;
       
   206 		}
       
   207 	else
       
   208 		{
       
   209 		SetRequestPending(CTelephonyFunctions::EGetOperatorName, ETrue);
       
   210 		}
       
   211 
       
   212 	if(IsFlightModeOn())
       
   213 		{
       
   214 		return KErrAccessDenied;
       
   215 		}
       
   216 
       
   217 	if(iTsyVersion == KNoMultimodeTsy || iTsyVersion == KETelExtMultimodeV1)	//GetOperatorName not suported in V1 TSY
       
   218 		{
       
   219 		return KErrNotSupported;
       
   220 		}
       
   221 			
       
   222 	iReqStatusTable[EGetOperatorName] = &aRequestStatus;
       
   223 	
       
   224 	if(!iGetOperatorName)
       
   225 		{
       
   226 		iGetOperatorName = CGetOperatorNameAct::NewL(this);
       
   227 		}
       
   228 		
       
   229 	iGetOperatorName->GetOperatorName(aDes);	
       
   230 	 
       
   231 	return KErrNone;
       
   232 	}