telephonyutils/etel3rdpartyapi/src/TelephonyActNetwork.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 TelephonyActNetwork class, used by CTelephonyFunctions class.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #include "TelephonyFunctions.h" 
       
    26 #include "TelephonyActNetwork.h"
       
    27 
       
    28 
       
    29 CGetNetworkRegistrationStatusAct* CGetNetworkRegistrationStatusAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
    30 /**
       
    31 Public constructor which can Leave().
       
    32 
       
    33 @param	aTelephonyFunctions Object that constructs us.
       
    34 @leave	Leaves if no memory.
       
    35 */
       
    36 	{
       
    37 	CGetNetworkRegistrationStatusAct* self = new(ELeave) CGetNetworkRegistrationStatusAct(aTelephonyFunctions);
       
    38 	CActiveScheduler::Add(self);
       
    39 	return self;
       
    40 	}
       
    41 
       
    42 CGetNetworkRegistrationStatusAct::~CGetNetworkRegistrationStatusAct()
       
    43 /**
       
    44 Destructor
       
    45 */
       
    46 	{
       
    47 	Cancel();
       
    48 	Complete();
       
    49 	}
       
    50 
       
    51 void CGetNetworkRegistrationStatusAct::GetNetworkRegistrationStatus(TDes8& aId)
       
    52 /**
       
    53 Issue Request
       
    54 */
       
    55 	{
       
    56 	iISVNetworkRegistration = reinterpret_cast<CTelephony::TNetworkRegistrationV1*> ( const_cast<TUint8*> (aId.Ptr()) );
       
    57 	iTelephonyFunctions->Phone()->GetNetworkRegistrationStatus(iStatus, iMMNetworkRegistration);
       
    58 	SetActive();
       
    59 	}
       
    60 
       
    61 void CGetNetworkRegistrationStatusAct::Complete()
       
    62 /**
       
    63 Service Completed request.
       
    64 */
       
    65 	{
       
    66 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::EGetNetworkRegistrationStatus))
       
    67 		{
       
    68 		if(iStatus==KErrNone)
       
    69 			{
       
    70 			GetRegistrationStatus(iMMNetworkRegistration, iISVNetworkRegistration->iRegStatus);
       
    71 			}
       
    72 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetNetworkRegistrationStatus, iStatus.Int());	
       
    73 		}
       
    74 	}
       
    75 	
       
    76 void CGetNetworkRegistrationStatusAct::GetRegistrationStatus(const RMobilePhone::TMobilePhoneRegistrationStatus aMMRegStatus, CTelephony::TRegistrationStatus& aTelRegStatus)
       
    77 	{
       
    78 	switch(aMMRegStatus)
       
    79 		{
       
    80 		case RMobilePhone::ERegistrationUnknown:  
       
    81 			aTelRegStatus=CTelephony::ERegistrationUnknown;
       
    82 			break;
       
    83 		case RMobilePhone::ENotRegisteredNoService:
       
    84 			aTelRegStatus=CTelephony::ENotRegisteredNoService;
       
    85 			break;
       
    86 		case RMobilePhone::ENotRegisteredEmergencyOnly:
       
    87 			aTelRegStatus=CTelephony::ENotRegisteredEmergencyOnly;
       
    88 			break;
       
    89 		case RMobilePhone::ENotRegisteredSearching:
       
    90 			aTelRegStatus=CTelephony::ENotRegisteredSearching;
       
    91 			break;			
       
    92 		case RMobilePhone::ERegisteredBusy:
       
    93 			aTelRegStatus=CTelephony::ERegisteredBusy;
       
    94 			break;
       
    95 		case RMobilePhone::ERegisteredOnHomeNetwork:
       
    96 			aTelRegStatus=CTelephony::ERegisteredOnHomeNetwork;
       
    97 			break;
       
    98 		case RMobilePhone::ERegistrationDenied:
       
    99 			aTelRegStatus=CTelephony::ERegistrationDenied;
       
   100 			break;
       
   101 		case RMobilePhone::ERegisteredRoaming:
       
   102 			aTelRegStatus=CTelephony::ERegisteredRoaming;
       
   103 			break;
       
   104 		default:
       
   105 			aTelRegStatus=CTelephony::ERegistrationUnknown;
       
   106 		}
       
   107 	}
       
   108 
       
   109 TInt CGetNetworkRegistrationStatusAct::RunError(TInt aLeaveCode)
       
   110 /**
       
   111 Handle any Leave() from inside RunL().
       
   112 
       
   113 @param	aLeaveCode	passed in if RunL Leaves.
       
   114 @return	KErrNone.
       
   115 */
       
   116 	{
       
   117 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetNetworkRegistrationStatus, aLeaveCode);
       
   118 	return KErrNone;	// to ActiveScheduler.
       
   119 	}
       
   120 
       
   121 void CGetNetworkRegistrationStatusAct::DoCancel()
       
   122 /**
       
   123 Cancel request.
       
   124 
       
   125 Async request to dial is cancelled.
       
   126 */
       
   127 	{
       
   128 	iTelephonyFunctions->Phone()->CancelAsyncRequest(EMobilePhoneGetNetworkRegistrationStatus);
       
   129 	}
       
   130 
       
   131 
       
   132 CGetNetworkRegistrationStatusAct::CGetNetworkRegistrationStatusAct(CTelephonyFunctions* aTelephonyFunctions)
       
   133 : CAsyncRequestBaseAct(),
       
   134   iTelephonyFunctions(aTelephonyFunctions)
       
   135 /**
       
   136 First-phase constructor which cannot Leave().
       
   137 
       
   138 @param	aTelephonyFunctions Object that constructs us.
       
   139 */
       
   140 	{
       
   141 	}
       
   142 	
       
   143 
       
   144 CGetCurrentNetworkInfoAct* CGetCurrentNetworkInfoAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
   145 /**
       
   146 Public constructor which can Leave().
       
   147 
       
   148 @param	aTelephonyFunctions Object that constructs us.
       
   149 @leave	Leaves if no memory.
       
   150 */
       
   151 	{
       
   152 	CGetCurrentNetworkInfoAct* self = new(ELeave) CGetCurrentNetworkInfoAct(aTelephonyFunctions);
       
   153 	CActiveScheduler::Add(self);
       
   154 	return self;
       
   155 	}
       
   156 
       
   157 CGetCurrentNetworkInfoAct::~CGetCurrentNetworkInfoAct()
       
   158 /**
       
   159 Destructor
       
   160 */
       
   161 	{
       
   162 	Cancel();
       
   163 	Complete();
       
   164 	}
       
   165 
       
   166 void CGetCurrentNetworkInfoAct::GetCurrentNetworkInfo(TDes8& aPckg)
       
   167 /**
       
   168 Issue Request
       
   169 */
       
   170 	{
       
   171 	iISVNetworkInfo = reinterpret_cast<CTelephony::TEtelISVType*> ( const_cast<TUint8*> (aPckg.Ptr()) );
       
   172 
       
   173 	iPostedIPC = EMobilePhoneGetCurrentNetwork;
       
   174 	iTelephonyFunctions->Phone()->GetCurrentNetwork(iStatus, iMMNetworkInfoPckg, iMMArea);
       
   175 
       
   176 	SetActive();
       
   177 	}
       
   178 
       
   179 
       
   180 void CGetCurrentNetworkInfoAct::Complete()
       
   181 /**
       
   182 Service Completed request.
       
   183 */
       
   184 	{
       
   185 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::EGetCurrentNetworkInfo))
       
   186 		{
       
   187 		if(iStatus==KErrNone)
       
   188 			{
       
   189 			MapNetworkInfo(iISVNetworkInfo, &iMMNetworkInfo, &iMMArea);
       
   190 			}
       
   191 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetCurrentNetworkInfo, iStatus.Int());		
       
   192 		}
       
   193 	}
       
   194 
       
   195 
       
   196 TInt CGetCurrentNetworkInfoAct::RunError(TInt aLeaveCode)
       
   197 /**
       
   198 Handle any Leave() from inside RunL().
       
   199 
       
   200 @param	aLeaveCode	passed in if RunL Leaves.
       
   201 @return	KErrNone.
       
   202 */
       
   203 	{
       
   204 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetCurrentNetworkInfo, aLeaveCode);
       
   205 	return KErrNone;	// to ActiveScheduler.
       
   206 	}
       
   207 
       
   208 void CGetCurrentNetworkInfoAct::DoCancel()
       
   209 /**
       
   210 Cancel request.
       
   211 
       
   212 Async request to dial is cancelled.
       
   213 */
       
   214 	{
       
   215 	iTelephonyFunctions->Phone()->CancelAsyncRequest(iPostedIPC);
       
   216 	}
       
   217 
       
   218 	
       
   219 /**
       
   220 Map RMobilePhone::TMobilePhoneNetworkInfoV2 to CTelephony::TEtelISVType
       
   221 */
       
   222 void CGetCurrentNetworkInfoAct::MapNetworkInfo(CTelephony::TEtelISVType* aISVNetworkInfo, RMobilePhone::TMobilePhoneNetworkInfoV2* aMMNetworkInfo, RMobilePhone::TMobilePhoneLocationAreaV1* aMMArea)
       
   223 	{
       
   224 	switch (aISVNetworkInfo->VersionId())
       
   225 		{
       
   226 	case CTelephony::KEtelISVV1:
       
   227 		{
       
   228 		CTelephony::TNetworkInfoV1* tempInfo = reinterpret_cast<CTelephony::TNetworkInfoV1*>(aISVNetworkInfo);
       
   229 		switch(aMMNetworkInfo->iMode)
       
   230 			{
       
   231 			case RMobilePhone::ENetworkModeUnknown: 
       
   232 				tempInfo->iMode=CTelephony::ENetworkModeUnknown;
       
   233 				break;
       
   234 			case RMobilePhone::ENetworkModeUnregistered:
       
   235 				tempInfo->iMode=CTelephony::ENetworkModeUnregistered;
       
   236 				break;
       
   237 			case RMobilePhone::ENetworkModeGsm:
       
   238 				tempInfo->iMode=CTelephony::ENetworkModeGsm;
       
   239 				break;
       
   240 			case RMobilePhone::ENetworkModeAmps:
       
   241 				tempInfo->iMode=CTelephony::ENetworkModeAmps;
       
   242 				break;			
       
   243 			case RMobilePhone::ENetworkModeCdma95:
       
   244 				tempInfo->iMode=CTelephony::ENetworkModeCdma95;
       
   245 				break;
       
   246 			case RMobilePhone::ENetworkModeCdma2000:
       
   247 				tempInfo->iMode=CTelephony::ENetworkModeCdma2000;
       
   248 				break;
       
   249 			case RMobilePhone::ENetworkModeWcdma:
       
   250 				tempInfo->iMode=CTelephony::ENetworkModeWcdma;
       
   251 				break;
       
   252 			case RMobilePhone::ENetworkModeTdcdma:
       
   253 				tempInfo->iMode=CTelephony::ENetworkModeTdcdma;
       
   254 				break;
       
   255 			default:
       
   256 				tempInfo->iMode=CTelephony::ENetworkModeUnknown;
       
   257 			}	
       
   258 
       
   259 		switch(aMMNetworkInfo->iStatus)
       
   260 			{
       
   261 			case RMobilePhone::ENetworkStatusUnknown: 
       
   262 				tempInfo->iStatus=CTelephony::ENetworkStatusUnknown;
       
   263 				break;
       
   264 			case RMobilePhone::ENetworkStatusAvailable:
       
   265 				tempInfo->iStatus=CTelephony::ENetworkStatusAvailable;
       
   266 				break;
       
   267 			case RMobilePhone::ENetworkStatusCurrent:
       
   268 				tempInfo->iStatus=CTelephony::ENetworkStatusCurrent;
       
   269 				break;
       
   270 			case RMobilePhone::ENetworkStatusForbidden:
       
   271 				tempInfo->iStatus=CTelephony::ENetworkStatusForbidden;
       
   272 				break;			
       
   273 			default:
       
   274 				tempInfo->iStatus=CTelephony::ENetworkStatusUnknown;
       
   275 			}	
       
   276 				
       
   277 		switch(aMMNetworkInfo->iBandInfo)
       
   278 			{
       
   279 			case RMobilePhone::EBandUnknown: 
       
   280 				tempInfo->iBandInfo=CTelephony::EBandUnknown;
       
   281 				break;
       
   282 			case RMobilePhone::E800BandA:
       
   283 				tempInfo->iBandInfo=CTelephony::E800BandA;
       
   284 				break;
       
   285 			case RMobilePhone::E800BandB:
       
   286 				tempInfo->iBandInfo=CTelephony::E800BandB;
       
   287 				break;
       
   288 			case RMobilePhone::E800BandC:
       
   289 				tempInfo->iBandInfo=CTelephony::E800BandC;
       
   290 				break;			
       
   291 			case RMobilePhone::E1900BandA:
       
   292 				tempInfo->iBandInfo=CTelephony::E1900BandA;
       
   293 				break;
       
   294 			case RMobilePhone::E1900BandB:
       
   295 				tempInfo->iBandInfo=CTelephony::E1900BandB;
       
   296 				break;
       
   297 			case RMobilePhone::E1900BandC:
       
   298 				tempInfo->iBandInfo=CTelephony::E1900BandC;
       
   299 				break;
       
   300 			case RMobilePhone::E1900BandD:
       
   301 				tempInfo->iBandInfo=CTelephony::E1900BandD;
       
   302 				break;
       
   303 			case RMobilePhone::E1900BandE:
       
   304 				tempInfo->iBandInfo=CTelephony::E1900BandE;
       
   305 				break;
       
   306 			case RMobilePhone::E1900BandF:
       
   307 				tempInfo->iBandInfo=CTelephony::E1900BandF;
       
   308 				break;
       
   309 			default:
       
   310 				tempInfo->iBandInfo=CTelephony::EBandUnknown;
       
   311 			}			
       
   312 		
       
   313 		tempInfo->iCountryCode.Copy(aMMNetworkInfo->iCountryCode);
       
   314 		tempInfo->iNetworkId.Copy(aMMNetworkInfo->iNetworkId);
       
   315 		tempInfo->iDisplayTag.Copy(aMMNetworkInfo->iDisplayTag);
       
   316 		
       
   317 		TInt maxLength = tempInfo->iShortName.MaxLength();
       
   318 		if (aMMNetworkInfo->iShortName.Length() > maxLength)
       
   319 			{
       
   320 			tempInfo->iShortName.Copy(aMMNetworkInfo->iShortName.Ptr(), maxLength);
       
   321 			}
       
   322 		else
       
   323 			{
       
   324 			tempInfo->iShortName.Copy(aMMNetworkInfo->iShortName);		
       
   325 			}
       
   326 		
       
   327 		maxLength = tempInfo->iLongName.MaxLength();
       
   328 
       
   329 		if (aMMNetworkInfo->iLongName.Length() > maxLength)
       
   330 			{
       
   331 			tempInfo->iLongName.Copy(aMMNetworkInfo->iLongName.Ptr(), maxLength);
       
   332 			}
       
   333 		else
       
   334 			{
       
   335 			tempInfo->iLongName.Copy(aMMNetworkInfo->iLongName);	
       
   336 			}
       
   337 		
       
   338 		tempInfo->iCdmaSID.Copy(aMMNetworkInfo->iCdmaSID);
       
   339 		
       
   340 		if(aMMArea)
       
   341 			{
       
   342 			tempInfo->iAreaKnown=aMMArea->iAreaKnown;
       
   343 			tempInfo->iLocationAreaCode=aMMArea->iLocationAreaCode;
       
   344 			tempInfo->iCellId=aMMArea->iCellId;	
       
   345 			}
       
   346 		else
       
   347 			{
       
   348 			tempInfo->iAreaKnown=EFalse;
       
   349 			tempInfo->iLocationAreaCode=0;
       
   350 			tempInfo->iCellId=0;	
       
   351 			}
       
   352 		
       
   353 		//check which paramater class version this is.		
       
   354 		switch(aMMNetworkInfo->iAccess)
       
   355 			{
       
   356 			case RMobilePhone::ENetworkAccessUnknown: 
       
   357 				tempInfo->iAccess=CTelephony::ENetworkAccessUnknown;
       
   358 				break;
       
   359 			case RMobilePhone::ENetworkAccessGsm:
       
   360 				tempInfo->iAccess=CTelephony::ENetworkAccessGsm;
       
   361 				break;
       
   362 			case RMobilePhone::ENetworkAccessGsmCompact:
       
   363 				tempInfo->iAccess=CTelephony::ENetworkAccessGsmCompact;
       
   364 				break;
       
   365 			case RMobilePhone::ENetworkAccessUtran:
       
   366 				tempInfo->iAccess=CTelephony::ENetworkAccessUtran;
       
   367 				break;			
       
   368 			default:
       
   369 				tempInfo->iAccess=CTelephony::ENetworkAccessUnknown;
       
   370 			}						
       
   371 			
       
   372 		}
       
   373 		break;
       
   374 	case CTelephony::KEtelISVV2:
       
   375 		{
       
   376 		CTelephony::TNetworkInfoV2* tempInfo = reinterpret_cast<CTelephony::TNetworkInfoV2*>(aISVNetworkInfo);
       
   377 		switch(aMMNetworkInfo->iMode)
       
   378 			{
       
   379 			case RMobilePhone::ENetworkModeUnknown: 
       
   380 				tempInfo->iMode=CTelephony::ENetworkModeUnknown;
       
   381 				break;
       
   382 			case RMobilePhone::ENetworkModeUnregistered:
       
   383 				tempInfo->iMode=CTelephony::ENetworkModeUnregistered;
       
   384 				break;
       
   385 			case RMobilePhone::ENetworkModeGsm:
       
   386 				tempInfo->iMode=CTelephony::ENetworkModeGsm;
       
   387 				break;
       
   388 			case RMobilePhone::ENetworkModeAmps:
       
   389 				tempInfo->iMode=CTelephony::ENetworkModeAmps;
       
   390 				break;			
       
   391 			case RMobilePhone::ENetworkModeCdma95:
       
   392 				tempInfo->iMode=CTelephony::ENetworkModeCdma95;
       
   393 				break;
       
   394 			case RMobilePhone::ENetworkModeCdma2000:
       
   395 				tempInfo->iMode=CTelephony::ENetworkModeCdma2000;
       
   396 				break;
       
   397 			case RMobilePhone::ENetworkModeWcdma:
       
   398 				tempInfo->iMode=CTelephony::ENetworkModeWcdma;
       
   399 				break;
       
   400 			case RMobilePhone::ENetworkModeTdcdma:
       
   401 				tempInfo->iMode=CTelephony::ENetworkModeTdcdma;
       
   402 				break;
       
   403 			default:
       
   404 				tempInfo->iMode=CTelephony::ENetworkModeUnknown;
       
   405 			}	
       
   406 
       
   407 		switch(aMMNetworkInfo->iStatus)
       
   408 			{
       
   409 			case RMobilePhone::ENetworkStatusUnknown: 
       
   410 				tempInfo->iStatus=CTelephony::ENetworkStatusUnknown;
       
   411 				break;
       
   412 			case RMobilePhone::ENetworkStatusAvailable:
       
   413 				tempInfo->iStatus=CTelephony::ENetworkStatusAvailable;
       
   414 				break;
       
   415 			case RMobilePhone::ENetworkStatusCurrent:
       
   416 				tempInfo->iStatus=CTelephony::ENetworkStatusCurrent;
       
   417 				break;
       
   418 			case RMobilePhone::ENetworkStatusForbidden:
       
   419 				tempInfo->iStatus=CTelephony::ENetworkStatusForbidden;
       
   420 				break;			
       
   421 			default:
       
   422 				tempInfo->iStatus=CTelephony::ENetworkStatusUnknown;
       
   423 			}	
       
   424 				
       
   425 		switch(aMMNetworkInfo->iBandInfo)
       
   426 			{
       
   427 			case RMobilePhone::EBandUnknown: 
       
   428 				tempInfo->iBandInfo=CTelephony::EBandUnknown;
       
   429 				break;
       
   430 			case RMobilePhone::E800BandA:
       
   431 				tempInfo->iBandInfo=CTelephony::E800BandA;
       
   432 				break;
       
   433 			case RMobilePhone::E800BandB:
       
   434 				tempInfo->iBandInfo=CTelephony::E800BandB;
       
   435 				break;
       
   436 			case RMobilePhone::E800BandC:
       
   437 				tempInfo->iBandInfo=CTelephony::E800BandC;
       
   438 				break;			
       
   439 			case RMobilePhone::E1900BandA:
       
   440 				tempInfo->iBandInfo=CTelephony::E1900BandA;
       
   441 				break;
       
   442 			case RMobilePhone::E1900BandB:
       
   443 				tempInfo->iBandInfo=CTelephony::E1900BandB;
       
   444 				break;
       
   445 			case RMobilePhone::E1900BandC:
       
   446 				tempInfo->iBandInfo=CTelephony::E1900BandC;
       
   447 				break;
       
   448 			case RMobilePhone::E1900BandD:
       
   449 				tempInfo->iBandInfo=CTelephony::E1900BandD;
       
   450 				break;
       
   451 			case RMobilePhone::E1900BandE:
       
   452 				tempInfo->iBandInfo=CTelephony::E1900BandE;
       
   453 				break;
       
   454 			case RMobilePhone::E1900BandF:
       
   455 				tempInfo->iBandInfo=CTelephony::E1900BandF;
       
   456 				break;
       
   457 			default:
       
   458 				tempInfo->iBandInfo=CTelephony::EBandUnknown;
       
   459 			}			
       
   460 		
       
   461 		tempInfo->iCountryCode.Copy(aMMNetworkInfo->iCountryCode);
       
   462 		tempInfo->iNetworkId.Copy(aMMNetworkInfo->iNetworkId);
       
   463 		tempInfo->iDisplayTag.Copy(aMMNetworkInfo->iDisplayTag);
       
   464 		
       
   465 		TInt maxLength = tempInfo->iShortName.MaxLength();
       
   466 		if (aMMNetworkInfo->iShortName.Length() > maxLength)
       
   467 			{
       
   468 			tempInfo->iShortName.Copy(aMMNetworkInfo->iShortName.Ptr(), maxLength);
       
   469 			}
       
   470 		else
       
   471 			{
       
   472 			tempInfo->iShortName.Copy(aMMNetworkInfo->iShortName);		
       
   473 			}
       
   474 		
       
   475 		maxLength = tempInfo->iLongName.MaxLength();
       
   476 		if (aMMNetworkInfo->iLongName.Length() > maxLength)
       
   477 			{
       
   478 			tempInfo->iLongName.Copy(aMMNetworkInfo->iLongName.Ptr(), maxLength);
       
   479 			}
       
   480 		else
       
   481 			{
       
   482 			tempInfo->iLongName.Copy(aMMNetworkInfo->iLongName);	
       
   483 			}
       
   484 		
       
   485 		tempInfo->iCdmaSID.Copy(aMMNetworkInfo->iCdmaSID);
       
   486 		
       
   487 		if(aMMArea)
       
   488 			{
       
   489 			tempInfo->iAreaKnown=aMMArea->iAreaKnown;
       
   490 			tempInfo->iLocationAreaCode=aMMArea->iLocationAreaCode;
       
   491 			tempInfo->iCellId=aMMArea->iCellId;	
       
   492 			}
       
   493 		else
       
   494 			{
       
   495 			tempInfo->iAreaKnown=EFalse;
       
   496 			tempInfo->iLocationAreaCode=0;
       
   497 			tempInfo->iCellId=0;	
       
   498 			}
       
   499 		
       
   500 		//check which paramater class version this is.		
       
   501 		switch(aMMNetworkInfo->iAccess)
       
   502 			{
       
   503 			case RMobilePhone::ENetworkAccessUnknown: 
       
   504 				tempInfo->iAccess=CTelephony::ENetworkAccessUnknown;
       
   505 				break;
       
   506 			case RMobilePhone::ENetworkAccessGsm:
       
   507 				tempInfo->iAccess=CTelephony::ENetworkAccessGsm;
       
   508 				break;
       
   509 			case RMobilePhone::ENetworkAccessGsmCompact:
       
   510 				tempInfo->iAccess=CTelephony::ENetworkAccessGsmCompact;
       
   511 				break;
       
   512 			case RMobilePhone::ENetworkAccessUtran:
       
   513 				tempInfo->iAccess=CTelephony::ENetworkAccessUtran;
       
   514 				break;			
       
   515 			default:
       
   516 				tempInfo->iAccess=CTelephony::ENetworkAccessUnknown;
       
   517 			}		
       
   518 		}
       
   519 		break;
       
   520 		}
       
   521 	}
       
   522 
       
   523 CGetCurrentNetworkInfoAct::CGetCurrentNetworkInfoAct(CTelephonyFunctions* aTelephonyFunctions)
       
   524 : CAsyncRequestBaseAct(),
       
   525   iTelephonyFunctions(aTelephonyFunctions),
       
   526   iMMNetworkInfoPckg(iMMNetworkInfo)
       
   527 /**
       
   528 First-phase constructor which cannot Leave().
       
   529 
       
   530 @param	aTelephonyFunctions Object that constructs us.
       
   531 */
       
   532 	{
       
   533 	}
       
   534 
       
   535 
       
   536 CGetCurrentNetworkNameAct* CGetCurrentNetworkNameAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
   537 /**
       
   538 Public constructor which can Leave().
       
   539 
       
   540 @param	aTelephonyFunctions Object that constructs us.
       
   541 @leave	Leaves if no memory.
       
   542 */
       
   543 	{
       
   544 	CGetCurrentNetworkNameAct* self = new(ELeave) CGetCurrentNetworkNameAct(aTelephonyFunctions);
       
   545 	CActiveScheduler::Add(self);
       
   546 	return self;
       
   547 	}
       
   548 	
       
   549 CGetCurrentNetworkNameAct::~CGetCurrentNetworkNameAct()
       
   550 /**
       
   551 Destructor
       
   552 */
       
   553 	{
       
   554 	Cancel();
       
   555 	Complete();
       
   556 	}
       
   557 
       
   558 void CGetCurrentNetworkNameAct::GetCurrentNetworkName(TDes8& aPckg)
       
   559 /**
       
   560 Issue Request
       
   561 */
       
   562 	{
       
   563 	iISVCurrentNetworkName = reinterpret_cast<CTelephony::TEtelISVType*> ( const_cast<TUint8*> (aPckg.Ptr()) );
       
   564 
       
   565 	iTelephonyFunctions->Phone()->GetCurrentNetworkName(iStatus, iMMNetworkNameV3Pckg, iLocInfoPckg);
       
   566 	SetActive();
       
   567 	}
       
   568 
       
   569 void CGetCurrentNetworkNameAct::Complete()
       
   570 /**
       
   571 Service Completed request.
       
   572 */
       
   573 	{
       
   574 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::EGetCurrentNetworkName))
       
   575 		{
       
   576 		if(iStatus==KErrNone)
       
   577 			{
       
   578 			switch(iISVCurrentNetworkName->VersionId())
       
   579 				{
       
   580 			case CTelephony::KEtelISVV1:
       
   581 				{
       
   582 				CTelephony::TNetworkNameV1* tempNetName = reinterpret_cast<CTelephony::TNetworkNameV1*>(iISVCurrentNetworkName);
       
   583 				TInt maxLength = tempNetName->iNetworkName.MaxLength();
       
   584 				if (iMMNetworkNameV3.iLongName.Length() > maxLength)
       
   585 					{
       
   586 					tempNetName->iNetworkName.Copy(iMMNetworkNameV3.iLongName.Ptr(), maxLength);
       
   587 					}
       
   588 				else
       
   589 					{
       
   590 					tempNetName->iNetworkName.Copy(iMMNetworkNameV3.iLongName);		
       
   591 					}
       
   592 				}
       
   593 				break;
       
   594 			case CTelephony::KEtelISVV2:
       
   595 				{
       
   596 				CTelephony::TNetworkNameV2* tempNetName = reinterpret_cast<CTelephony::TNetworkNameV2*>(iISVCurrentNetworkName);
       
   597 				TInt maxLength = tempNetName->iNetworkName.MaxLength();
       
   598 				if (iMMNetworkNameV3.iLongName.Length() > maxLength)
       
   599 					{
       
   600 					tempNetName->iNetworkName.Copy(iMMNetworkNameV3.iLongName.Ptr(), maxLength);
       
   601 					}
       
   602 				else
       
   603 					{
       
   604 					tempNetName->iNetworkName.Copy(iMMNetworkNameV3.iLongName);		
       
   605 					}	
       
   606 				}
       
   607 				break;
       
   608 				}
       
   609 
       
   610 			}
       
   611 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetCurrentNetworkName, iStatus.Int());
       
   612 		}
       
   613 	}
       
   614 
       
   615 
       
   616 TInt CGetCurrentNetworkNameAct::RunError(TInt aLeaveCode)
       
   617 /**
       
   618 Handle any Leave() from inside RunL().
       
   619 
       
   620 @param	aLeaveCode	passed in if RunL Leaves.
       
   621 @return	KErrNone.
       
   622 */
       
   623 	{
       
   624 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetCurrentNetworkName, aLeaveCode);
       
   625 	return KErrNone;	// to ActiveScheduler.
       
   626 	}
       
   627 
       
   628 void CGetCurrentNetworkNameAct::DoCancel()
       
   629 /**
       
   630 Cancel request.
       
   631 
       
   632 Async request to dial is cancelled.
       
   633 */
       
   634 	{
       
   635 	iTelephonyFunctions->Phone()->CancelAsyncRequest(EMobilePhoneGetNetworkName);
       
   636 	}
       
   637 
       
   638 
       
   639 CGetCurrentNetworkNameAct::CGetCurrentNetworkNameAct(CTelephonyFunctions* aTelephonyFunctions)
       
   640 : CAsyncRequestBaseAct(),
       
   641   iTelephonyFunctions(aTelephonyFunctions),
       
   642   iMMNetworkNameV3Pckg(iMMNetworkNameV3),
       
   643   iLocInfoPckg(iLocInfo)
       
   644 /**
       
   645 First-phase constructor which cannot Leave().
       
   646 
       
   647 @param	aTelephonyFunctions Object that constructs us.
       
   648 */
       
   649 	{
       
   650 	}
       
   651 
       
   652 
       
   653 CGetOperatorNameAct* CGetOperatorNameAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
   654 /**
       
   655 Public constructor which can Leave().
       
   656 
       
   657 @param	aTelephonyFunctions Object that constructs us.
       
   658 @leave	Leaves if no memory.
       
   659 */
       
   660 	{
       
   661 	CGetOperatorNameAct* self = new(ELeave) CGetOperatorNameAct(aTelephonyFunctions);
       
   662 	CActiveScheduler::Add(self);
       
   663 	return self;
       
   664 	}
       
   665 	
       
   666 CGetOperatorNameAct::~CGetOperatorNameAct()
       
   667 /**
       
   668 Destructor
       
   669 */
       
   670 	{
       
   671 	Cancel();
       
   672 	Complete();
       
   673 	}
       
   674 
       
   675 void CGetOperatorNameAct::GetOperatorName(TDes8& aId)
       
   676 /**
       
   677 Issue Request
       
   678 */
       
   679 	{
       
   680 	iISVOperatorName = reinterpret_cast<CTelephony::TOperatorNameV1*> ( const_cast<TUint8*> (aId.Ptr()) );
       
   681 	iTelephonyFunctions->Phone()->GetServiceProviderName(iStatus, iMMServiceProviderNamePckg);
       
   682 	SetActive();
       
   683 	}
       
   684 
       
   685 void CGetOperatorNameAct::Complete()
       
   686 /**
       
   687 Service Completed request.
       
   688 */
       
   689 	{
       
   690 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::EGetOperatorName))
       
   691 		{
       
   692 		if(iStatus==KErrNone)
       
   693 			{
       
   694 			TInt maxLength = iISVOperatorName->iOperatorName.MaxLength();
       
   695 			if (iMMServiceProviderName.iSPName.Length() > maxLength)
       
   696 				{
       
   697 				iISVOperatorName->iOperatorName.Copy(iMMServiceProviderName.iSPName.Ptr(), maxLength);
       
   698 				}
       
   699 			else
       
   700 				{
       
   701 				iISVOperatorName->iOperatorName.Copy(iMMServiceProviderName.iSPName);
       
   702 				}
       
   703 			}
       
   704 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetOperatorName, iStatus.Int());
       
   705 		}
       
   706 	}
       
   707 
       
   708 
       
   709 TInt CGetOperatorNameAct::RunError(TInt aLeaveCode)
       
   710 /**
       
   711 Handle any Leave() from inside RunL().
       
   712 
       
   713 @param	aLeaveCode	passed in if RunL Leaves.
       
   714 @return	KErrNone.
       
   715 */
       
   716 	{
       
   717 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::EGetOperatorName, aLeaveCode);
       
   718 	return KErrNone;	// to ActiveScheduler.
       
   719 	}
       
   720 
       
   721 void CGetOperatorNameAct::DoCancel()
       
   722 /**
       
   723 Cancel request.
       
   724 
       
   725 Async request to dial is cancelled.
       
   726 */
       
   727 	{
       
   728 	iTelephonyFunctions->Phone()->CancelAsyncRequest(EMobilePhoneGetServiceProviderName);
       
   729 	}
       
   730 
       
   731 
       
   732 CGetOperatorNameAct::CGetOperatorNameAct(CTelephonyFunctions* aTelephonyFunctions)
       
   733 : CAsyncRequestBaseAct(),
       
   734   iTelephonyFunctions(aTelephonyFunctions),
       
   735   iMMServiceProviderNamePckg(iMMServiceProviderName)
       
   736 /**
       
   737 First-phase constructor which cannot Leave().
       
   738 
       
   739 @param	aTelephonyFunctions Object that constructs us.
       
   740 */
       
   741 	{
       
   742 	}
       
   743 
       
   744 
       
   745 
       
   746 CNotifyNetworkRegistrationStatusAct* CNotifyNetworkRegistrationStatusAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
   747 /**
       
   748 Public constructor which can Leave().
       
   749 
       
   750 @param	aTelephonyFunctions Object that constructs us.
       
   751 @leave	Leaves if no memory.
       
   752 */
       
   753 	{
       
   754 	CNotifyNetworkRegistrationStatusAct* self = new(ELeave) CNotifyNetworkRegistrationStatusAct(aTelephonyFunctions);
       
   755 	CActiveScheduler::Add(self);
       
   756 	return self;
       
   757 	}
       
   758 
       
   759 CNotifyNetworkRegistrationStatusAct::~CNotifyNetworkRegistrationStatusAct()
       
   760 /**
       
   761 Destructor
       
   762 */
       
   763 	{
       
   764 	Cancel();
       
   765 	Complete();
       
   766 	}
       
   767 
       
   768 void CNotifyNetworkRegistrationStatusAct::NotifyNetworkRegistrationStatus(TDes8& aId)
       
   769 /**
       
   770 Issue Request
       
   771 */
       
   772 	{
       
   773 	iISVNetworkRegistration = reinterpret_cast<CTelephony::TNetworkRegistrationV1*> ( const_cast<TUint8*> (aId.Ptr()) );
       
   774 	iTelephonyFunctions->Phone()->NotifyNetworkRegistrationStatusChange(iStatus, iMMNetworkRegistration);
       
   775 	SetActive();
       
   776 	}
       
   777 
       
   778 void CNotifyNetworkRegistrationStatusAct::Complete()
       
   779 /**
       
   780 Service Completed request.
       
   781 */
       
   782 	{
       
   783 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::ENotifyNetworkRegistrationStatus))
       
   784 		{
       
   785 		if(iStatus==KErrNone)
       
   786 			{
       
   787 			CGetNetworkRegistrationStatusAct::GetRegistrationStatus(iMMNetworkRegistration, iISVNetworkRegistration->iRegStatus);
       
   788 			}
       
   789 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::ENotifyNetworkRegistrationStatus, iStatus.Int());
       
   790 		}
       
   791 	}
       
   792 
       
   793 TInt CNotifyNetworkRegistrationStatusAct::RunError(TInt aLeaveCode)
       
   794 /**
       
   795 Handle any Leave() from inside RunL().
       
   796 
       
   797 @param	aLeaveCode	passed in if RunL Leaves.
       
   798 @return	KErrNone.
       
   799 */
       
   800 	{
       
   801 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::ENotifyNetworkRegistrationStatus, aLeaveCode);
       
   802 	return KErrNone;	// to ActiveScheduler.
       
   803 	}
       
   804 
       
   805 void CNotifyNetworkRegistrationStatusAct::DoCancel()
       
   806 /**
       
   807 Cancel request.
       
   808 
       
   809 Async request to dial is cancelled.
       
   810 */
       
   811 	{
       
   812 	iTelephonyFunctions->Phone()->CancelAsyncRequest(EMobilePhoneNotifyNetworkRegistrationStatusChange);
       
   813 	}
       
   814 
       
   815 
       
   816 CNotifyNetworkRegistrationStatusAct::CNotifyNetworkRegistrationStatusAct(CTelephonyFunctions* aTelephonyFunctions)
       
   817 : CAsyncRequestBaseAct(),
       
   818   iTelephonyFunctions(aTelephonyFunctions)
       
   819 /**
       
   820 First-phase constructor which cannot Leave().
       
   821 
       
   822 @param	aTelephonyFunctions Object that constructs us.
       
   823 */
       
   824 	{
       
   825 	}
       
   826 	
       
   827 
       
   828 CNotifyCurrentNetworkInfoAct* CNotifyCurrentNetworkInfoAct::NewL(CTelephonyFunctions* aTelephonyFunctions)
       
   829 /**
       
   830 Public constructor which can Leave().
       
   831 
       
   832 @param	aTelephonyFunctions Object that constructs us.
       
   833 @leave	Leaves if no memory.
       
   834 */
       
   835 	{
       
   836 	CNotifyCurrentNetworkInfoAct* self = new(ELeave) CNotifyCurrentNetworkInfoAct(aTelephonyFunctions);
       
   837 	CActiveScheduler::Add(self);
       
   838 	return self;
       
   839 	}
       
   840 
       
   841 CNotifyCurrentNetworkInfoAct::~CNotifyCurrentNetworkInfoAct()
       
   842 /**
       
   843 Destructor
       
   844 */
       
   845 	{
       
   846 	Cancel();
       
   847 	Complete();
       
   848 	}
       
   849 
       
   850 void CNotifyCurrentNetworkInfoAct::NotifyCurrentNetworkInfo(TDes8& aPckg)
       
   851 /**
       
   852 Issue Request
       
   853 */
       
   854 	{
       
   855 	iISVNetworkInfo = reinterpret_cast<CTelephony::TEtelISVType*> ( const_cast<TUint8*> (aPckg.Ptr()) );
       
   856 
       
   857 	iPostedIPC = EMobilePhoneNotifyCurrentNetworkChange;
       
   858 	iTelephonyFunctions->Phone()->NotifyCurrentNetworkChange(iStatus,iMMNetworkInfoPckg, iMMArea);
       
   859 
       
   860 	SetActive();
       
   861 	}
       
   862 
       
   863 /**
       
   864 Service Completed request.
       
   865 */
       
   866 void CNotifyCurrentNetworkInfoAct::Complete()
       
   867 	{
       
   868 	if(iTelephonyFunctions->IsRequestPending(CTelephonyFunctions::ENotifyCurrentNetworkInfo))
       
   869 		{
       
   870 		if(iStatus==KErrNone)
       
   871 			{
       
   872 			CGetCurrentNetworkInfoAct::MapNetworkInfo(iISVNetworkInfo, &iMMNetworkInfo, &iMMArea);
       
   873 			}
       
   874 		iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::ENotifyCurrentNetworkInfo, iStatus.Int());
       
   875 		}
       
   876 	}
       
   877 
       
   878 
       
   879 TInt CNotifyCurrentNetworkInfoAct::RunError(TInt aLeaveCode)
       
   880 /**
       
   881 Handle any Leave() from inside RunL().
       
   882 
       
   883 @param	aLeaveCode	passed in if RunL Leaves.
       
   884 @return	KErrNone.
       
   885 */
       
   886 	{
       
   887 	iTelephonyFunctions->CompleteRequest(CTelephonyFunctions::ENotifyCurrentNetworkInfo, aLeaveCode);
       
   888 	return KErrNone;	// to ActiveScheduler.
       
   889 	}
       
   890 
       
   891 void CNotifyCurrentNetworkInfoAct::DoCancel()
       
   892 /**
       
   893 Cancel request.
       
   894 
       
   895 Async request to dial is cancelled.
       
   896 */
       
   897 	{
       
   898 	iTelephonyFunctions->Phone()->CancelAsyncRequest(iPostedIPC);
       
   899 	}
       
   900 
       
   901 
       
   902 CNotifyCurrentNetworkInfoAct::CNotifyCurrentNetworkInfoAct(CTelephonyFunctions* aTelephonyFunctions)
       
   903 : CAsyncRequestBaseAct(),
       
   904   iTelephonyFunctions(aTelephonyFunctions),
       
   905   iMMNetworkInfoPckg(iMMNetworkInfo)
       
   906 /**
       
   907 First-phase constructor which cannot Leave().
       
   908 
       
   909 @param	aTelephonyFunctions Object that constructs us.
       
   910 */
       
   911 	{
       
   912 	}
       
   913 	
       
   914