supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplposinitstate.cpp
changeset 39 3efc7a0e8755
parent 32 b12ea03c50a3
equal deleted inserted replaced
37:e175e2ba2fb0 39:3efc7a0e8755
   382 // Collects the optional parameters for SUPL_POS_INIT 
   382 // Collects the optional parameters for SUPL_POS_INIT 
   383 // message from POS Message plugin
   383 // message from POS Message plugin
   384 // (other items were commented in a header).
   384 // (other items were commented in a header).
   385 // -----------------------------------------------------------------------------
   385 // -----------------------------------------------------------------------------
   386 //
   386 //
   387 void COMASuplPosInitState::GetPosParamsL() 
   387 void COMASuplPosInitState::GetPosParamsL()
   388 	{
   388     {
   389 	
   389 
   390 	iGenerationStatus = ETrue;
   390     iGenerationStatus = ETrue;
   391 	
   391 
   392 	// Re-initialize the POS Requestor
   392     // Re-initialize the POS Requestor
   393 	if(iPosRequestor)
   393     if (iPosRequestor)
   394 		iPosRequestor->DestroyList();
   394         {
   395 	//Comment to ignore coverity forward NULL stack error
   395         iPosRequestor->DestroyList();
   396     //coverity[FORWARD_NULL   :FALSE]
   396         iPosRequestor->CreateListL();
   397 	iPosRequestor->CreateListL();
   397         }
   398 	
   398 
   399 	// Create SET capabilities object
   399     // Create SET capabilities object
   400 	iCurSetCapabilities = COMASuplSETCapabilities::NewL();
   400     iCurSetCapabilities = COMASuplSETCapabilities::NewL();
   401 	
   401 
   402 	// Create the Request Assistance data object
   402     // Create the Request Assistance data object
   403 	iReqAsstData = COMASuplReqAsstData::NewL();
   403     iReqAsstData = COMASuplReqAsstData::NewL();
   404 	
   404 
   405 	// Create Position
   405     // Create Position
   406 	iPosition = COMASuplPosition::NewL();
   406     iPosition = COMASuplPosition::NewL();
   407 
   407 
   408 	// Create POS Payload
   408     // Create POS Payload
   409 	iPosPayload = COMASuplPosPayload::NewL();
   409     iPosPayload = COMASuplPosPayload::NewL();
   410 
   410 
   411 	// Create Velocity
   411     // Create Velocity
   412 	iVelocity = COMASuplVelocity::NewL();
   412     iVelocity = COMASuplVelocity::NewL();
   413 	
   413 
   414     if(iPosRequestor)
   414     if (iPosRequestor)
   415         {
   415         {
   416         // Append the SUPL POS INIT optional parameters to the list
   416         // Append the SUPL POS INIT optional parameters to the list
   417         // in POS Requestor
   417         // in POS Requestor
   418         iPosRequestor->AppendInfoRequest(iCurSetCapabilities);
   418         iPosRequestor->AppendInfoRequest(iCurSetCapabilities);
   419         iPosRequestor->AppendInfoRequest(iReqAsstData);
   419         iPosRequestor->AppendInfoRequest(iReqAsstData);
   420         iPosRequestor->AppendInfoRequest(iPosition);
   420         iPosRequestor->AppendInfoRequest(iPosition);
   421         iPosRequestor->AppendInfoRequest(iPosPayload);
   421         iPosRequestor->AppendInfoRequest(iPosPayload);
   422         iPosRequestor->AppendInfoRequest(iVelocity);
   422         iPosRequestor->AppendInfoRequest(iVelocity);
   423 	
   423 
   424 
       
   425 	
       
   426         TBuf<128> msg(_L("Filling iPosMethod in iPosRequestor: "));
   424         TBuf<128> msg(_L("Filling iPosMethod in iPosRequestor: "));
   427         iTrace->Trace(msg, KTraceFileName, __LINE__); 
   425         iTrace->Trace(msg, KTraceFileName, __LINE__);
   428 
   426 
   429         // Set self as Observer to POS Requestor
   427         // Set self as Observer to POS Requestor
   430 		//Comment to ignore coverity reverse NULL error
   428         //Comment to ignore coverity reverse NULL error
   431         //coverity[REVERSE_INULL :FALSE]
   429         //coverity[REVERSE_INULL :FALSE]
   432         iPosRequestor->SetObserver(this);
   430         iPosRequestor->SetObserver(this);
   433         iAllowedCapabilitiesforPOS.SetAllowedCapabilities(EFalse, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse);
   431         iAllowedCapabilitiesforPOS.SetAllowedCapabilities(EFalse, EFalse,
   434         iPosRequestor->SetPosMethodAndAllowedCapabilities (iAllowedCapabilitiesforPOS,iPosMethod ); 
   432                 EFalse, EFalse, EFalse, EFalse, EFalse, EFalse);
   435         if(iHSLPAddress)
   433         iPosRequestor->SetPosMethodAndAllowedCapabilities(
       
   434                 iAllowedCapabilitiesforPOS, iPosMethod);
       
   435         if (iHSLPAddress)
   436             {
   436             {
   437             HBufC* slpAddress = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iHSLPAddress);
   437             HBufC* slpAddress = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
       
   438                     *iHSLPAddress);
   438             msg.Copy(_L("Filling iHSLPAddress in iPosRequestor: "));
   439             msg.Copy(_L("Filling iHSLPAddress in iPosRequestor: "));
   439             msg.Append(*slpAddress);
   440             msg.Append(*slpAddress);
   440             iTrace->Trace(msg, KTraceFileName, __LINE__); 
   441             iTrace->Trace(msg, KTraceFileName, __LINE__);
   441             iPosRequestor->SetSLPAddressUsed(*slpAddress);
   442             iPosRequestor->SetSLPAddressUsed(*slpAddress);
   442             }
   443             }
   443 		}
   444         // Get the information from POS
   444 	// Get the information from POS
   445         User::LeaveIfError(iPosRequestor->GetSuplInfoL());
   445 	if(iPosRequestor)
   446         }
   446 	User::LeaveIfError(iPosRequestor->GetSuplInfoL());
   447 
   447 	
   448     }
   448 	}
       
   449 // -----------------------------------------------------------------------------
   449 // -----------------------------------------------------------------------------
   450 // COMASuplPosInitState::OperationCompleteL
   450 // COMASuplPosInitState::OperationCompleteL
   451 // An observer method that indicates the completion of
   451 // An observer method that indicates the completion of
   452 // data retrieval from POS Message plugin
   452 // data retrieval from POS Message plugin
   453 // (other items were commented in a header).
   453 // (other items were commented in a header).
   745             return;
   745             return;
   746             }
   746             }
   747         }
   747         }
   748     //if the current Cell id is the same as the Cell id when we made the request for assistance data then use the assistance data
   748     //if the current Cell id is the same as the Cell id when we made the request for assistance data then use the assistance data
   749     //and we have not already repeated a request before
   749     //and we have not already repeated a request before
   750     if(!iRepeatedPosDataFetch && iLocationId->GetCellId() == aLocationId->GetCellId()) 
   750     if (!iRepeatedPosDataFetch && iLocationId->GetCellId()
       
   751             == aLocationId->GetCellId())
   751         {
   752         {
   752         iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id not changed since making last request, so continuing"), KTraceFileName, __LINE__); 
   753         //deleting locationId before assigning it again
   753         if(iLocationId)
   754         delete iLocationId;
   754             delete iLocationId;
   755         iLocationId = NULL;
   755         //coverity[REVERSE_INULL  :FALSE]
       
   756         iLocationId = aLocationId;
   756         iLocationId = aLocationId;
   757         if(iMsgStateObserver)
   757 
   758         iMsgStateObserver->OperationCompleteL(aErrorCode);
   758         iTrace->Trace(
       
   759                 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id not changed since making last request, so continuing"),
       
   760                 KTraceFileName, __LINE__);
       
   761         if (iMsgStateObserver)
       
   762             iMsgStateObserver->OperationCompleteL(aErrorCode);
   759         }
   763         }
   760     else // Cell id has changed since previous request so assistance data may be invalid
   764     else // Cell id has changed since previous request so assistance data may be invalid
   761         {
   765         {
   762         iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id changed since making last request, retrieving toe limit"), KTraceFileName, __LINE__);
   766         iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id changed since making last request, retrieving toe limit"), KTraceFileName, __LINE__);
   763         TOMASuplNavigationModel navModel;
   767         TOMASuplNavigationModel navModel;
   768             if(toeLimit >= KMaxCellIdChangeToeLimit) 
   772             if(toeLimit >= KMaxCellIdChangeToeLimit) 
   769                 {
   773                 {
   770                 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting  pos data again"), KTraceFileName, __LINE__);
   774                 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting  pos data again"), KTraceFileName, __LINE__);
   771                 if(!iRepeatedPosDataFetch)//if cell id changed and we have not already repeated fetching pos data
   775                 if(!iRepeatedPosDataFetch)//if cell id changed and we have not already repeated fetching pos data
   772                     {
   776                     {
       
   777                     iLocationId = aLocationId; //update the location id member for the next request as we are making a request again
   773                     iRepeatedPosDataFetch = ETrue;
   778                     iRepeatedPosDataFetch = ETrue;
   774                     if(iLocationId)
   779 
   775                         delete iLocationId;                    
   780                     iTrace->Trace(
   776                     iLocationId = aLocationId; //update the location id member for the next request as we are making a request again
   781                             _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting  pos data again"),
   777                     iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting  pos data again"), KTraceFileName, __LINE__);
   782                             KTraceFileName, __LINE__);
   778                     GetPosParamsL();
   783                     GetPosParamsL();
   779                     }
   784                     }
   780                 else
   785                 else
   781                     {
   786                     {
       
   787                     iLocationId = aLocationId;
   782                     iRepeatedPosDataFetch = EFalse; //reset the status
   788                     iRepeatedPosDataFetch = EFalse; //reset the status
   783                     if(iLocationId)
   789 
   784                        delete iLocationId;
   790                     iTrace->Trace(
   785                     iLocationId = aLocationId;
   791                             _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. But repeated a pos fetch already so continuing"),
   786                     iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. But repeated a pos fetch already so continuing"), KTraceFileName, __LINE__);
   792                             KTraceFileName, __LINE__);
   787                     if(iMsgStateObserver)
   793                     if (iMsgStateObserver)
   788                         iMsgStateObserver->OperationCompleteL(aErrorCode);//use the pos data as it is
   794                         iMsgStateObserver->OperationCompleteL(aErrorCode);//use the pos data as it is
   789                     }
   795                     }
   790                 }
   796                 }
   791             else //ignore the position data
   797             else //ignore the position data
   792                 {
   798                 {
       
   799                 iLocationId = aLocationId;
   793                 iIgnorePosData = ETrue;
   800                 iIgnorePosData = ETrue;
   794                 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit less than KMaxCellIdChangeToeLimit. Ignoring pos data"), KTraceFileName, __LINE__);
   801                 iTrace->Trace(
       
   802                         _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit less than KMaxCellIdChangeToeLimit. Ignoring pos data"),
       
   803                         KTraceFileName, __LINE__);
   795                 iRepeatedPosDataFetch = EFalse; //reset the status
   804                 iRepeatedPosDataFetch = EFalse; //reset the status
   796                 if(iLocationId)
   805 
   797                 	delete iLocationId;
   806                 if (iMsgStateObserver)
   798                 iLocationId = aLocationId;
       
   799                 if(iMsgStateObserver)
       
   800                     iMsgStateObserver->OperationCompleteL(aErrorCode);
   807                     iMsgStateObserver->OperationCompleteL(aErrorCode);
   801                 }
   808                 }
   802             }
   809             }
   803         }
   810         }
   804     }
   811     }