supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplstartstate.cpp
changeset 0 667063e416a2
child 19 02ba3f1733c6
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Class for handling SUPL_START message.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <etelmm.h> 
       
    21 #include <e32math.h>
       
    22 #include <f32file.h>
       
    23 #include <bautils.h>
       
    24 
       
    25 #include "lbs/epos_tomasuplallowedcapabilities.h"
       
    26 #include "epos_comasupllocationid.h"
       
    27 #include "lbs/epos_comasuplsetcapabilities.h"
       
    28 #include "epos_suplterminal.h"
       
    29 #include "epos_suplterminalconstants.h"
       
    30 #include "epos_suplterminalqop.h"
       
    31 #include "epos_comasuplsessionid.h"
       
    32 #include "epos_comasuplsession.h"
       
    33 #include "epos_tomasuplqop.h"
       
    34 #include "epos_comasuplasnmessagebase.h"
       
    35 #include "epos_comasuplstartstate.h"
       
    36 #include "epos_comasuplstart.h"
       
    37 #include "epos_comasuplposrequestor.h"
       
    38 #include "epos_omasuplconstants.h"
       
    39 #include "epos_comasupltrace.h"
       
    40 #include "epos_comasuplasnbase.h"
       
    41 
       
    42 
       
    43 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplStartState.cpp");
       
    44 
       
    45 TInt FindK(TReal horAccuracy,TReal C, TReal x)
       
    46 	{
       
    47 		TReal r = horAccuracy;
       
    48 		TReal numerator ;
       
    49 		TReal denominator;
       
    50 		Math::Log(numerator,( r/C + 1.0 ));
       
    51 		Math::Log(denominator,( 1.0 + x ));
       
    52 		TReal res = numerator/ denominator;
       
    53 		TInt round = res; //To ceil it.
       
    54 		TReal decimal = res - round;
       
    55 		if(decimal >= 0.5)
       
    56 			{
       
    57 				res  = res  + 0.5;
       
    58 			}
       
    59 		return res;
       
    60 	}
       
    61 
       
    62 // ============================ MEMBER FUNCTIONS ===============================
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // COMASuplStartState::COMASuplStartState
       
    66 // C++ constructor can NOT contain any code, that might leave.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 COMASuplStartState::COMASuplStartState(RMobilePhone& aMobilePhone,
       
    70 									  TInt aMsgTimeout,COMASuplPOSRequestor* aPosRequestor,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase):
       
    71 									  iMobilePhone(aMobilePhone),
       
    72 									  iPosRequestor(aPosRequestor),
       
    73 									  iOMASuplAsnHandlerBase(aOMASuplAsnHandlerBase)
       
    74     {
       
    75 		iMessageTimeOut = aMsgTimeout * KSecond;   
       
    76 		iCurrentState =  ESUPL_START;
       
    77 		iIsQoPPresent = EFalse;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // COMASuplStartState::~COMASuplStartState
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 COMASuplStartState::~COMASuplStartState()
       
    85     {
       
    86     	if(iTrace)
       
    87     		iTrace->Trace(_L("COMASuplStartState::~COMASuplStartState..."), KTraceFileName, __LINE__); 							
       
    88     	delete iLocationIDRequestor;
       
    89     	
       
    90     	if(iPosRequestor)
       
    91     		iPosRequestor->DestroyList();
       
    92 		else    	    	
       
    93     		delete iSETCapabilities ;
       
    94 
       
    95     	delete iAllowedCapabilities;
       
    96     	
       
    97     	delete iLocationId;
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // COMASuplStartState::ConstructL
       
   102 // Symbian 2nd phase constructor can leave.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void COMASuplStartState::ConstructL(TInt aAllowedCapabilities)
       
   106     {
       
   107     	COMASuplState::BaseConstructL();
       
   108     	iTrace->Trace(_L("COMASuplStartState::ConstructL..."), KTraceFileName, __LINE__); 							
       
   109     	iLocationIDRequestor = COMASuplETel::NewL(*this,iMobilePhone);
       
   110     	iAllowedCapabilities = COMASuplSETCapabilities::NewL();
       
   111 
       
   112     	if(!iPosRequestor)
       
   113     		iSETCapabilities = COMASuplSETCapabilities::NewL();
       
   114     	
       
   115     	FillAllowedCapabilities(aAllowedCapabilities);
       
   116 #ifdef PRINT_MESSAGE		    	
       
   117     	if(iECId)
       
   118     		{
       
   119     		    iTrace->Trace(_L("Allowed Capabilities contains Enhance Cell Id."), KTraceFileName, __LINE__); 								
       
   120     		}
       
   121     	else
       
   122     		{
       
   123     			 iTrace->Trace(_L("Allowed Capabilities does not contains Enhance Cell Id."), KTraceFileName, __LINE__); 								
       
   124     		}	
       
   125 #endif    		
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // COMASuplStartState::NewL
       
   130 // Two-phased constructor.
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 COMASuplStartState* COMASuplStartState::NewL(RMobilePhone& aMobilePhone,TInt aMsgTimeout,
       
   134 											COMASuplPOSRequestor* aPosRequestor,
       
   135 											COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase,TInt aAllowedCapabilities)
       
   136     {
       
   137 	    COMASuplStartState* self =  new ( ELeave ) COMASuplStartState(aMobilePhone,aMsgTimeout,aPosRequestor,aOMASuplAsnHandlerBase);
       
   138 	    CleanupStack::PushL( self );
       
   139 	    self->ConstructL(aAllowedCapabilities);
       
   140 	    CleanupStack::Pop(self);
       
   141 	    return self;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // COMASuplStartState::GenerateMessage
       
   146 // Generates SUPL_SATART message
       
   147 // (other items were commented in a header).
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 TInt COMASuplStartState::GenerateMessageL() 
       
   151 	{
       
   152 		iTrace->Trace(_L("Start of COMASuplStartState::GenerateMessage"), KTraceFileName, __LINE__); 					
       
   153 		iLocationIDRequestor->GetLocationID();
       
   154 		return KErrNone;
       
   155 	}
       
   156 	
       
   157 // -----------------------------------------------------------------------------
       
   158 // COMASuplStartState::CancelOperation
       
   159 // Cancels the generation if SUPL START
       
   160 // (other items were commented in a header).
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 void COMASuplStartState::CancelOperation() 
       
   164 	{
       
   165 		iTrace->Trace(_L("Cancel of COMASuplStartState::CancelOperation..."), KTraceFileName, __LINE__); 					
       
   166 		COMASuplState::CancelOperation();	
       
   167 		iLocationIDRequestor->Cancel();
       
   168 		if(iPosRequestor)
       
   169 		{
       
   170 			iPosRequestor->Cancel();
       
   171 		}
       
   172 	}
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // COMASuplStartState::EncodeMessageL
       
   176 // Encodes message ...returns encoded data
       
   177 // (other items were commented in a header).
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 HBufC8* COMASuplStartState::EncodeMessageL(TOMASuplVersion &aSuplVersion,
       
   181 											COMASuplSessionID* aSessionId,TInt &aError)
       
   182 	{
       
   183 		iTrace->Trace(_L("Start of COMASuplStartState::EncodeMessageL"), KTraceFileName, __LINE__); 					
       
   184 		iTrace->Trace(_L("*********Values in SUPL START*************"), KTraceFileName, __LINE__); 
       
   185 		COMASuplState::EncodeMessageL(aSuplVersion,aSessionId,aError);
       
   186 		
       
   187 		aError = ValidateSetCapabilities(); 
       
   188 		if(aError != KErrNone)
       
   189 		{
       
   190 			return NULL;
       
   191 		}
       
   192 
       
   193 
       
   194 		COMASuplAsnMessageBase* OMASuplMessageBase = iOMASuplAsnHandlerBase->CreateOMASuplMessageL(COMASuplAsnMessageBase::ESUPL_START);
       
   195 		CleanupStack::PushL(OMASuplMessageBase);
       
   196 		COMASuplStart* OMASuplStart  =  static_cast<COMASuplStart*>(OMASuplMessageBase);
       
   197 		
       
   198 		iTrace->Trace(_L("Created OMASuplStart"), KTraceFileName, __LINE__); 							
       
   199 		ComputeCapabilities();
       
   200 
       
   201 	     OMASuplStart->SetMessageBase(aSuplVersion,aSessionId);
       
   202 		if(iSETCapabilities && iPosRequestor)
       
   203 		{
       
   204 			iTrace->Trace(_L("Filling capability for POS....."), KTraceFileName, __LINE__);
       
   205 			
       
   206 			TOMASuplPosTechnology posTech;
       
   207 			COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod;
       
   208 			TOMASuplPosProtocol posProtocol;
       
   209 			iSETCapabilities->GetSETCapabilities(posTech, prefMethod, posProtocol);
       
   210             TBool aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA;
       
   211 			posTech.GetPosTechnology(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA);
       
   212             iAllowedCapabilitiesforPOS.SetAllowedCapabilities(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA, ETrue, ETrue);
       
   213             iPosRequestor->SetPosMethodAndAllowedCapabilities(iAllowedCapabilitiesforPOS,COMASuplPosSessionBase::EPositionUndefined);
       
   214             
       
   215             COMASuplSETCapabilities *lSETCapabilities = COMASuplSETCapabilities::NewL();
       
   216             lSETCapabilities->SetSETCapabilities(posTech, prefMethod, posProtocol);
       
   217             //iLocationId ownership will be with "this" class
       
   218             OMASuplStart->SetSuplStart(lSETCapabilities,static_cast<COMASuplLocationId*>(iLocationId->CloneL()),iECId);
       
   219         }
       
   220 		else
       
   221 		    {
       
   222                 //iLocationId ownership will be with "this" class
       
   223                 if(iSETCapabilities)
       
   224                 OMASuplStart->SetSuplStart(static_cast<COMASuplSETCapabilities*>(iSETCapabilities->CloneL()),static_cast<COMASuplLocationId*>(iLocationId->CloneL()),iECId);
       
   225 		    }
       
   226 		if(iECId)
       
   227 			{
       
   228 				OMASuplStart->SetECellId(iMmCellInfo);
       
   229 			}
       
   230 
       
   231 #ifdef PRINT_MESSAGE		
       
   232 		// SET Capabilities
       
   233 		if(iSETCapabilities)
       
   234 		{
       
   235 			iTrace->Trace(_L("SET Capabilities ....."), KTraceFileName, __LINE__);
       
   236 			
       
   237 			TOMASuplPosTechnology posTech;
       
   238 			COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod;
       
   239 			TOMASuplPosProtocol posProtocol;
       
   240 
       
   241 			iSETCapabilities->GetSETCapabilities(posTech, prefMethod, posProtocol);
       
   242 		
       
   243 			TBuf <200> posTechStr;
       
   244 			posTechStr.Append(_L("POS Technologies - "));
       
   245 			TBool aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA;
       
   246 			posTech.GetPosTechnology(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA);
       
   247 			if(aGpsSetAssisted) posTechStr.Append(_L("AGPS SET Assisted  "));
       
   248 			if(aGpsSetBased) posTechStr.Append(_L("AGPS SET Based  "));
       
   249 			if(autonomousGps) posTechStr.Append(_L("Autonomous GPS  "));
       
   250 			if(AFLT) posTechStr.Append(_L("AFLT  "));
       
   251 			if(EOTD) posTechStr.Append(_L("EOTD  "));
       
   252 			if(OTDOA) posTechStr.Append(_L("OTDOA  "));
       
   253 
       
   254 			iTrace->Trace(posTechStr, KTraceFileName, __LINE__);
       
   255 
       
   256 			TBuf <80> prefMethodStr;
       
   257 			prefMethodStr.Append(_L("Preferred Method - "));
       
   258 
       
   259 			switch(prefMethod)
       
   260 			{
       
   261 			case COMASuplSETCapabilities::EOMAAGpsSETAssitedPreferred:
       
   262 				prefMethodStr.Append(_L("AGPS SET Assisted Preferred"));
       
   263 				break;
       
   264 			case COMASuplSETCapabilities::EOMAAGpsSETBasedPreferred:
       
   265 				prefMethodStr.Append(_L("AGPS SET Based Preferred"));
       
   266 				break;
       
   267 			case COMASuplSETCapabilities::EOMANoPreferred:
       
   268 				prefMethodStr.Append(_L("No Preference"));
       
   269 				break;
       
   270 			}
       
   271 			
       
   272 			iTrace->Trace(prefMethodStr, KTraceFileName, __LINE__);
       
   273 
       
   274 			TBuf <80> posProtocolStr;
       
   275 			posProtocolStr.Append(_L("POS Protocol - "));
       
   276 			TBool tia801, rrlp, rrc;
       
   277 			
       
   278 			posProtocol.GetPosProtocol(tia801, rrlp, rrc);
       
   279 			if(tia801) posProtocolStr.Append(_L("TIA 801  "));
       
   280 			if(rrlp) posProtocolStr.Append(_L("RRLP  "));
       
   281 			if(rrc) posProtocolStr.Append(_L("RRC  "));
       
   282 		}
       
   283 
       
   284 		// Location ID
       
   285 		if(iLocationId)
       
   286 		{
       
   287 			iTrace->Trace(_L("Location ID ......."), KTraceFileName, __LINE__);
       
   288 			
       
   289 			TBuf<50> locationIDTypeStr;
       
   290 			locationIDTypeStr.Append(_L("Location ID Type - "));
       
   291 			COMASuplLocationId::TOMASuplCellInfoType cellInfoType;
       
   292 			COMASuplLocationId::TOMASuplStatus status;			
       
   293 			TInt refMNC, refMcc, refCI, refLAC;
       
   294 			TInt err;
       
   295 
       
   296 			cellInfoType = iLocationId->SuplCellInfoType();
       
   297 			switch(cellInfoType)
       
   298 			{	
       
   299 			case COMASuplLocationId::EGSM:
       
   300 				locationIDTypeStr.Append(_L("GSM"));
       
   301 				iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__);
       
   302 
       
   303 				COMASuplGSMCellInfo *gsmCellInfo;
       
   304 
       
   305 				err = iLocationId->SuplLocationId(gsmCellInfo, status);
       
   306 				if(KErrNone == err)
       
   307 				{
       
   308 					TBuf <100> gsmCellInfoStr;
       
   309 					gsmCellInfoStr.Append(_L("GSM Cell Info - "));
       
   310 					gsmCellInfo->SuplGSMCellInfo(refMNC, refMcc, refCI, refLAC);
       
   311 					gsmCellInfoStr.Append(_L("MNC - "));
       
   312 					gsmCellInfoStr.AppendNum(refMNC);
       
   313 					gsmCellInfoStr.Append(_L(" MCC - "));
       
   314 					gsmCellInfoStr.AppendNum(refMcc);
       
   315 					gsmCellInfoStr.Append(_L(" CI - "));
       
   316 					gsmCellInfoStr.AppendNum(refCI);
       
   317 					gsmCellInfoStr.Append(_L(" LAC - "));
       
   318 					gsmCellInfoStr.AppendNum(refLAC);
       
   319 
       
   320 					iTrace->Trace(gsmCellInfoStr, KTraceFileName, __LINE__);
       
   321 				}
       
   322 				break;
       
   323 
       
   324 			case COMASuplLocationId::EWCDMA:
       
   325 				locationIDTypeStr.Append(_L("WCDMA"));
       
   326 				iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__);
       
   327 
       
   328 				COMASuplCellInfo *wcdmaCellInfo;
       
   329 
       
   330 				err = iLocationId->SuplLocationId(wcdmaCellInfo, status);
       
   331 				if(KErrNone == err)
       
   332 				{
       
   333 					TBuf <100> wcdmaCellInfoStr;
       
   334 					wcdmaCellInfoStr.Append(_L("WCDMA Cell Info - "));
       
   335 					wcdmaCellInfo->SuplCellInfo(refMNC, refMcc, refCI);
       
   336 					wcdmaCellInfoStr.Append(_L("MNC - "));
       
   337 					wcdmaCellInfoStr.AppendNum(refMNC);
       
   338 					wcdmaCellInfoStr.Append(_L(" MCC - "));
       
   339 					wcdmaCellInfoStr.AppendNum(refMcc);
       
   340 					wcdmaCellInfoStr.Append(_L(" CI - "));
       
   341 					wcdmaCellInfoStr.AppendNum(refCI);
       
   342 
       
   343 					iTrace->Trace(wcdmaCellInfoStr, KTraceFileName, __LINE__);
       
   344 				}
       
   345 
       
   346 				break;
       
   347 			}
       
   348 			TBuf <60> locationIdStatusStr;
       
   349 			locationIdStatusStr.Append(_L("Location ID Status - "));
       
   350 			switch(status)
       
   351 			{
       
   352 			case COMASuplLocationId::EStale:
       
   353 				locationIdStatusStr.Append(_L("Stale"));
       
   354 				break;
       
   355 			case COMASuplLocationId::ECurrent:
       
   356 				locationIdStatusStr.Append(_L("Current"));
       
   357 				break;
       
   358 			case COMASuplLocationId::EUnknown:
       
   359 				locationIdStatusStr.Append(_L("Unknown"));
       
   360 				break;
       
   361 			}
       
   362 			iTrace->Trace(locationIdStatusStr, KTraceFileName, __LINE__);
       
   363 		}
       
   364 #endif
       
   365 		if(iIsQoPPresent)
       
   366 			{
       
   367 				iTrace->Trace(_L("QoP ....."), KTraceFileName, __LINE__);
       
   368 				TOMASuplQop Qop;
       
   369 				TReal32 horAccuracy;
       
   370 				TReal32 verAccuracy;
       
   371 				TInt maxLocationAge;
       
   372 				TInt delay;
       
   373 				
       
   374 				if(iClientQop.GetHorizontalAccuracy(horAccuracy) != KErrNotFound)
       
   375 					{
       
   376 						TReal C = 10.0;
       
   377 						TReal x = 0.1; // From 3GPP GAD
       
   378 						Qop.SetSuplQop(FindK(horAccuracy,C,x));
       
   379 #ifdef PRINT_MESSAGE
       
   380 						TBuf <30> horAccStr;
       
   381 						horAccStr.Append(_L("Horizontal Accuracy - "));
       
   382 						horAccStr.AppendNum(horAccuracy);
       
   383 						iTrace->Trace(horAccStr, KTraceFileName, __LINE__);
       
   384 #endif
       
   385 					}
       
   386 
       
   387 				if(iClientQop.GetVerticalAccuracy(verAccuracy) != KErrNotFound)
       
   388 					{
       
   389 						TReal C = 45.0;
       
   390 						TReal x = 0.025; // From 3GPP GAD
       
   391 						Qop.SetVerticalAccuracy(FindK(verAccuracy,C,x));
       
   392 #ifdef PRINT_MESSAGE
       
   393 						TBuf <32> vertAccStr;
       
   394 						vertAccStr.Append(_L("Vertical Accuracy - "));
       
   395 						vertAccStr.AppendNum(verAccuracy);
       
   396 						iTrace->Trace(vertAccStr, KTraceFileName, __LINE__);
       
   397 #endif
       
   398 					}
       
   399 
       
   400 				if(iClientQop.GetMaxLocationAge(maxLocationAge) != KErrNotFound)
       
   401 					{
       
   402 						Qop.SetMaxLocationAge(maxLocationAge);
       
   403 #ifdef PRINT_MESSAGE
       
   404 						TBuf <32> maxAgeStr;
       
   405 						maxAgeStr.Append(_L("Maximum Location Age - "));
       
   406 						maxAgeStr.AppendNum(maxLocationAge);
       
   407 						iTrace->Trace(maxAgeStr, KTraceFileName, __LINE__);
       
   408 #endif
       
   409 					}
       
   410 					
       
   411 				if(iClientQop.GetDelay(delay) != KErrNotFound)
       
   412 					{	
       
   413 						// Calculate the delay to be sent to SLP from the
       
   414 						// delay received from client lib
       
   415 						
       
   416 						// Client library gives 2^x and we need to send
       
   417 						// x to SLP. Therefore, conversion is -
       
   418 						// x = (log (2^x) / log 2)
       
   419 						
       
   420 						TReal clientDelay = delay;
       
   421 						TReal slpDelay;
       
   422 						TReal logClientDelay;
       
   423 						TReal logTwo;
       
   424 						
       
   425 						const TReal two = 2;
       
   426 						
       
   427 						TInt err = Math::Log(logClientDelay, clientDelay);
       
   428 						if(KErrNone == err)
       
   429 						{
       
   430 							err  = Math::Log(logTwo, two);
       
   431 							if(KErrNone == err)
       
   432 							{
       
   433 								slpDelay = logClientDelay/logTwo;
       
   434 								Qop.SetDelay(slpDelay);		
       
   435 #ifdef PRINT_MESSAGE
       
   436 						TBuf <32> delayStr;
       
   437 						delayStr.Append(_L("Delay - "));
       
   438 						delayStr.AppendNum(slpDelay);
       
   439 						iTrace->Trace(delayStr, KTraceFileName, __LINE__);
       
   440 #endif
       
   441 							}
       
   442 						}
       
   443 						
       
   444 					}
       
   445 					
       
   446 				OMASuplStart->SetQop(Qop);
       
   447 			}
       
   448 			
       
   449 		iTrace->Trace(_L("Starting Encoding..."), KTraceFileName, __LINE__); 							
       
   450 		
       
   451 		HBufC8 *encodedBuffer = NULL;
       
   452 		TInt error;
       
   453 
       
   454 		TRAPD(err,encodedBuffer = iOMASuplAsnHandlerBase->EncodeL(OMASuplStart,error));
       
   455 
       
   456 		CleanupStack::PopAndDestroy(OMASuplMessageBase);
       
   457 		
       
   458 		 if ( error == KErrNone && err == KErrNone )
       
   459 		 	{
       
   460 		 			iTrace->Trace(_L("Encoding Done..."), KTraceFileName, __LINE__); 							
       
   461 		 			aError = KErrNone;
       
   462 		 			SetPrefferedBack();
       
   463 #ifdef PRINT_MESSAGE
       
   464                     RFile file;
       
   465 	                RFs   fs;
       
   466 	                TInt cErr=fs.Connect();
       
   467 	                TInt fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny);
       
   468                     if (fErr == KErrNotFound || fErr == KErrPathNotFound)
       
   469                         {                             
       
   470                         TBool ret = BaflUtils::FolderExists(fs,_L("c:\\logs\\epos\\"));
       
   471                         if(!ret)
       
   472                         	{
       
   473                         		fs.MkDirAll(_L("c:\\logs\\epos\\"));
       
   474                         	}
       
   475                         file.Create(fs, _L("c:\\logs\\epos\\packet.txt"), EFileWrite|EFileShareAny);
       
   476 	                    fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny);
       
   477                         }
       
   478                     TInt aPos;
       
   479                     file.Seek(ESeekEnd, aPos);
       
   480                     _LIT8(KMsgType, "SUPL START");
       
   481                     file.Write(KMsgType);
       
   482                     file.Write(_L8("\r \n"));
       
   483 	                file.Write(*encodedBuffer);
       
   484                     file.Write(_L8("\r \n"));
       
   485 	                file.Close();
       
   486 	                fs.Close();
       
   487 #endif
       
   488 					return encodedBuffer;
       
   489 		 	}
       
   490 		 else
       
   491 		 	{
       
   492 		 		iTrace->Trace(_L("Encoding Failed."), KTraceFileName, __LINE__); 
       
   493 				aError = error;	
       
   494 		 		delete encodedBuffer;
       
   495 		 		encodedBuffer = NULL;
       
   496 		 	}
       
   497 		 	
       
   498 		 	return NULL;
       
   499 	}
       
   500  
       
   501 // -----------------------------------------------------------------------------
       
   502 // COMASuplStartState::LocationIDRequestCompleted
       
   503 // Gets called when location request completed
       
   504 // (other items were commented in a header).
       
   505 // -----------------------------------------------------------------------------
       
   506 //
       
   507 void COMASuplStartState::LocationIDRequestCompletedL(COMASuplLocationId* aLocationId,
       
   508 													TInt aErrorCode)
       
   509 	{
       
   510 		iTrace->Trace(_L("COMASuplStartState::LocationIDRequestCompleted..."), KTraceFileName, __LINE__); 								
       
   511 		iGenerationStatus = EFalse;
       
   512 		if(aErrorCode!=KErrNone)
       
   513 			{
       
   514 				iTrace->Trace(_L("COMASuplStartState::LocationRequestFailed"), KTraceFileName, __LINE__); 					
       
   515 				if(iMsgStateObserver)
       
   516 					{
       
   517 						iMsgStateObserver->OperationCompleteL(aErrorCode);
       
   518 						return;
       
   519 					}
       
   520 			}
       
   521 			
       
   522 		iLocationId = aLocationId;
       
   523 		
       
   524 		if(iECId)
       
   525 			{
       
   526 				iTrace->Trace(_L("COMASuplStartState::LocationIDRequestCompletedL...Retrive E-CellId"), KTraceFileName, __LINE__); 					
       
   527 				iGenerationStatus = ETrue;
       
   528 				iLocationIDRequestor->GetECellID();
       
   529 			}
       
   530 		else
       
   531 			{	
       
   532 				GetAssistceDataFromPluginL(aErrorCode);
       
   533 			}	
       
   534 	}
       
   535 
       
   536 // -----------------------------------------------------------------------------
       
   537 // COMASuplStartState::LocationECellIdRequestCompletedL
       
   538 // Gets called when E-Cell Id location request completed
       
   539 // (other items were commented in a header).
       
   540 // -----------------------------------------------------------------------------
       
   541 //
       
   542 void COMASuplStartState::LocationECellIdRequestCompletedL(TOMASuplECellInfo& aECId,TInt aErrorCode)
       
   543 	{
       
   544 		
       
   545 		iGenerationStatus = EFalse;
       
   546 		if(aErrorCode!=KErrNone)
       
   547 			{
       
   548 				iTrace->Trace(_L("COMASuplStartState::LocationECellIdRequestCompletedL...Failed...still continueing... "), KTraceFileName, __LINE__); 					
       
   549 				iECId = EFalse; //Since getting E-Cell id is failed....
       
   550 				aErrorCode = KErrNone;
       
   551 
       
   552 			}
       
   553 		else
       
   554 			{
       
   555 				iMmCellInfo = aECId;
       
   556 			}			
       
   557 			
       
   558 		GetAssistceDataFromPluginL(aErrorCode);
       
   559 	}
       
   560 	
       
   561 // -----------------------------------------------------------------------------
       
   562 // COMASuplStartState::ComparisionLocationIDRequestCompletedL
       
   563 // Gets called when location request for comparision completed
       
   564 // (other items were commented in a header).
       
   565 // -----------------------------------------------------------------------------
       
   566 //
       
   567 void COMASuplStartState::ComparisionLocationIDRequestCompletedL(COMASuplLocationId* /*aLocationId*/,
       
   568         TInt /*aErrorCode*/)
       
   569     {
       
   570   	//do nothing
       
   571     }
       
   572 // -----------------------------------------------------------------------------
       
   573 // COMASuplStartState::GetPosParamsL() 
       
   574 // Gets called when location request completed
       
   575 // (other items were commented in a header).
       
   576 // -----------------------------------------------------------------------------
       
   577 //
       
   578 void COMASuplStartState::GetPosParamsL() 
       
   579 	{
       
   580 		iSETCapabilities = COMASuplSETCapabilities::NewL();
       
   581 		iSETCapabilities->SetType(COMASuplInfoRequest::EOMASuplSETCapabilities);
       
   582 		
       
   583 		iPosRequestor->CreateListL();
       
   584 		iPosRequestor->AppendInfoRequest(iSETCapabilities);  //takes ownership
       
   585 		iPosRequestor->SetObserver(this);
       
   586 		User::LeaveIfError(iPosRequestor->GetSuplInfoL());
       
   587 	}	
       
   588 
       
   589 // -----------------------------------------------------------------------------
       
   590 // COMASuplPosInitState::OperationCompleteL
       
   591 // An observer method that indicates the completion of
       
   592 // data retrieval from POS Message plugin
       
   593 // (other items were commented in a header).
       
   594 // -----------------------------------------------------------------------------
       
   595 //
       
   596 void COMASuplStartState::OperationCompleteL(TInt aError) 
       
   597 	{
       
   598 		if(iMsgStateObserver)
       
   599 		{
       
   600 			if(aError == KErrNone)
       
   601 				{
       
   602 					aError = ValidateSetCapabilities(); 	
       
   603 				}
       
   604 				
       
   605 			iMsgStateObserver->OperationCompleteL(aError);
       
   606 		}
       
   607 	}
       
   608 
       
   609 // -----------------------------------------------------------------------------
       
   610 // COMASuplStartState::Capabilities 
       
   611 // Returns iCapabilities 
       
   612 // (other items were commented in a header).
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 COMASuplSETCapabilities* COMASuplStartState::Capabilities()
       
   616 	{
       
   617 	return iSETCapabilities;
       
   618 	}
       
   619 
       
   620 // -----------------------------------------------------------------------------
       
   621 // COMASuplStartState::Capabilities
       
   622 // Returns iCapabilities 
       
   623 // (other items were commented in a header).
       
   624 // -----------------------------------------------------------------------------
       
   625 //
       
   626 void COMASuplStartState::GetPositionComplete(TInt /* err */)
       
   627 	{
       
   628 	/* 
       
   629 	No Body
       
   630 	*/
       
   631 	}
       
   632 	
       
   633 // -----------------------------------------------------------------------------
       
   634 // COMASuplSession::InitilizeAllowedCapabilities
       
   635 // Retrives capability from Allowed capabilities & puts into iSETCapabilities
       
   636 // (other items were commented in a header).
       
   637 // -----------------------------------------------------------------------------
       
   638 //
       
   639 void COMASuplStartState::InitilizeAllowedCapabilities()
       
   640 	{
       
   641 	
       
   642 	iTrace->Trace(_L("Start of COMASuplStartState::InitilizeAllowedCapabilities"), KTraceFileName, __LINE__); 															
       
   643 	
       
   644 	TOMASuplPosTechnology posTechnology;
       
   645 	COMASuplSETCapabilities::TOMASuplPrefMethod    prefMethod;
       
   646 	TOMASuplPosProtocol   posProtocol;
       
   647 	
       
   648 	TBool  GpsSETAssisted 	= ETrue;
       
   649 	TBool  GpsSETBased 		= ETrue;
       
   650 	TBool  AutonomousGps 	= ETrue;
       
   651 	TBool  FLT 			 	= ETrue;
       
   652 
       
   653 	TBool  eOTD 		 	= ETrue;
       
   654 	TBool  oTDOA 		 	= ETrue;
       
   655 	
       
   656 	TBool TIA801 = ETrue; 
       
   657 	TBool RRLP = ETrue;
       
   658 	TBool RRC =  ETrue;
       
   659 
       
   660 	posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT,
       
   661 													   eOTD,oTDOA);
       
   662 	posProtocol.SetPosProtocol(TIA801,RRLP,RRC);
       
   663 	prefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   664 	
       
   665 	iAllowedCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol);	
       
   666 	
       
   667 	iTrace->Trace(_L("End of COMASuplStartState::InitilizeAllowedCapabilities"), KTraceFileName, __LINE__); 															
       
   668 	}
       
   669 	
       
   670 // -----------------------------------------------------------------------------
       
   671 // DoANDOperation
       
   672 // For manipulating SET capabiliites
       
   673 // (other items were commented in a header).
       
   674 // -----------------------------------------------------------------------------
       
   675 //
       
   676 TBool DoANDOperation(TInt aFlag, TInt aCapability) 
       
   677 	{
       
   678 		if ((aFlag & aCapability) > 0) 
       
   679 			return ETrue;
       
   680 		else
       
   681 			return EFalse;
       
   682 	}
       
   683 	
       
   684 // -----------------------------------------------------------------------------
       
   685 // COMASuplSession::FillAllowedCapabilities
       
   686 // Retrives capability from Allowed capabilities & puts into iSETCapabilities
       
   687 // (other items were commented in a header).
       
   688 // -----------------------------------------------------------------------------
       
   689 //
       
   690 void COMASuplStartState::FillAllowedCapabilities(TInt aAllowedCapabilities)
       
   691 	{
       
   692 	
       
   693 	iTrace->Trace(_L("Start of COMASuplStartState::FillAllowedCapabilities"), KTraceFileName, __LINE__); 															
       
   694 	
       
   695 	TOMASuplPosTechnology posTechnology;
       
   696 	COMASuplSETCapabilities::TOMASuplPrefMethod    prefMethod;
       
   697 	TOMASuplPosProtocol   posProtocol;
       
   698 	
       
   699 	TBool  GpsSETAssisted 	= DoANDOperation(aAllowedCapabilities,KGpsSETAssisted);
       
   700 	TBool  GpsSETBased 		= DoANDOperation(aAllowedCapabilities,KGpsSETBased);
       
   701 	TBool  AutonomousGps 	= DoANDOperation(aAllowedCapabilities,KAutonomousGps);
       
   702 	TBool  FLT 			 	= DoANDOperation(aAllowedCapabilities,KAFLT);
       
   703 		   iECId 		 	= DoANDOperation(aAllowedCapabilities,KECID);
       
   704 	TBool  eOTD 		 	= DoANDOperation(aAllowedCapabilities,KEOTD);
       
   705 	TBool  oTDOA 		 	= DoANDOperation(aAllowedCapabilities,KOTDOA);
       
   706 	
       
   707 	TBool TIA801 = EFalse;
       
   708 	TBool RRLP = EFalse;
       
   709 	TBool RRC =  EFalse;
       
   710 
       
   711 	posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT,
       
   712 													   eOTD,oTDOA);
       
   713 	posProtocol.SetPosProtocol(TIA801,RRLP,RRC);
       
   714 	prefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   715 	
       
   716 	TBuf<128> msg(_L("COMASuplStartState::FillAllowedCapabilities : "));
       
   717 	msg.AppendNum(GpsSETAssisted);
       
   718 	msg.Append(_L(", "));
       
   719 	msg.AppendNum(GpsSETBased);
       
   720 	msg.Append(_L(", "));
       
   721 	msg.AppendNum(AutonomousGps);
       
   722 	msg.Append(_L(", "));
       
   723 	msg.AppendNum(FLT);
       
   724 	msg.Append(_L(", "));
       
   725 	msg.AppendNum(eOTD);
       
   726 	msg.Append(_L(", "));
       
   727 	msg.AppendNum(oTDOA);
       
   728 	msg.Append(_L(", "));
       
   729 	msg.AppendNum(iECId);
       
   730 	msg.Append(_L(", "));
       
   731 	msg.AppendNum(ETrue);
       
   732 	
       
   733 	iTrace->Trace(msg, KTraceFileName, __LINE__);
       
   734 	iAllowedCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol);	
       
   735 	
       
   736 	iTrace->Trace(_L("End of COMASuplStartState::FillAllowedCapabilities"), KTraceFileName, __LINE__); 															
       
   737 	
       
   738 	if(iPosRequestor) 
       
   739 		return;
       
   740 
       
   741 		//For Time being.... //IF POS is not there 
       
   742 		{
       
   743 				TOMASuplPosTechnology posTechnology;
       
   744 				COMASuplSETCapabilities::TOMASuplPrefMethod    prefMethod;
       
   745 				TOMASuplPosProtocol   posProtocol;
       
   746 
       
   747 				TBool  GpsSETAssisted 	= EFalse;
       
   748 				TBool  GpsSETBased 		= EFalse;
       
   749 				TBool  AutonomousGps 	= EFalse;
       
   750 				TBool  FLT 			 	= EFalse;
       
   751 
       
   752 				TBool  eOTD 		 	= EFalse;
       
   753 				TBool  oTDOA 		 	= EFalse;
       
   754 
       
   755 				TBool TIA801 = EFalse; 
       
   756 				TBool RRLP = EFalse;
       
   757 				TBool RRC =  EFalse;
       
   758 
       
   759 				posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT,
       
   760 												   eOTD,oTDOA);
       
   761 				posProtocol.SetPosProtocol(TIA801,RRLP,RRC);
       
   762 				prefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   763 
       
   764 				iSETCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol);	
       
   765 		}
       
   766 
       
   767 	}
       
   768 
       
   769 // -----------------------------------------------------------------------------
       
   770 // COMASuplStartState::ComputeCapabilities
       
   771 // Does ANDing of SETCapabilities with AllowedCapabilities & stores in SETCapabilities
       
   772 // (other items were commented in a header).
       
   773 // -----------------------------------------------------------------------------
       
   774 //
       
   775 void COMASuplStartState::ComputeCapabilities()
       
   776 {	
       
   777 	iTrace->Trace(_L("Start of COMASuplStartState::ComputeCapabilities"), KTraceFileName, __LINE__); 															
       
   778 	
       
   779 	TOMASuplPosProtocol   SETposProtocol;
       
   780 	COMASuplSETCapabilities::TOMASuplPrefMethod    SETprefMethod;
       
   781 	TOMASuplPosTechnology SETposTechnology;
       
   782 	
       
   783 	TOMASuplPosProtocol   AllowedposProtocol;
       
   784 	COMASuplSETCapabilities::TOMASuplPrefMethod    AllowedprefMethod;
       
   785 	TOMASuplPosTechnology AllowedposTechnology;
       
   786 	
       
   787 	TBool  SETGpsSETAssisted,AllowedGpsSETAssisted;
       
   788 	TBool  SETGpsSETBased,AllowedGpsSETBased;
       
   789 	TBool  SETAutonomousGps,AllowedAutonomousGps;
       
   790 	TBool  SETeOTD,AllowedeOTD;
       
   791 	TBool  SEToTDOA,AllowedoTDOA;
       
   792 	TBool SETFLT, AllowedFLT;	
       
   793 	TBool SETTIA801,AllowedTIA801; 
       
   794 	TBool SETRRLP,AllowedRRLP;
       
   795 	TBool SETRRC,AllowedRRC;
       
   796 	
       
   797 	iSETCapabilities->GetSETCapabilities(SETposTechnology,SETprefMethod,SETposProtocol);	
       
   798 	iAllowedCapabilities->GetSETCapabilities(AllowedposTechnology,AllowedprefMethod,AllowedposProtocol);	
       
   799 
       
   800 	SETposTechnology.GetPosTechnology(SETGpsSETAssisted,SETGpsSETBased,SETAutonomousGps,SETFLT,
       
   801 													   SETeOTD,SEToTDOA);
       
   802 	SETposProtocol.GetPosProtocol(SETTIA801,SETRRLP,SETRRC);
       
   803  
       
   804 
       
   805 	AllowedposTechnology.GetPosTechnology(AllowedGpsSETAssisted,AllowedGpsSETBased,AllowedAutonomousGps,AllowedFLT,
       
   806 													   AllowedeOTD,AllowedoTDOA);
       
   807 	SETposProtocol.GetPosProtocol(AllowedTIA801,AllowedRRLP,AllowedRRC);
       
   808 	AllowedprefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   809 
       
   810 	SETGpsSETAssisted &= AllowedGpsSETAssisted;
       
   811 	SETGpsSETBased &= AllowedGpsSETBased;
       
   812 	SETAutonomousGps &= AllowedAutonomousGps;
       
   813 	
       
   814 	SETFLT &= AllowedFLT; 
       
   815 	SETeOTD &=AllowedeOTD;
       
   816 	SEToTDOA &=AllowedoTDOA;
       
   817 	
       
   818 	SETTIA801 &= AllowedTIA801; 
       
   819 	SETRRLP &= AllowedRRLP;
       
   820 	SETRRC &= AllowedRRC;
       
   821 	
       
   822 	//If client has restricted SETBased and still POS msg plugin sets SETBasedPreferred.....then 
       
   823 	// it as EOMANoPreferred
       
   824 	///Save this one ...need for next message comparisions....
       
   825 	iPOSMsgSETprefMethod = SETprefMethod;
       
   826 	
       
   827 	if(SETprefMethod == COMASuplSETCapabilities::EOMAAGpsSETBasedPreferred && (!SETGpsSETBased ))
       
   828 		{
       
   829 			SETprefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   830 		}
       
   831 		
       
   832 	if(SETprefMethod == COMASuplSETCapabilities::EOMAAGpsSETAssitedPreferred  && (!SETGpsSETAssisted))
       
   833 		{
       
   834 			SETprefMethod = COMASuplSETCapabilities::EOMANoPreferred; 
       
   835 		}
       
   836 	
       
   837 	SETposTechnology.SetPosTechnology(SETGpsSETAssisted,SETGpsSETBased,SETAutonomousGps,SETFLT,
       
   838 													   SETeOTD,SEToTDOA);
       
   839 	
       
   840 	SETposProtocol.SetPosProtocol(SETTIA801,SETRRLP,SETRRC);
       
   841 	
       
   842 	iSETCapabilities->SetSETCapabilities(SETposTechnology,SETprefMethod,SETposProtocol);	
       
   843 	
       
   844 	iTrace->Trace(_L("End of COMASuplStartState::ComputeCapabilities"), KTraceFileName, __LINE__); 															
       
   845 }
       
   846 
       
   847 // -----------------------------------------------------------------------------
       
   848 // COMASuplStartState::ValidateSetCapabilities
       
   849 // 
       
   850 // (other items were commented in a header).
       
   851 // -----------------------------------------------------------------------------
       
   852 //
       
   853 TInt COMASuplStartState::ValidateSetCapabilities() 
       
   854 	{
       
   855 		if(!iPosRequestor)  //No need to check status if POS is not there
       
   856 			{
       
   857 				return KErrNone;  
       
   858 			}
       
   859 		
       
   860 		return iSETCapabilities->Status();
       
   861 	}
       
   862 	
       
   863 // -----------------------------------------------------------------------------
       
   864 // COMASuplStartState::SetQop
       
   865 // 
       
   866 // (other items were commented in a header).
       
   867 // -----------------------------------------------------------------------------
       
   868 //
       
   869 void COMASuplStartState::SetQop(TSuplTerminalQop& aQop)
       
   870 	{
       
   871 		iIsQoPPresent = ETrue;
       
   872 		iClientQop = aQop;
       
   873 	}
       
   874 
       
   875 // -----------------------------------------------------------------------------
       
   876 // COMASuplStartState::SetPrefferedBack
       
   877 // 
       
   878 // (other items were commented in a header).
       
   879 // -----------------------------------------------------------------------------
       
   880 //
       
   881 void COMASuplStartState::SetPrefferedBack()
       
   882 	{
       
   883 		TOMASuplPosProtocol   posProtocol;
       
   884 		COMASuplSETCapabilities::TOMASuplPrefMethod    prefMethod;
       
   885 		TOMASuplPosTechnology posTechnology;
       
   886 		iSETCapabilities->GetSETCapabilities(posTechnology,prefMethod,posProtocol);	
       
   887 		iSETCapabilities->SetSETCapabilities(posTechnology,iPOSMsgSETprefMethod,posProtocol);	
       
   888 		
       
   889 	}
       
   890 	
       
   891 	
       
   892 // -----------------------------------------------------------------------------
       
   893 // COMASuplStartState::GetAssistceDataFromPluginL
       
   894 // 
       
   895 // (other items were commented in a header).
       
   896 // -----------------------------------------------------------------------------
       
   897 //
       
   898 void COMASuplStartState::GetAssistceDataFromPluginL(TInt aErrorCode)
       
   899 	{
       
   900 		if(iPosRequestor)
       
   901 			{
       
   902 				TRAPD(err,GetPosParamsL());
       
   903 				
       
   904 				if(err != KErrNone && iMsgStateObserver)
       
   905 				{
       
   906 					iMsgStateObserver->OperationCompleteL(err);
       
   907 				}
       
   908 			}
       
   909 		else
       
   910 			{
       
   911 				if(iMsgStateObserver)
       
   912 				{
       
   913 					iMsgStateObserver->OperationCompleteL(aErrorCode);
       
   914 				}
       
   915 			}
       
   916 		
       
   917 	}
       
   918 
       
   919 // -----------------------------------------------------------------------------
       
   920 // COMASuplStartState::GetCurrentCellID
       
   921 // Get Current Cell id
       
   922 // 
       
   923 // (other items were commented in a header).
       
   924 // -----------------------------------------------------------------------------
       
   925 //
       
   926 void COMASuplStartState::GetCurrentCellID(TCellIdInfo& aCurrentCellId,TInt& aType)
       
   927 	{
       
   928 		TInt lRefMNC = -1;
       
   929 		TInt lRefMCC = -1;
       
   930 		TInt lRefLAC = -1;
       
   931 		TInt lRefCI  = -1;
       
   932 		aType = 0;
       
   933 		if(iLocationId)
       
   934 		{
       
   935 			iTrace->Trace(_L("Location ID ......."), KTraceFileName, __LINE__);
       
   936 			
       
   937 			TBuf<50> locationIDTypeStr;
       
   938 			locationIDTypeStr.Append(_L("Location ID Type - "));
       
   939 			COMASuplLocationId::TOMASuplCellInfoType cellInfoType;
       
   940 			COMASuplLocationId::TOMASuplStatus status;			
       
   941 			TInt err;
       
   942 
       
   943 			cellInfoType = iLocationId->SuplCellInfoType();
       
   944 			switch(cellInfoType)
       
   945 			{	
       
   946 				case COMASuplLocationId::EGSM:
       
   947 					{
       
   948 						locationIDTypeStr.Append(_L("GSM"));
       
   949 						iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__);
       
   950 						COMASuplGSMCellInfo *gsmCellInfo;
       
   951 						err = iLocationId->SuplLocationId(gsmCellInfo, status);
       
   952 						if(KErrNone == err)
       
   953 						{
       
   954 							TBuf <128> gsmCellInfoStr;
       
   955 							gsmCellInfoStr.Append(_L("GSM Cell Info:"));
       
   956 							gsmCellInfo->SuplGSMCellInfo(lRefMNC, lRefMCC, lRefCI, lRefLAC);
       
   957 							gsmCellInfoStr.Append(_L("MNC - "));
       
   958 							gsmCellInfoStr.AppendNum(lRefMNC);
       
   959 							gsmCellInfoStr.Append(_L(" MCC - "));
       
   960 							gsmCellInfoStr.AppendNum(lRefMCC);
       
   961 							gsmCellInfoStr.Append(_L(" CI - "));
       
   962 							gsmCellInfoStr.AppendNum(lRefCI);
       
   963 							gsmCellInfoStr.Append(_L(" LAC - "));
       
   964 							gsmCellInfoStr.AppendNum(lRefLAC);
       
   965 							iTrace->Trace(gsmCellInfoStr, KTraceFileName, __LINE__);
       
   966 							aType = 0;
       
   967 						}
       
   968 						break;
       
   969 					}
       
   970 				case COMASuplLocationId::EWCDMA:
       
   971 					{
       
   972 						locationIDTypeStr.Append(_L("WCDMA"));
       
   973 						iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__);
       
   974 						COMASuplCellInfo *wcdmaCellInfo;
       
   975 						err = iLocationId->SuplLocationId(wcdmaCellInfo, status);
       
   976 						if(KErrNone == err)
       
   977 						{
       
   978 							TBuf <128> wcdmaCellInfoStr;
       
   979 							wcdmaCellInfoStr.Append(_L("WCDMA Cell Info:"));
       
   980 							wcdmaCellInfo->SuplCellInfo(lRefMNC, lRefMCC, lRefCI);
       
   981 							wcdmaCellInfoStr.Append(_L("MNC - "));
       
   982 							wcdmaCellInfoStr.AppendNum(lRefMNC);
       
   983 							wcdmaCellInfoStr.Append(_L(" MCC - "));
       
   984 							wcdmaCellInfoStr.AppendNum(lRefMCC);
       
   985 							wcdmaCellInfoStr.Append(_L(" CI - "));
       
   986 							wcdmaCellInfoStr.AppendNum(lRefCI);
       
   987 							iTrace->Trace(wcdmaCellInfoStr, KTraceFileName, __LINE__);
       
   988 							aType = 1;
       
   989 						}
       
   990 						break;
       
   991 					}	
       
   992 		}
       
   993 		
       
   994 	aCurrentCellId.iCid = lRefCI;
       
   995 	aCurrentCellId.iMNC = lRefMNC; 
       
   996 	aCurrentCellId.iMCC = lRefMCC;
       
   997 	aCurrentCellId.iLac = lRefLAC;
       
   998 	}
       
   999 }	//  End of File