44 #include "epos_omasuplconfigurationkeys.h" |
44 #include "epos_omasuplconfigurationkeys.h" |
45 #include "epos_comasupltrace.h" |
45 #include "epos_comasupltrace.h" |
46 #include "epos_comasupltimeouttimer.h" |
46 #include "epos_comasupltimeouttimer.h" |
47 #include "epos_omasuplconstants.h" |
47 #include "epos_omasuplconstants.h" |
48 #include "epos_comasuplcommonconfig.h" |
48 #include "epos_comasuplcommonconfig.h" |
49 #include "epos_suplgeocellinfo.h" |
|
50 |
|
51 #include "epos_comasupllocationid.h" |
|
52 |
49 |
53 _LIT(KTraceFileName,"SUPL_OMA_PH::EPos_COMASUPLProtocolManager1.cpp"); |
50 _LIT(KTraceFileName,"SUPL_OMA_PH::EPos_COMASUPLProtocolManager1.cpp"); |
54 |
51 |
55 const TInt KMaxIMSILen = 20; |
52 const TInt KMaxIMSILen = 20; |
56 const TInt KMaxDelay = 128; |
53 const TInt KMaxDelay = 128; |
1623 iPreviousMessageLength = 0 ; |
1612 iPreviousMessageLength = 0 ; |
1624 iIsPreviouslyDecodingFailed = EFalse; |
1613 iIsPreviouslyDecodingFailed = EFalse; |
1625 } |
1614 } |
1626 |
1615 |
1627 |
1616 |
|
1617 // ----------------------------------------------------------------------------- |
|
1618 // COMASUPLProtocolManager1::LaunchSettingsUI |
|
1619 // |
|
1620 // |
|
1621 // ----------------------------------------------------------------------------- |
|
1622 // |
|
1623 TInt COMASUPLProtocolManager1::LaunchSettingsUI(MOMASuplUICompletionObserver* aObserver,const TDesC& aForHslp) |
|
1624 { |
|
1625 iTrace->Trace(_L("COMASUPLProtocolManager1::LaunchSettingsUI"), KTraceFileName, __LINE__); |
|
1626 |
|
1627 if(iUIRequestArray.Count() <= 0 ) |
|
1628 { |
|
1629 iTrace->Trace(_L("COMASUPLProtocolManager1::LaunchSettingsUI"), KTraceFileName, __LINE__); |
|
1630 iUIRequestArray.Append(aObserver); |
|
1631 iSuplSettings->SetUIActive(ETrue); |
|
1632 iCurrentlyUsedHslp.Copy(aForHslp); |
|
1633 return iSettingsLauncher->LaunchSettings(); |
|
1634 } |
|
1635 else if(iCurrentlyUsedHslp.Compare(aForHslp) == KErrNone) |
|
1636 { |
|
1637 iUIRequestArray.Append(aObserver); |
|
1638 } |
|
1639 else |
|
1640 { |
|
1641 return KErrInUse; |
|
1642 } |
|
1643 |
|
1644 return KErrNone; |
|
1645 } |
|
1646 |
|
1647 // ----------------------------------------------------------------------------- |
|
1648 // COMASUPLProtocolManager1::SettingsUICompletedL |
|
1649 // |
|
1650 // |
|
1651 // ----------------------------------------------------------------------------- |
|
1652 // |
|
1653 void COMASUPLProtocolManager1::SettingsUICompletedL(TInt aError) |
|
1654 { |
|
1655 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsUICompletedL"), KTraceFileName, __LINE__); |
|
1656 iSuplSettings->SetUIActive(EFalse); |
|
1657 |
|
1658 if (iDeInitDone) |
|
1659 { |
|
1660 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsUICompletedL, de-init done. Completing request"), KTraceFileName, __LINE__); |
|
1661 iDeInitDone = EFalse; |
|
1662 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1663 } |
|
1664 else |
|
1665 { |
|
1666 for(TInt i = 0; i < iUIRequestArray.Count(); i++) |
|
1667 { |
|
1668 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsUICompletedL,Forwarding ConnRerquestor "), KTraceFileName, __LINE__); |
|
1669 MOMASuplUICompletionObserver* observer = iUIRequestArray[i]; |
|
1670 observer->SettingsUICompletedL(aError); |
|
1671 } |
|
1672 |
|
1673 } |
|
1674 |
|
1675 iCurrentlyUsedHslp.Copy(_L("")); |
|
1676 iUIRequestArray.Reset(); |
|
1677 } |
|
1678 |
1628 |
1679 |
1629 // ----------------------------------------------------------------------------- |
1680 // ----------------------------------------------------------------------------- |
1630 // COMASUPLProtocolManager1::DeInitialize |
1681 // COMASUPLProtocolManager1::DeInitialize |
1631 // |
1682 // |
1632 // |
1683 // |
1676 User::LeaveIfError(centralRepository->Get(KCoreAppUIsNetworkConnectionAllowed, networkMode)); |
1727 User::LeaveIfError(centralRepository->Get(KCoreAppUIsNetworkConnectionAllowed, networkMode)); |
1677 CleanupStack::PopAndDestroy(centralRepository); |
1728 CleanupStack::PopAndDestroy(centralRepository); |
1678 return networkMode; |
1729 return networkMode; |
1679 } |
1730 } |
1680 |
1731 |
1681 |
1732 // ----------------------------------------------------------------------------- |
1682 |
1733 // COMASUPLProtocolManager1::LaunchSuplUsageSettingsUI |
1683 |
1734 // |
1684 |
1735 // |
1685 |
1736 // ----------------------------------------------------------------------------- |
|
1737 // |
|
1738 TInt COMASUPLProtocolManager1::LaunchSuplUsageSettingsUI(MOMASuplUICompletionObserver* aObserver, TBool aRoaming) |
|
1739 { |
|
1740 iTrace->Trace(_L("COMASUPLProtocolManager1::LaunchSuplUsageSettingsUI"), KTraceFileName, __LINE__); |
|
1741 if (iSuplSettings->IsUIActive() && !iTimeOutDialogPresent) |
|
1742 return KErrInUse; |
|
1743 // If timeout dialog is present, close it |
|
1744 if (iTimeOutDialogPresent) |
|
1745 { |
|
1746 iTimeOutDialogPresent = EFalse; |
|
1747 iSuplSettings->SetUIActive(EFalse); |
|
1748 iSettingsLauncher->Cancel(); |
|
1749 } |
|
1750 iSessnUIObserver = aObserver; |
|
1751 iSuplSettings->SetUIActive(ETrue); |
|
1752 return iSettingsLauncher->LaunchSuplUsageSettingsUI(aRoaming); |
|
1753 } |
|
1754 |
|
1755 // ----------------------------------------------------------------------------- |
|
1756 // COMASUPLProtocolManager1::SettingsUsageUICompletedL |
|
1757 // |
|
1758 // |
|
1759 // ----------------------------------------------------------------------------- |
|
1760 // |
|
1761 void COMASUPLProtocolManager1::SettingsUsageUICompletedL(TInt aError) |
|
1762 { |
|
1763 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsUsageUICompletedL"), KTraceFileName, __LINE__); |
|
1764 iSuplSettings->SetUIActive(EFalse); |
|
1765 |
|
1766 if (iDeInitDone) |
|
1767 { |
|
1768 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsUsageUICompletedL, de-init done. Completing request"), KTraceFileName, __LINE__); |
|
1769 iDeInitDone = EFalse; |
|
1770 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1771 } |
|
1772 else |
|
1773 { |
|
1774 if (iSessnUIObserver) |
|
1775 iSessnUIObserver->SettingsUsageUICompletedL(aError); |
|
1776 } |
|
1777 |
|
1778 CheckOutstandingUsageUIRequestsL(); |
|
1779 } |
|
1780 |
|
1781 // ----------------------------------------------------------------------------- |
|
1782 // COMASUPLProtocolManager1::ReadSuplUsage |
|
1783 // Reads Supl Usage from Central Repository |
|
1784 // |
|
1785 // ----------------------------------------------------------------------------- |
|
1786 // |
|
1787 void COMASUPLProtocolManager1::ReadSuplUsage() |
|
1788 { |
|
1789 iTrace->Trace(_L("COMASUPLProtocolManager1::ReadSuplUsage start"), KTraceFileName, __LINE__); |
|
1790 CSuplSettings::TSuplSettingsUsage suplUsage; |
|
1791 TInt err = iSuplStorageSettings->GetSuplUsage(suplUsage); |
|
1792 if(err == KErrNone ) |
|
1793 { |
|
1794 iSuplSettings->SetSUPLUsage(suplUsage); |
|
1795 } |
|
1796 iTrace->Trace(_L("COMASUPLProtocolManager1::ReadSuplUsage end"), KTraceFileName, __LINE__); |
|
1797 } |
1686 |
1798 |
1687 void COMASUPLProtocolManager1::UpdateAllSubSessnsInSameSession(TInt aIpcSessionId) |
1799 void COMASUPLProtocolManager1::UpdateAllSubSessnsInSameSession(TInt aIpcSessionId) |
1688 { |
1800 { |
1689 TInt TotalSession = iSuplSessions.Count(); |
1801 TInt TotalSession = iSuplSessions.Count(); |
1690 COMASuplSession* OMAsuplSession = NULL; |
1802 COMASuplSession* OMAsuplSession = NULL; |
1804 break; |
1917 break; |
1805 } |
1918 } |
1806 } |
1919 } |
1807 } |
1920 } |
1808 |
1921 |
1809 |
1922 // ----------------------------------------------------------------------------- |
|
1923 // COMASUPLProtocolManager1::LaunchSuplDialogTimeoutUI |
|
1924 // |
|
1925 // |
|
1926 // ----------------------------------------------------------------------------- |
|
1927 // |
|
1928 TInt COMASUPLProtocolManager1::LaunchSuplDialogTimeoutUI(MOMASuplUICompletionObserver* aObserver ) |
|
1929 { |
|
1930 iTrace->Trace(_L("COMASUPLProtocolManager1::LaunchTimeOutUI"), KTraceFileName, __LINE__); |
|
1931 |
|
1932 iSessnUIObserver = aObserver; |
|
1933 if (iSuplSettings->IsUIActive()) |
|
1934 { |
|
1935 iSuplSettings->SetUIActive(EFalse); |
|
1936 iSettingsLauncher->Cancel(); |
|
1937 } |
|
1938 |
|
1939 iSuplSettings->SetUIActive(ETrue); |
|
1940 iTimeOutDialogPresent = ETrue; |
|
1941 return iSettingsLauncher->LaunchSessionTimeOutDialog(); |
|
1942 } |
|
1943 |
|
1944 // ----------------------------------------------------------------------------- |
|
1945 // COMASUPLProtocolManager1::SettingsTimeOutUICompletedL |
|
1946 // |
|
1947 // |
|
1948 // ----------------------------------------------------------------------------- |
|
1949 // |
|
1950 void COMASUPLProtocolManager1::SettingsTimeOutUICompletedL(TInt aError) |
|
1951 { |
|
1952 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsTimeOutUICompletedL"), KTraceFileName, __LINE__); |
|
1953 iSuplSettings->SetUIActive(EFalse); |
|
1954 iTimeOutDialogPresent = EFalse; |
|
1955 |
|
1956 if (iDeInitDone) |
|
1957 { |
|
1958 iTrace->Trace(_L("COMASUPLProtocolManager1::SettingsTimeOutUICompletedL, Completing request"), KTraceFileName, __LINE__); |
|
1959 iDeInitDone = EFalse; |
|
1960 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1961 } |
|
1962 else |
|
1963 { |
|
1964 if (iSessnUIObserver) |
|
1965 iSessnUIObserver->SettingsTimeOutUICompletedL(aError); |
|
1966 } |
|
1967 } |
|
1968 |
|
1969 // ----------------------------------------------------------------------------- |
|
1970 // COMASUPLProtocolManager1::GetLastUsedAccessPoint |
|
1971 // |
|
1972 // ----------------------------------------------------------------------------- |
|
1973 // |
|
1974 TInt COMASUPLProtocolManager1::GetLastUsedAccessPoint(TDes& aLastlyUsedAccessPoint,TUint32& iIAPId) |
|
1975 { |
|
1976 return iSettingsLauncher->GetIAPName(aLastlyUsedAccessPoint,iIAPId); |
|
1977 } |
1810 |
1978 |
1811 // ----------------------------------------------------------------------------- |
1979 // ----------------------------------------------------------------------------- |
1812 // COMASUPLProtocolManager1::PrintHex |
1980 // COMASUPLProtocolManager1::PrintHex |
1813 // |
1981 // |
1814 // ----------------------------------------------------------------------------- |
1982 // ----------------------------------------------------------------------------- |
1902 iSETMode = aCommmonConfig->iSETMode; |
2070 iSETMode = aCommmonConfig->iSETMode; |
1903 iSuplUsage = aCommmonConfig->iSuplUsage; |
2071 iSuplUsage = aCommmonConfig->iSuplUsage; |
1904 iSuplInitTimeOut = aCommmonConfig->iSuplInitTimeOut; |
2072 iSuplInitTimeOut = aCommmonConfig->iSuplInitTimeOut; |
1905 iPersistFailTimer = aCommmonConfig->iPersistFailTimer; |
2073 iPersistFailTimer = aCommmonConfig->iPersistFailTimer; |
1906 } |
2074 } |
1907 |
2075 |
1908 |
2076 // ----------------------------------------------------------------------------- |
1909 // ----------------------------------------------------------------------------- |
2077 // COMASUPLProtocolManager1::CancelUiLaunch |
1910 // COMASUPLProtocolManager1::MakeLocationConversionRequestL |
2078 // |
1911 // |
2079 // |
1912 // To make conversion request to retrieve position for a given cell id |
2080 // ----------------------------------------------------------------------------- |
1913 // ----------------------------------------------------------------------------- |
2081 // |
1914 // |
2082 void COMASUPLProtocolManager1::CancelUiLaunch() |
1915 void COMASUPLProtocolManager1::MakeLocationConversionRequestL( CSuplSessionBase* aSuplSessn, |
|
1916 TGeoCellInfo& aCellInfo, |
|
1917 TRequestStatus& aStatus ) |
|
1918 { |
2083 { |
1919 iTrace->Trace(_L("COMASUPLProtocolManager1::MakeLocationConversionRequestL"), KTraceFileName, __LINE__); |
2084 iTrace->Trace(_L("COMASUPLProtocolManager1::CancelUiLaunch"), KTraceFileName, __LINE__); |
1920 TBuf<64> tempBuf; |
2085 iSettingsLauncher->CancelLaunch(); |
1921 |
|
1922 if ( iSuplSessions.Find(aSuplSessn) == KErrNotFound ) |
|
1923 { |
|
1924 TRequestStatus *status = &aStatus; |
|
1925 User::RequestComplete(status,KErrNotFound ); |
|
1926 return; |
|
1927 } |
|
1928 |
|
1929 CheckForSessionCount(); |
|
1930 iRunningSessionCount++; |
|
1931 |
|
1932 COMASuplLocationId* locationId = COMASuplLocationId::NewL(); |
|
1933 COMASuplLocationId::TOMASuplStatus status = COMASuplLocationId::EStale; |
|
1934 switch(aCellInfo.iGeoCellType) |
|
1935 { |
|
1936 case EGeoGsmCell: |
|
1937 { |
|
1938 iTrace->Trace(_L("COMASUPLProtocolManager1::MakeLocationConversionRequestL - Setting GSM Cell Info"), KTraceFileName, __LINE__); |
|
1939 COMASuplGSMCellInfo* cellInfo = COMASuplGSMCellInfo::NewL(); |
|
1940 cellInfo->SetSuplGSMCellInfo(aCellInfo.iMNC,aCellInfo.iMCC,aCellInfo.iCid,aCellInfo.iLac); |
|
1941 locationId->SetSuplLocationId(cellInfo,status); |
|
1942 } |
|
1943 break; |
|
1944 case EGeoWcdmaCell: |
|
1945 { |
|
1946 iTrace->Trace(_L("COMASUPLProtocolManager1::MakeLocationConversionRequestL - Setting WCDMA Cell Info"), KTraceFileName, __LINE__); |
|
1947 COMASuplCellInfo* cellInfo = COMASuplCellInfo::NewL(); |
|
1948 cellInfo->SetSuplCellInfo(aCellInfo.iMNC,aCellInfo.iMCC,aCellInfo.iCid); |
|
1949 locationId->SetSuplLocationId(cellInfo,status); |
|
1950 } |
|
1951 break; |
|
1952 } |
|
1953 |
|
1954 tempBuf.Copy(_L("MCC = ")); |
|
1955 tempBuf.AppendNum(aCellInfo.iMCC); |
|
1956 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
1957 tempBuf.Copy(_L("MNC = ")); |
|
1958 tempBuf.AppendNum(aCellInfo.iMNC); |
|
1959 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
1960 tempBuf.Copy(_L("LAC = ")); |
|
1961 tempBuf.AppendNum(aCellInfo.iLac); |
|
1962 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
1963 tempBuf.Copy(_L("CId = ")); |
|
1964 tempBuf.AppendNum(aCellInfo.iCid); |
|
1965 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
1966 tempBuf.Copy(_L("Prompt = ")); |
|
1967 tempBuf.AppendNum(aCellInfo.iConnectionPrompt); |
|
1968 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
1969 |
|
1970 TInt allowedCapabilities = KECID|KCID; |
|
1971 TInt requestID = 1000; |
|
1972 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSessn); |
|
1973 OMASession->SetConfigurationParameters(iUT1_StartTimer,iUT2_PosInitTimer, iUT3_PosTimer,iPrivacyTimer,iSETMode, |
|
1974 iSuplUsage, iPersistFailTimer,iSuplInitTimeOut); |
|
1975 OMASession->RunSuplSessionL(aStatus,ETrue, KNullDesC,EFalse, allowedCapabilities,iRunningSessionCount,requestID,ETrue,locationId,aCellInfo.iConnectionPrompt,aCellInfo.iWlanOnly); |
|
1976 |
|
1977 } |
2086 } |
1978 |
|
1979 // ----------------------------------------------------------------------------- |
|
1980 // COMASUPLProtocolManager1::CancelLocationConversionRequest |
|
1981 // |
|
1982 // Cancel an ongoing conversion request |
|
1983 // ----------------------------------------------------------------------------- |
|
1984 // |
|
1985 void COMASUPLProtocolManager1::CancelLocationConversionRequest(CSuplSessionBase* aSuplSession) |
|
1986 { |
|
1987 // Log |
|
1988 iTrace->Trace(_L("COMASUPLProtocolManager1::CancelLocationConversionRequest"), KTraceFileName, __LINE__); |
|
1989 |
|
1990 // Check if the Session is valid |
|
1991 TInt index = iSuplSessions.Find(aSuplSession); |
|
1992 |
|
1993 if(KErrNotFound == index) |
|
1994 { |
|
1995 iTrace->Trace(_L("Cannot find Supl session."), KTraceFileName, __LINE__); |
|
1996 return; |
|
1997 } |
|
1998 aSuplSession->CancelRunSession(); |
|
1999 return ; |
|
2000 } |
|
2001 |
|
2002 |
2087 |
2003 // end of file |
2088 // end of file |