387 // Collects the optional parameters for SUPL_POS_INIT |
387 // Collects the optional parameters for SUPL_POS_INIT |
388 // message from POS Message plugin |
388 // message from POS Message plugin |
389 // (other items were commented in a header). |
389 // (other items were commented in a header). |
390 // ----------------------------------------------------------------------------- |
390 // ----------------------------------------------------------------------------- |
391 // |
391 // |
392 void COMASuplPosInitState::GetPosParamsL() |
392 void COMASuplPosInitState::GetPosParamsL() |
393 { |
393 { |
394 |
394 |
395 iGenerationStatus = ETrue; |
395 iGenerationStatus = ETrue; |
396 |
396 |
397 // Re-initialize the POS Requestor |
397 // Re-initialize the POS Requestor |
398 if(iPosRequestor) |
398 if (iPosRequestor) |
399 iPosRequestor->DestroyList(); |
399 { |
400 //Comment to ignore coverity forward NULL error |
400 iPosRequestor->DestroyList(); |
401 //coverity[FORWARD_NULL :FALSE] |
401 iPosRequestor->CreateListL(); |
402 iPosRequestor->CreateListL(); |
402 } |
403 |
403 |
404 // Create SET capabilities object |
404 // Create SET capabilities object |
405 iCurSetCapabilities = COMASuplSETCapabilities::NewL(); |
405 iCurSetCapabilities = COMASuplSETCapabilities::NewL(); |
406 |
406 |
407 // Create the Request Assistance data object |
407 // Create the Request Assistance data object |
408 iReqAsstData = COMASuplReqAsstData::NewL(); |
408 iReqAsstData = COMASuplReqAsstData::NewL(); |
409 |
409 |
410 // Create Position |
410 // Create Position |
411 iPosition = COMASuplPosition::NewL(); |
411 iPosition = COMASuplPosition::NewL(); |
412 |
412 |
413 // Create POS Payload |
413 // Create POS Payload |
414 iPosPayload = COMASuplPosPayload::NewL(); |
414 iPosPayload = COMASuplPosPayload::NewL(); |
415 |
415 |
416 // Create Velocity |
416 // Create Velocity |
417 iVelocity = COMASuplVelocity::NewL(); |
417 iVelocity = COMASuplVelocity::NewL(); |
418 |
418 |
419 if(iPosRequestor) |
419 if (iPosRequestor) |
420 { |
420 { |
421 // Append the SUPL POS INIT optional parameters to the list |
421 // Append the SUPL POS INIT optional parameters to the list |
422 // in POS Requestor |
422 // in POS Requestor |
423 iPosRequestor->AppendInfoRequest(iCurSetCapabilities); |
423 iPosRequestor->AppendInfoRequest(iCurSetCapabilities); |
424 iPosRequestor->AppendInfoRequest(iReqAsstData); |
424 iPosRequestor->AppendInfoRequest(iReqAsstData); |
425 iPosRequestor->AppendInfoRequest(iPosition); |
425 iPosRequestor->AppendInfoRequest(iPosition); |
426 iPosRequestor->AppendInfoRequest(iPosPayload); |
426 iPosRequestor->AppendInfoRequest(iPosPayload); |
427 iPosRequestor->AppendInfoRequest(iVelocity); |
427 iPosRequestor->AppendInfoRequest(iVelocity); |
428 |
428 |
429 // Set self as Observer to POS Requestor |
429 // Set self as Observer to POS Requestor |
430 //Comment to ignore coverity reverse NULL error |
430 |
431 //coverity[REVERSE_INULL :FALSE] |
|
432 iPosRequestor->SetObserver(this); |
431 iPosRequestor->SetObserver(this); |
433 |
432 |
434 TBuf<128> msg(_L("Filling iPosMethod in iPosRequestor: ")); |
433 TBuf<128> msg(_L("Filling iPosMethod in iPosRequestor: ")); |
435 iTrace->Trace(msg, KTraceFileName, __LINE__); |
434 iTrace->Trace(msg, KTraceFileName, __LINE__); |
436 |
435 |
437 iAllowedCapabilitiesforPOS.SetAllowedCapabilities(EFalse, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse); |
436 iAllowedCapabilitiesforPOS.SetAllowedCapabilities(EFalse, EFalse, |
438 iPosRequestor->SetPosMethodAndAllowedCapabilities (iAllowedCapabilitiesforPOS,iPosMethod ); |
437 EFalse, EFalse, EFalse, EFalse, EFalse, EFalse); |
439 if(iHSLPAddress) |
438 iPosRequestor->SetPosMethodAndAllowedCapabilities( |
|
439 iAllowedCapabilitiesforPOS, iPosMethod); |
|
440 if (iHSLPAddress) |
440 { |
441 { |
441 HBufC* slpAddress = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iHSLPAddress); |
442 HBufC* slpAddress = CnvUtfConverter::ConvertToUnicodeFromUtf8L( |
|
443 *iHSLPAddress); |
442 msg.Copy(_L("Filling iHSLPAddress in iPosRequestor: ")); |
444 msg.Copy(_L("Filling iHSLPAddress in iPosRequestor: ")); |
443 msg.Append(*slpAddress); |
445 msg.Append(*slpAddress); |
444 iTrace->Trace(msg, KTraceFileName, __LINE__); |
446 iTrace->Trace(msg, KTraceFileName, __LINE__); |
445 iPosRequestor->SetSLPAddressUsed(*slpAddress); |
447 iPosRequestor->SetSLPAddressUsed(*slpAddress); |
446 } |
448 } |
447 } |
449 // Get the information from POS |
448 // Get the information from POS |
450 User::LeaveIfError(iPosRequestor->GetSuplInfoL()); |
449 if(iPosRequestor) |
451 } |
450 User::LeaveIfError(iPosRequestor->GetSuplInfoL()); |
452 |
451 |
453 } |
452 } |
|
453 // ----------------------------------------------------------------------------- |
454 // ----------------------------------------------------------------------------- |
454 // COMASuplPosInitState::OperationCompleteL |
455 // COMASuplPosInitState::OperationCompleteL |
455 // An observer method that indicates the completion of |
456 // An observer method that indicates the completion of |
456 // data retrieval from POS Message plugin |
457 // data retrieval from POS Message plugin |
457 // (other items were commented in a header). |
458 // (other items were commented in a header). |
784 // ----------------------------------------------------------------------------- |
785 // ----------------------------------------------------------------------------- |
785 // |
786 // |
786 void COMASuplPosInitState::ComparisionLocationIDRequestCompletedL(COMASuplLocationId* aLocationId, |
787 void COMASuplPosInitState::ComparisionLocationIDRequestCompletedL(COMASuplLocationId* aLocationId, |
787 TInt aErrorCode) |
788 TInt aErrorCode) |
788 { |
789 { |
789 |
790 |
790 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL..."), KTraceFileName, __LINE__); |
791 iTrace->Trace( |
791 |
792 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL..."), |
792 if(aErrorCode!=KErrNone) |
793 KTraceFileName, __LINE__); |
|
794 |
|
795 if (aErrorCode != KErrNone) |
793 { |
796 { |
794 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestFailed"), KTraceFileName, __LINE__); |
797 iTrace->Trace( |
795 if(iMsgStateObserver) |
798 _L("COMASuplPosInitState::ComparisionLocationIDRequestFailed"), |
|
799 KTraceFileName, __LINE__); |
|
800 if (iMsgStateObserver) |
796 { |
801 { |
797 iMsgStateObserver->OperationCompleteL(aErrorCode); |
802 iMsgStateObserver->OperationCompleteL(aErrorCode); |
798 return; |
803 return; |
799 } |
804 } |
800 } |
805 } |
801 //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 |
806 //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 |
802 //and we have not already repeated a request before |
807 //and we have not already repeated a request before |
803 //Comment to ignore coverity forward NULL error |
808 |
804 //coverity[FORWARD_NULL :FALSE] |
809 if (!iRepeatedPosDataFetch && iLocationId->GetCellId() |
805 if(!iRepeatedPosDataFetch && iLocationId->GetCellId() == aLocationId->GetCellId()) |
810 == aLocationId->GetCellId()) |
806 { |
811 { |
807 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id not changed since making last request, so continuing"), KTraceFileName, __LINE__); |
812 delete iLocationId; |
808 if(iLocationId) |
813 iLocationId = NULL; |
809 { |
|
810 delete iLocationId; |
|
811 iLocationId = NULL; |
|
812 } |
|
813 iLocationId = aLocationId; |
814 iLocationId = aLocationId; |
814 if(iMsgStateObserver) |
815 iTrace->Trace( |
815 iMsgStateObserver->OperationCompleteL(aErrorCode); |
816 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id not changed since making last request, so continuing"), |
|
817 KTraceFileName, __LINE__); |
|
818 |
|
819 if (iMsgStateObserver) |
|
820 iMsgStateObserver->OperationCompleteL(aErrorCode); |
816 } |
821 } |
817 else // Cell id has changed since previous request so assistance data may be invalid |
822 else // Cell id has changed since previous request so assistance data may be invalid |
818 { |
823 { |
819 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id changed since making last request, retrieving toe limit"), KTraceFileName, __LINE__); |
824 iTrace->Trace( |
|
825 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL Cell Id changed since making last request, retrieving toe limit"), |
|
826 KTraceFileName, __LINE__); |
820 TOMASuplNavigationModel navModel; |
827 TOMASuplNavigationModel navModel; |
821 if(KErrNone == iReqAsstData->GetNavigationData(navModel)) |
828 if (KErrNone == iReqAsstData->GetNavigationData(navModel)) |
822 { |
829 { |
823 TInt gpsWeek, gpsToe, NSAT, toeLimit; |
830 TInt gpsWeek, gpsToe, NSAT, toeLimit; |
824 navModel.GetNavigationModel(gpsWeek, gpsToe, NSAT, toeLimit); |
831 navModel.GetNavigationModel(gpsWeek, gpsToe, NSAT, toeLimit); |
825 if(toeLimit >= KMaxCellIdChangeToeLimit) |
832 if (toeLimit >= KMaxCellIdChangeToeLimit) |
826 { |
833 { |
827 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting pos data again"), KTraceFileName, __LINE__); |
834 iTrace->Trace( |
828 if(!iRepeatedPosDataFetch)//if cell id changed and we have not already repeated fetching pos data |
835 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting pos data again"), |
|
836 KTraceFileName, __LINE__); |
|
837 iLocationId = aLocationId; //update the location id member for the next request as we are making a request again |
|
838 if (!iRepeatedPosDataFetch)//if cell id changed and we have not already repeated fetching pos data |
829 { |
839 { |
830 iRepeatedPosDataFetch = ETrue; |
840 iRepeatedPosDataFetch = ETrue; |
831 if(iLocationId) |
841 |
832 { |
842 iTrace->Trace( |
833 delete iLocationId; |
843 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting pos data again"), |
834 iLocationId = NULL; |
844 KTraceFileName, __LINE__); |
835 } |
|
836 iLocationId = aLocationId; //update the location id member for the next request as we are making a request again |
|
837 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. getting pos data again"), KTraceFileName, __LINE__); |
|
838 GetPosParamsL(); |
845 GetPosParamsL(); |
839 } |
846 } |
840 else |
847 else |
841 { |
848 { |
|
849 iLocationId = aLocationId; |
842 iRepeatedPosDataFetch = EFalse; //reset the status |
850 iRepeatedPosDataFetch = EFalse; //reset the status |
843 if(iLocationId) |
851 |
844 { |
852 iTrace->Trace( |
845 delete iLocationId; |
853 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. But repeated a pos fetch already so continuing"), |
846 iLocationId = NULL; |
854 KTraceFileName, __LINE__); |
847 } |
855 if (iMsgStateObserver) |
848 iLocationId = aLocationId; |
|
849 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit greater than KMaxCellIdChangeToeLimit. But repeated a pos fetch already so continuing"), KTraceFileName, __LINE__); |
|
850 if(iMsgStateObserver) |
|
851 iMsgStateObserver->OperationCompleteL(aErrorCode);//use the pos data as it is |
856 iMsgStateObserver->OperationCompleteL(aErrorCode);//use the pos data as it is |
852 } |
857 } |
853 } |
858 } |
854 else //ignore the position data |
859 else //ignore the position data |
855 { |
860 { |
|
861 iLocationId = aLocationId; |
856 iIgnorePosData = ETrue; |
862 iIgnorePosData = ETrue; |
857 iTrace->Trace(_L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit less than KMaxCellIdChangeToeLimit. Ignoring pos data"), KTraceFileName, __LINE__); |
863 iTrace->Trace( |
|
864 _L("COMASuplPosInitState::ComparisionLocationIDRequestCompletedL toe limit less than KMaxCellIdChangeToeLimit. Ignoring pos data"), |
|
865 KTraceFileName, __LINE__); |
858 iRepeatedPosDataFetch = EFalse; //reset the status |
866 iRepeatedPosDataFetch = EFalse; //reset the status |
859 if(iLocationId) |
867 |
860 { |
868 if (iMsgStateObserver) |
861 delete iLocationId; |
|
862 iLocationId = NULL; |
|
863 } |
|
864 iLocationId = aLocationId; |
|
865 if(iMsgStateObserver) |
|
866 iMsgStateObserver->OperationCompleteL(aErrorCode); |
869 iMsgStateObserver->OperationCompleteL(aErrorCode); |
867 } |
870 } |
868 } |
871 } |
869 } |
872 } |
870 } |
873 } |
1407 |
1410 |
1408 iTrace->Trace(_L("-------End of Position in SUPL_POSINIT ----------"), KTraceFileName, __LINE__); |
1411 iTrace->Trace(_L("-------End of Position in SUPL_POSINIT ----------"), KTraceFileName, __LINE__); |
1409 |
1412 |
1410 #endif |
1413 #endif |
1411 |
1414 |
1412 } |
1415 } |
1413 |
1416 |
1414 void COMASuplPosInitState::LogReqAssistanceData() |
1417 void COMASuplPosInitState::LogReqAssistanceData() |
1415 { |
1418 { |
1416 |
1419 |
1417 #ifdef PRINT_MESSAGE |
1420 #ifdef PRINT_MESSAGE |
1418 if(!iReqAsstData) |
1421 if (!iReqAsstData) |
1419 return; |
1422 return; |
1420 |
1423 |
1421 if(KErrNone != iReqAsstData->Status()) |
1424 if (KErrNone != iReqAsstData->Status()) |
1422 { |
|
1423 iTrace->Trace(_L("No Assistance data is provided by POS message plugin for SUPL_POSINIT "), KTraceFileName, __LINE__); |
|
1424 return; |
|
1425 } |
|
1426 |
|
1427 iTrace->Trace(_L("-------Start of Assistance data in SUPL_POSINIT ----------"), KTraceFileName, __LINE__); |
|
1428 TOMASuplNavigationModel navModel; |
|
1429 TBool almanacReq, utcModel, ionModel, dgpsCorrect, |
|
1430 refeLocation, referenceTimeRequested,acquisition, realTime; |
|
1431 |
|
1432 iReqAsstData->GetReqAsstData(almanacReq, utcModel, ionModel, dgpsCorrect, refeLocation, |
|
1433 referenceTimeRequested, acquisition, realTime); |
|
1434 |
|
1435 TBuf <300> reqAsstDataStr; |
|
1436 reqAsstDataStr.Append(_L("Requested Assistance Data - ")); |
|
1437 |
|
1438 if(almanacReq) reqAsstDataStr.Append(_L(" Almanac Requested ")); |
|
1439 if(utcModel) reqAsstDataStr.Append(_L(" UTC Model Requested ")); |
|
1440 if(ionModel) reqAsstDataStr.Append(_L(" Ionospheric Model Requested ")); |
|
1441 if(dgpsCorrect) reqAsstDataStr.Append(_L(" DGPS Corrections ")); |
|
1442 if(refeLocation) reqAsstDataStr.Append(_L(" Reference Location ")); |
|
1443 if(referenceTimeRequested) reqAsstDataStr.Append(_L(" Reference Time ")); |
|
1444 if(acquisition) reqAsstDataStr.Append(_L(" Acquisition Assistance ")); |
|
1445 if(realTime) reqAsstDataStr.Append(_L(" Real Time Integrity ")); |
|
1446 |
|
1447 iTrace->Trace(reqAsstDataStr, KTraceFileName, __LINE__); |
|
1448 |
|
1449 |
|
1450 if(KErrNone == iReqAsstData->GetNavigationData(navModel)) |
|
1451 { |
|
1452 TBuf <80> satInfoStr; |
|
1453 satInfoStr.Append(_L("Satellite Info - ")); |
|
1454 |
|
1455 TInt gpsWeek, gpsToe, NSAT, toeLimit; |
|
1456 navModel.GetNavigationModel(gpsWeek, gpsToe, NSAT, toeLimit); |
|
1457 |
|
1458 if(gpsWeek) satInfoStr.Append(_L(" GPS Week ")); |
|
1459 if(gpsToe) satInfoStr.Append(_L(" GPS Toe ")); |
|
1460 if(NSAT) satInfoStr.Append(_L(" NSAT ")); |
|
1461 if(toeLimit) satInfoStr.Append(_L(" TOE Limit")); |
|
1462 |
|
1463 iTrace->Trace(satInfoStr, KTraceFileName, __LINE__); |
|
1464 |
|
1465 RArray<TOMASuplSatelliteInfoElement> satEleArr; |
|
1466 |
|
1467 if(KErrNone == navModel.GetSatInfoElement(satEleArr)) |
|
1468 { |
|
1469 TInt count = satEleArr.Count(); |
|
1470 TBuf <50> satInfoElementStr; |
|
1471 satInfoElementStr.Append(_L("Number of Satellite Info Elements - ")); |
|
1472 satInfoElementStr.AppendNum(count); |
|
1473 iTrace->Trace(satInfoElementStr, KTraceFileName, __LINE__); |
|
1474 if(count > 0) |
|
1475 { |
|
1476 |
|
1477 TOMASuplSatelliteInfoElement satInfoEle; |
|
1478 |
|
1479 for(TInt i = 0; i < count; i ++) |
|
1480 { |
|
1481 TInt err = navModel.GetSatInfoElement(satInfoEle, i); |
|
1482 TInt satId,iode; |
|
1483 |
|
1484 satInfoEle.GetSatInfoElement(satId, iode); |
|
1485 |
|
1486 TBuf<50> satInfoEleStr; |
|
1487 satInfoEleStr.Append(_L(" Satellite Info Element - ")); |
|
1488 satInfoEleStr.AppendNum(satId); |
|
1489 satInfoEleStr.Append(_L(" ")); |
|
1490 satInfoEleStr.AppendNum(iode); |
|
1491 iTrace->Trace(satInfoEleStr, KTraceFileName, __LINE__); |
|
1492 } |
|
1493 } |
|
1494 } |
|
1495 else |
|
1496 { |
|
1497 iTrace->Trace(_L("No Satelite Info OR error in retriving Satelite Info "), KTraceFileName, __LINE__); |
|
1498 } |
|
1499 satEleArr.Close(); |
|
1500 } |
|
1501 else |
|
1502 { |
|
1503 iTrace->Trace(_L("Error in Getting Navigationl Data... "), KTraceFileName, __LINE__); |
|
1504 } |
|
1505 |
|
1506 iTrace->Trace(_L("------- End of Assistance data in SUPL_POSINIT ----------"), KTraceFileName, __LINE__); |
|
1507 |
|
1508 #endif |
|
1509 } |
|
1510 |
|
1511 void COMASuplPosInitState::LogVelocity(COMASuplVelocity* |
|
1512 #ifdef PRINT_MESSAGE |
|
1513 velocity |
|
1514 #endif |
|
1515 ) |
|
1516 { |
|
1517 |
|
1518 #ifdef PRINT_MESSAGE |
|
1519 if(velocity) |
|
1520 { |
|
1521 |
|
1522 TBuf<256> msg; |
|
1523 TOMASuplVelocityType velocityType = velocity->VelType(); |
|
1524 COMASuplHorizVelocity* horizVelocity = velocity->Velocity(); |
|
1525 TUint16 bearing; |
|
1526 TUint16 horSpeed; |
|
1527 switch(velocityType) |
|
1528 { |
|
1529 case EHorizVelocity: |
|
1530 { |
|
1531 iTrace->Trace(_L("Velocity Type : EHorizVelocity - Values "), KTraceFileName, __LINE__); |
|
1532 horizVelocity->GetHorizVel(bearing,horSpeed); |
|
1533 |
|
1534 msg.Append(_L("Bearing : ")); |
|
1535 msg.AppendNum(bearing); |
|
1536 msg.Append(_L("Horizontal Speed : ")); |
|
1537 msg.AppendNum(horSpeed); |
|
1538 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1539 break; |
|
1540 } |
|
1541 case EHorizAndVertVelocity: |
|
1542 { |
|
1543 TUint8 verDirect; |
|
1544 TUint8 verSpeed; |
|
1545 COMASuplHorizAndVertVelocity* horizVertVel = (COMASuplHorizAndVertVelocity*)horizVelocity; |
|
1546 horizVertVel->GetHorizAndVertVel(bearing,horSpeed,verDirect,verSpeed); |
|
1547 |
|
1548 iTrace->Trace(_L("Velocity Type : EHorizVelocity - Values "), KTraceFileName, __LINE__); |
|
1549 |
|
1550 msg.Append(_L("Bearing : ")); |
|
1551 msg.AppendNum(bearing); |
|
1552 msg.Append(_L("Horizontal Speed : ")); |
|
1553 msg.AppendNum(horSpeed); |
|
1554 msg.Append(_L("Vertical Direction : ")); |
|
1555 msg.AppendNum(verDirect); |
|
1556 msg.Append(_L("Vertical Speed : ")); |
|
1557 msg.AppendNum(verSpeed); |
|
1558 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1559 |
|
1560 break; |
|
1561 } |
|
1562 case EHorizUncertVelocity: |
|
1563 { |
|
1564 TUint8 uncertSpeed; |
|
1565 COMASuplHorizUncertVelocity* horizUncertVel = (COMASuplHorizUncertVelocity*)horizVelocity; |
|
1566 |
|
1567 horizUncertVel->GetHorizUncertVel(bearing,horSpeed,uncertSpeed); |
|
1568 |
|
1569 iTrace->Trace(_L("Velocity Type : EHorizUncertVelocity - Values "), KTraceFileName, __LINE__); |
|
1570 |
|
1571 msg.Append(_L("Bearing : ")); |
|
1572 msg.AppendNum(bearing); |
|
1573 msg.Append(_L("Horizontal Speed : ")); |
|
1574 msg.AppendNum(horSpeed); |
|
1575 msg.Append(_L("Uncertainity Speed : ")); |
|
1576 msg.AppendNum(uncertSpeed); |
|
1577 |
|
1578 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1579 |
|
1580 break; |
|
1581 } |
|
1582 case EHorizAndVertUncertVelocity: |
|
1583 { |
|
1584 TUint8 verDirect; |
|
1585 TUint8 verSpeed; |
|
1586 TUint8 horizUncertSpeed; |
|
1587 TUint8 vertUncertSpeed; |
|
1588 |
|
1589 COMASuplHorizAndVertUncertVelocity* horizVertUncertVel = (COMASuplHorizAndVertUncertVelocity*)horizVelocity; |
|
1590 |
|
1591 horizVertUncertVel->GetHorizVertUncertVel(bearing,horSpeed,verDirect,verSpeed, |
|
1592 horizUncertSpeed,vertUncertSpeed); |
|
1593 |
|
1594 iTrace->Trace(_L("Velocity Type : EHorizAndVertUncertVelocity - Values "), KTraceFileName, __LINE__); |
|
1595 |
|
1596 msg.Append(_L("Bearing : ")); |
|
1597 msg.AppendNum(bearing); |
|
1598 msg.Append(_L("Horizontal Speed : ")); |
|
1599 msg.AppendNum(horSpeed); |
|
1600 msg.Append(_L("Vertical Direction : ")); |
|
1601 msg.AppendNum(verDirect); |
|
1602 msg.Append(_L("Vertical Speed : ")); |
|
1603 msg.AppendNum(verSpeed); |
|
1604 msg.Append(_L("Horiz Uncertain Speed : ")); |
|
1605 msg.AppendNum(horizUncertSpeed); |
|
1606 msg.Append(_L("Vertical Uncertain Speed : ")); |
|
1607 msg.AppendNum(vertUncertSpeed); |
|
1608 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1609 |
|
1610 break; |
|
1611 } |
|
1612 } |
|
1613 } |
|
1614 #endif |
|
1615 } |
|
1616 |
|
1617 void COMASuplPosInitState::LogPacket(const TDesC8& |
|
1618 #ifdef PRINT_MESSAGE |
|
1619 aPacket |
|
1620 #endif |
|
1621 ) |
|
1622 { |
|
1623 |
|
1624 #ifdef PRINT_MESSAGE |
|
1625 RFile file; |
|
1626 RFs fs; |
|
1627 TInt cErr=fs.Connect(); |
|
1628 |
|
1629 TInt fErr = file.Open(fs,_L("c:\\logs\\epos\\POSINITpacket.txt"),EFileWrite|EFileShareAny); |
|
1630 if (fErr == KErrNotFound) |
|
1631 { |
|
1632 file.Create(fs, _L("c:\\logs\\epos\\POSINITpacket.txt"), EFileWrite|EFileShareAny); |
|
1633 fErr = file.Open(fs,_L("c:\\logs\\epos\\POSINITpacket.txt"), EFileWrite|EFileShareAny); |
|
1634 } |
|
1635 |
|
1636 TInt aPos; |
|
1637 file.Seek(ESeekEnd, aPos); |
|
1638 file.Write(aPacket); |
|
1639 file.Close(); |
|
1640 fs.Close(); |
|
1641 #endif |
|
1642 } |
|
1643 |
|
1644 void COMASuplPosInitState::PrintHex(const TDesC8& |
|
1645 #ifdef PRINT_MESSAGE |
|
1646 aBuffer |
|
1647 #endif |
|
1648 , |
|
1649 TInt |
|
1650 #ifdef PRINT_MESSAGE |
|
1651 aLine |
|
1652 #endif |
|
1653 ) |
|
1654 { |
|
1655 #ifdef PRINT_MESSAGE |
|
1656 TBuf<256> buffer; |
|
1657 TBuf<2> buff; |
|
1658 _LIT16(KFormat1,"%02x"); |
|
1659 TInt len = aBuffer.Length(); |
|
1660 for(TInt i = 0 ; i <len; i++) |
|
1661 { |
|
1662 buff.Zero(); |
|
1663 buff.Format(KFormat1,aBuffer[i]); |
|
1664 buffer.Append(buff); |
|
1665 buffer.Append(_L(" ")); |
|
1666 } |
|
1667 |
|
1668 iTrace->Trace(buffer, KTraceFileName, aLine); |
|
1669 #endif |
|
1670 } |
|
1671 |
|
1672 void COMASuplPosInitState::SetTriggerSessionFlag(TBool aTriggerFlag) |
|
1673 { |
|
1674 iTriggerFlag = aTriggerFlag; |
|
1675 } |
|
1676 |
|
1677 TBool COMASuplPosInitState::GetTriggerSessionFlag() |
|
1678 { |
|
1679 return iTriggerFlag; |
|
1680 } |
|
1681 void COMASuplPosInitState::CopyLocationidToLocationId2L(COMASuplLocationIdVer2* aLocationId2) |
|
1682 { |
|
1683 |
|
1684 COMASuplLocationId::TOMASuplCellInfoType cellType = iLocationId->SuplCellInfoType(); |
|
1685 if( cellType == COMASuplLocationId::EGSM) |
|
1686 { |
1425 { |
1687 TInt MNC,MCC,CI,Lac; |
1426 iTrace->Trace( |
1688 COMASuplGSMCellInfo* cellInfo; |
1427 _L("No Assistance data is provided by POS message plugin for SUPL_POSINIT "), |
1689 COMASuplLocationId::TOMASuplStatus status; |
1428 KTraceFileName, __LINE__); |
1690 iLocationId->SuplLocationId(cellInfo, status); |
1429 return; |
1691 cellInfo->SuplGSMCellInfo(MNC,MCC,CI,Lac); |
1430 } |
1692 |
1431 |
1693 COMASuplGSMCellInfo* gsmCellInfo = COMASuplGSMCellInfo::NewL(); |
1432 iTrace->Trace( |
1694 gsmCellInfo->SetSuplGSMCellInfo(MNC,MCC,CI,Lac); |
1433 _L("-------Start of Assistance data in SUPL_POSINIT ----------"), |
1695 aLocationId2->SetSuplLocationId(gsmCellInfo, status); |
1434 KTraceFileName, __LINE__); |
|
1435 TOMASuplNavigationModel navModel; |
|
1436 TBool almanacReq, utcModel, ionModel, dgpsCorrect, refeLocation, |
|
1437 referenceTimeRequested, acquisition, realTime; |
|
1438 |
|
1439 iReqAsstData->GetReqAsstData(almanacReq, utcModel, ionModel, dgpsCorrect, |
|
1440 refeLocation, referenceTimeRequested, acquisition, realTime); |
|
1441 |
|
1442 TBuf<300> reqAsstDataStr; |
|
1443 reqAsstDataStr.Append(_L("Requested Assistance Data - ")); |
|
1444 |
|
1445 if (almanacReq) |
|
1446 reqAsstDataStr.Append(_L(" Almanac Requested ")); |
|
1447 if (utcModel) |
|
1448 reqAsstDataStr.Append(_L(" UTC Model Requested ")); |
|
1449 if (ionModel) |
|
1450 reqAsstDataStr.Append(_L(" Ionospheric Model Requested ")); |
|
1451 if (dgpsCorrect) |
|
1452 reqAsstDataStr.Append(_L(" DGPS Corrections ")); |
|
1453 if (refeLocation) |
|
1454 reqAsstDataStr.Append(_L(" Reference Location ")); |
|
1455 if (referenceTimeRequested) |
|
1456 reqAsstDataStr.Append(_L(" Reference Time ")); |
|
1457 if (acquisition) |
|
1458 reqAsstDataStr.Append(_L(" Acquisition Assistance ")); |
|
1459 if (realTime) |
|
1460 reqAsstDataStr.Append(_L(" Real Time Integrity ")); |
|
1461 |
|
1462 iTrace->Trace(reqAsstDataStr, KTraceFileName, __LINE__); |
|
1463 |
|
1464 if (KErrNone == iReqAsstData->GetNavigationData(navModel)) |
|
1465 { |
|
1466 TBuf<80> satInfoStr; |
|
1467 satInfoStr.Append(_L("Satellite Info - ")); |
|
1468 |
|
1469 TInt gpsWeek, gpsToe, NSAT, toeLimit; |
|
1470 navModel.GetNavigationModel(gpsWeek, gpsToe, NSAT, toeLimit); |
|
1471 |
|
1472 if (gpsWeek) |
|
1473 satInfoStr.Append(_L(" GPS Week ")); |
|
1474 if (gpsToe) |
|
1475 satInfoStr.Append(_L(" GPS Toe ")); |
|
1476 if (NSAT) |
|
1477 satInfoStr.Append(_L(" NSAT ")); |
|
1478 if (toeLimit) |
|
1479 satInfoStr.Append(_L(" TOE Limit")); |
|
1480 |
|
1481 iTrace->Trace(satInfoStr, KTraceFileName, __LINE__); |
|
1482 |
|
1483 RArray<TOMASuplSatelliteInfoElement> satEleArr; |
|
1484 |
|
1485 if (KErrNone == navModel.GetSatInfoElement(satEleArr)) |
|
1486 { |
|
1487 TInt count = satEleArr.Count(); |
|
1488 TBuf<50> satInfoElementStr; |
|
1489 satInfoElementStr.Append( |
|
1490 _L("Number of Satellite Info Elements - ")); |
|
1491 satInfoElementStr.AppendNum(count); |
|
1492 iTrace->Trace(satInfoElementStr, KTraceFileName, __LINE__); |
|
1493 if (count > 0) |
|
1494 { |
|
1495 |
|
1496 TOMASuplSatelliteInfoElement satInfoEle; |
|
1497 |
|
1498 for (TInt i = 0; i < count; i++) |
|
1499 { |
|
1500 TInt err = navModel.GetSatInfoElement(satInfoEle, i); |
|
1501 TInt satId, iode; |
|
1502 |
|
1503 satInfoEle.GetSatInfoElement(satId, iode); |
|
1504 |
|
1505 TBuf<50> satInfoEleStr; |
|
1506 satInfoEleStr.Append(_L(" Satellite Info Element - ")); |
|
1507 satInfoEleStr.AppendNum(satId); |
|
1508 satInfoEleStr.Append(_L(" ")); |
|
1509 satInfoEleStr.AppendNum(iode); |
|
1510 iTrace->Trace(satInfoEleStr, KTraceFileName, __LINE__); |
|
1511 } |
|
1512 } |
|
1513 } |
|
1514 else |
|
1515 { |
|
1516 iTrace->Trace( |
|
1517 _L("No Satelite Info OR error in retriving Satelite Info "), |
|
1518 KTraceFileName, __LINE__); |
|
1519 } |
|
1520 satEleArr.Close(); |
1696 } |
1521 } |
1697 else |
1522 else |
1698 { |
1523 { |
1699 TInt MNC,MCC,CI; |
1524 iTrace->Trace(_L("Error in Getting Navigationl Data... "), |
1700 COMASuplCellInfo* cellInfo; |
1525 KTraceFileName, __LINE__); |
1701 COMASuplLocationId::TOMASuplStatus status; |
|
1702 //Comment to ignore coverity checked return error |
|
1703 //coverity[CHECKED_RETURN :FALSE] |
|
1704 iLocationId->SuplLocationId(cellInfo, status); |
|
1705 cellInfo->SuplCellInfo(MNC,MCC,CI); |
|
1706 |
|
1707 COMASuplCellInfo* wcdmaCellInfo = COMASuplCellInfo::NewL(); |
|
1708 wcdmaCellInfo->SetSuplCellInfo(MNC,MCC,CI); |
|
1709 aLocationId2->SetSuplLocationId(wcdmaCellInfo, status); |
|
1710 } |
1526 } |
1711 |
1527 |
|
1528 iTrace->Trace( |
|
1529 _L("------- End of Assistance data in SUPL_POSINIT ----------"), |
|
1530 KTraceFileName, __LINE__); |
|
1531 |
|
1532 #endif |
|
1533 } |
|
1534 |
|
1535 void COMASuplPosInitState::LogVelocity(COMASuplVelocity* |
|
1536 #ifdef PRINT_MESSAGE |
|
1537 velocity |
|
1538 #endif |
|
1539 ) |
|
1540 { |
|
1541 |
|
1542 #ifdef PRINT_MESSAGE |
|
1543 if (velocity) |
|
1544 { |
|
1545 |
|
1546 TBuf<256> msg; |
|
1547 TOMASuplVelocityType velocityType = velocity->VelType(); |
|
1548 COMASuplHorizVelocity* horizVelocity = velocity->Velocity(); |
|
1549 TUint16 bearing; |
|
1550 TUint16 horSpeed; |
|
1551 switch (velocityType) |
|
1552 { |
|
1553 case EHorizVelocity: |
|
1554 { |
|
1555 iTrace->Trace(_L("Velocity Type : EHorizVelocity - Values "), |
|
1556 KTraceFileName, __LINE__); |
|
1557 horizVelocity->GetHorizVel(bearing, horSpeed); |
|
1558 |
|
1559 msg.Append(_L("Bearing : ")); |
|
1560 msg.AppendNum(bearing); |
|
1561 msg.Append(_L("Horizontal Speed : ")); |
|
1562 msg.AppendNum(horSpeed); |
|
1563 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1564 break; |
|
1565 } |
|
1566 case EHorizAndVertVelocity: |
|
1567 { |
|
1568 TUint8 verDirect; |
|
1569 TUint8 verSpeed; |
|
1570 COMASuplHorizAndVertVelocity* horizVertVel = |
|
1571 (COMASuplHorizAndVertVelocity*) horizVelocity; |
|
1572 horizVertVel->GetHorizAndVertVel(bearing, horSpeed, |
|
1573 verDirect, verSpeed); |
|
1574 |
|
1575 iTrace->Trace(_L("Velocity Type : EHorizVelocity - Values "), |
|
1576 KTraceFileName, __LINE__); |
|
1577 |
|
1578 msg.Append(_L("Bearing : ")); |
|
1579 msg.AppendNum(bearing); |
|
1580 msg.Append(_L("Horizontal Speed : ")); |
|
1581 msg.AppendNum(horSpeed); |
|
1582 msg.Append(_L("Vertical Direction : ")); |
|
1583 msg.AppendNum(verDirect); |
|
1584 msg.Append(_L("Vertical Speed : ")); |
|
1585 msg.AppendNum(verSpeed); |
|
1586 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1587 |
|
1588 break; |
|
1589 } |
|
1590 case EHorizUncertVelocity: |
|
1591 { |
|
1592 TUint8 uncertSpeed; |
|
1593 COMASuplHorizUncertVelocity* horizUncertVel = |
|
1594 (COMASuplHorizUncertVelocity*) horizVelocity; |
|
1595 |
|
1596 horizUncertVel->GetHorizUncertVel(bearing, horSpeed, |
|
1597 uncertSpeed); |
|
1598 |
|
1599 iTrace->Trace( |
|
1600 _L("Velocity Type : EHorizUncertVelocity - Values "), |
|
1601 KTraceFileName, __LINE__); |
|
1602 |
|
1603 msg.Append(_L("Bearing : ")); |
|
1604 msg.AppendNum(bearing); |
|
1605 msg.Append(_L("Horizontal Speed : ")); |
|
1606 msg.AppendNum(horSpeed); |
|
1607 msg.Append(_L("Uncertainity Speed : ")); |
|
1608 msg.AppendNum(uncertSpeed); |
|
1609 |
|
1610 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1611 |
|
1612 break; |
|
1613 } |
|
1614 case EHorizAndVertUncertVelocity: |
|
1615 { |
|
1616 TUint8 verDirect; |
|
1617 TUint8 verSpeed; |
|
1618 TUint8 horizUncertSpeed; |
|
1619 TUint8 vertUncertSpeed; |
|
1620 |
|
1621 COMASuplHorizAndVertUncertVelocity* horizVertUncertVel = |
|
1622 (COMASuplHorizAndVertUncertVelocity*) horizVelocity; |
|
1623 |
|
1624 horizVertUncertVel->GetHorizVertUncertVel(bearing, horSpeed, |
|
1625 verDirect, verSpeed, horizUncertSpeed, |
|
1626 vertUncertSpeed); |
|
1627 |
|
1628 iTrace->Trace( |
|
1629 _L("Velocity Type : EHorizAndVertUncertVelocity - Values "), |
|
1630 KTraceFileName, __LINE__); |
|
1631 |
|
1632 msg.Append(_L("Bearing : ")); |
|
1633 msg.AppendNum(bearing); |
|
1634 msg.Append(_L("Horizontal Speed : ")); |
|
1635 msg.AppendNum(horSpeed); |
|
1636 msg.Append(_L("Vertical Direction : ")); |
|
1637 msg.AppendNum(verDirect); |
|
1638 msg.Append(_L("Vertical Speed : ")); |
|
1639 msg.AppendNum(verSpeed); |
|
1640 msg.Append(_L("Horiz Uncertain Speed : ")); |
|
1641 msg.AppendNum(horizUncertSpeed); |
|
1642 msg.Append(_L("Vertical Uncertain Speed : ")); |
|
1643 msg.AppendNum(vertUncertSpeed); |
|
1644 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1645 |
|
1646 break; |
|
1647 } |
|
1648 } |
|
1649 } |
|
1650 #endif |
|
1651 } |
|
1652 |
|
1653 void COMASuplPosInitState::LogPacket(const TDesC8& |
|
1654 #ifdef PRINT_MESSAGE |
|
1655 aPacket |
|
1656 #endif |
|
1657 ) |
|
1658 { |
|
1659 |
|
1660 #ifdef PRINT_MESSAGE |
|
1661 RFile file; |
|
1662 RFs fs; |
|
1663 TInt cErr = fs.Connect(); |
|
1664 |
|
1665 TInt fErr = file.Open(fs, _L("c:\\logs\\epos\\POSINITpacket.txt"), |
|
1666 EFileWrite | EFileShareAny); |
|
1667 if (fErr == KErrNotFound) |
|
1668 { |
|
1669 file.Create(fs, _L("c:\\logs\\epos\\POSINITpacket.txt"), EFileWrite |
|
1670 | EFileShareAny); |
|
1671 fErr = file.Open(fs, _L("c:\\logs\\epos\\POSINITpacket.txt"), |
|
1672 EFileWrite | EFileShareAny); |
|
1673 } |
|
1674 |
|
1675 TInt aPos; |
|
1676 file.Seek(ESeekEnd, aPos); |
|
1677 file.Write(aPacket); |
|
1678 file.Close(); |
|
1679 fs.Close(); |
|
1680 #endif |
|
1681 } |
|
1682 |
|
1683 void COMASuplPosInitState::PrintHex(const TDesC8& |
|
1684 #ifdef PRINT_MESSAGE |
|
1685 aBuffer |
|
1686 #endif |
|
1687 , TInt |
|
1688 #ifdef PRINT_MESSAGE |
|
1689 aLine |
|
1690 #endif |
|
1691 ) |
|
1692 { |
|
1693 #ifdef PRINT_MESSAGE |
|
1694 TBuf<256> buffer; |
|
1695 TBuf<2> buff; |
|
1696 _LIT16(KFormat1,"%02x"); |
|
1697 TInt len = aBuffer.Length(); |
|
1698 for (TInt i = 0; i < len; i++) |
|
1699 { |
|
1700 buff.Zero(); |
|
1701 buff.Format(KFormat1, aBuffer[i]); |
|
1702 buffer.Append(buff); |
|
1703 buffer.Append(_L(" ")); |
|
1704 } |
|
1705 |
|
1706 iTrace->Trace(buffer, KTraceFileName, aLine); |
|
1707 #endif |
|
1708 } |
|
1709 |
|
1710 void COMASuplPosInitState::SetTriggerSessionFlag(TBool aTriggerFlag) |
|
1711 { |
|
1712 iTriggerFlag = aTriggerFlag; |
|
1713 } |
|
1714 |
|
1715 TBool COMASuplPosInitState::GetTriggerSessionFlag() |
|
1716 { |
|
1717 return iTriggerFlag; |
|
1718 } |
|
1719 void COMASuplPosInitState::CopyLocationidToLocationId2L( |
|
1720 COMASuplLocationIdVer2* aLocationId2) |
|
1721 { |
|
1722 |
|
1723 COMASuplLocationId::TOMASuplCellInfoType cellType = |
|
1724 iLocationId->SuplCellInfoType(); |
|
1725 if (cellType == COMASuplLocationId::EGSM) |
|
1726 { |
|
1727 TInt MNC, MCC, CI, Lac; |
|
1728 COMASuplGSMCellInfo* cellInfo; |
|
1729 COMASuplLocationId::TOMASuplStatus status; |
|
1730 TInt err = iLocationId->SuplLocationId(cellInfo, status); |
|
1731 if (err != KErrNone) |
|
1732 return; |
|
1733 cellInfo->SuplGSMCellInfo(MNC, MCC, CI, Lac); |
|
1734 |
|
1735 COMASuplGSMCellInfo* gsmCellInfo = COMASuplGSMCellInfo::NewL(); |
|
1736 gsmCellInfo->SetSuplGSMCellInfo(MNC, MCC, CI, Lac); |
|
1737 aLocationId2->SetSuplLocationId(gsmCellInfo, status); |
|
1738 } |
|
1739 else |
|
1740 { |
|
1741 TInt MNC, MCC, CI; |
|
1742 COMASuplCellInfo* cellInfo; |
|
1743 COMASuplLocationId::TOMASuplStatus status; |
|
1744 |
|
1745 TInt err = iLocationId->SuplLocationId(cellInfo, status); |
|
1746 if (err != KErrNone) |
|
1747 return; |
|
1748 cellInfo->SuplCellInfo(MNC, MCC, CI); |
|
1749 COMASuplCellInfo* wcdmaCellInfo = COMASuplCellInfo::NewL(); |
|
1750 wcdmaCellInfo->SetSuplCellInfo(MNC, MCC, CI); |
|
1751 aLocationId2->SetSuplLocationId(wcdmaCellInfo, status); |
|
1752 } |
1712 |
1753 |
1713 } |
1754 } |
1714 // End of File |
1755 // End of File |
1715 |
1756 |
1716 |
1757 |