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