diff -r e1bea15f9a39 -r 79859ed3eea9 browserutilities/connectionmanager/Src/InternetConnectionManager.cpp --- a/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp Thu Aug 19 10:58:56 2010 +0300 +++ b/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp Tue Aug 31 16:17:46 2010 +0300 @@ -23,9 +23,9 @@ //System Includes #include -#include + #include -#include +#include #include #include #include @@ -35,50 +35,47 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include #include #include #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include -#include +#include //User Includes -#include -#include "connman.hrh" -#include "connectionmanagerlogger.h" -#include -#include "connmanactiveconnector.h" +#include "InternetConnectionManager.h" +#include "ConnMan.hrh" +#include "ConnectionManagerLogger.h" +#include "ConnectionObservers.h" +#include "ConnManActiveConnector.h" using namespace CMManager; // CONSTANTS _LIT(KConnectionResourceFile, "\\resource\\ConnectionManager.rsc"); -#ifdef BRDO_OCC_ENABLED_FF -//As per OCC, number of Connection observer states -const TInt KMaxOccStages = 1; -#endif + // ============================ MEMBER FUNCTIONS =============================== //-------------------------------------------------------------------------- //CInternetConnectionManager::ConnectL( TUint32 aIAPId1, TUint32 aIAPId2 ) @@ -210,8 +207,6 @@ User::LeaveIfError( iConnection.GetDesSetting( query, val ) ); iConnName = val.AllocL(); - CLOG_WRITE_1( "Iap id used : %d", iapId ); - CLOG_WRITE_1( "Conn name : %S", iConnName); } else if( !iRequestedAPIds.iFirstPreference ) { @@ -457,17 +452,18 @@ } else { - if(iConnection.SubSessionHandle() <= 0) - { - // RConnection handle is invalid, we haven't opened the RConnection yet. connErr = iConnection.Open( iServ, KAfInet ); - } CLOG_WRITE_1( "RConnection: %d", connErr ); if( connErr == KErrNone ) { // Always pass the IAP Id to RConnection even in silent mode connErr = iSyncConnector->Connect( overrides ); } + if( connErr != KErrNone ) + { + CLOG_WRITE( "Closing all" ); + iConnection.Close(); + } } } if ( iWaitDialog ) @@ -517,6 +513,11 @@ delete iCommsDb; } + if( iConnected ) + { + iConnection.Close(); + } + if( !iSilentMode ) // Temp fix for CDMA { @@ -531,8 +532,8 @@ delete iNoteDialog; delete iSyncConnector; iRFs.Close(); - iConnection.Close(); - iServ.Close(); + + iServ.Close(); CLOG_CLOSE; } @@ -581,11 +582,7 @@ TApBearerType CInternetConnectionManager::BearerTypeL( TUint32 aIAPId ) { TApBearerType apbearerType = EApBearerTypeAllBearers; -#ifdef BRDO_OCC_ENABLED_FF - if( !iRequestedAPIds.iFirstPreference ) -#else - if( iSilentMode || !iRequestedAPIds.iFirstPreference ) -#endif + if( iSilentMode || !iRequestedAPIds.iFirstPreference ) // Temp fix for CDMA { return EApBearerTypeAllBearers; @@ -646,19 +643,7 @@ CLOG_ENTERFN( "StopConnectionL()" ); StopConnectionObserving(); - - if( iConnected ) - { - CLOG_WRITE( "StopConnectionL() Stop the Connection" ); - iConnection.Close(); - TInt err = iConnection.Open( iServ, KAfInet ); - } - else - { - CLOG_WRITE( "Cancel the Connection" ); - CancelConnection(); - } - + iConnection.Close(); // iServ.Close(); iConnected = EFalse; iEasyWlan = EFalse; @@ -1056,7 +1041,7 @@ if (iConnectionType == EDestination) { - err = ConnectWithSnapIdL(iRequestedSnapId); + err = ConnectWithSnapId(iRequestedSnapId); return err; } else @@ -1340,17 +1325,12 @@ TName* name = ConnectionNameL(); __ASSERT_DEBUG( name, User::Panic( KNullDesC, KErrCorrupt ) ); CleanupStack::PushL( name ); - -#ifdef BRDO_OCC_ENABLED_FF - iSatges[0] = KLinkLayerClosed; - iStageNotifier->StartNotificationL( name,iSatges,KMaxOccStages,this, ETrue ); -#else + iSatges[0] = KConnectionUninitialised; iSatges[1] = KConnectionClosed; iSatges[2] = KLinkLayerClosed; iStageNotifier->StartNotificationL( name,iSatges,KMaxStages,this, ETrue ); -#endif CleanupStack::PopAndDestroy( name ); } @@ -1380,6 +1360,7 @@ { // this is a connection closed event CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" ); + iConnection.Stop(); iConnected = EFalse; if( !iSilentMode ) @@ -1661,19 +1642,6 @@ } //------------------------------------------------------------------------ -//CInternetConnectionManager::CancelConnection -// - void CInternetConnectionManager::CancelConnection() - { - CLOG_ENTERFN("CInternetConnectionManager::CancelConnection"); - if(iSyncConnector && iSyncConnector->IsActive()) - { - CLOG_WRITE( "Connection is cancelled" ); - iSyncConnector->Cancel(); - } - } - -//------------------------------------------------------------------------ //CInternetConnectionManager::AskIap //------------------------------------------------------------------------ EXPORT_C TInt CInternetConnectionManager::AskIap( TUint32& aNewIap ) @@ -1711,6 +1679,7 @@ CLOG_WRITE_1( "CInternetConnectionManager::SetConnectionType - %d", aConnectionType ); iConnectionType = aConnectionType; } + //------------------------------------------------------------------- //CInternetConnectionManager::SetRequestedSnap //------------------------------------------------------------------- @@ -2025,14 +1994,15 @@ { User::LeaveIfError( iServ.Connect() ); } + CLOG_WRITE( "Fully initialized" ); iInitialized = ETrue; } //------------------------------------------------------------------------ -//CInternetConnectionManager::ConnectWithSnapIdL +//CInternetConnectionManager::ConnectWithSnapId //------------------------------------------------------------------------ -TInt CInternetConnectionManager::ConnectWithSnapIdL(TUint32 aRequestedSnapId) +TInt CInternetConnectionManager::ConnectWithSnapId(TUint32 aRequestedSnapId) { CLOG_WRITE_1( "CInternetConnectionManager::ConnectWithSnapId - %d", aRequestedSnapId ); @@ -2047,37 +2017,16 @@ #ifndef __WINS__ if( KErrNone == connErr ) { - if( iSilentMode ) - // Temp fix for CDMA - { - TUint32 iapId; - TBuf<20> query; - TBuf<40> val; - - query.Format( _L("%s\\%s"), IAP, COMMDB_ID ); - User::LeaveIfError( iConnection.GetIntSetting( query, iapId ) ); - iCurrentAP = (CApAccessPointItem*)iapId; - - query.Format(_L("%s\\%s"), IAP, COMMDB_NAME); - User::LeaveIfError( iConnection.GetDesSetting( query, val ) ); - - iConnName = val.AllocL(); - CLOG_WRITE_1( "Iap id used : %d", iapId ); - CLOG_WRITE_1( "Conn name : %S", iConnName); - } - else - { - TUint32 iIapID; - TBuf<20> query; - query.Format( _L("%s\\%s"), IAP, COMMDB_ID ); - if( iConnection.GetIntSetting( query, iIapID ) == KErrNone ) - { - CLOG_WRITE_1( "ConnectWithSnapId::AccessPoint - %d", iIapID ); - CApAccessPointItem* ap = APItemFromIAPIdLC( iIapID ); - UpdateCurrentAPL( *ap, EFalse ); - CleanupStack::PopAndDestroy(); // ap - } - } + TUint32 iIapID; + TBuf<20> query; + query.Format( _L("%s\\%s"), IAP, COMMDB_ID ); + if( iConnection.GetIntSetting( query, iIapID ) == KErrNone ) + { + CLOG_WRITE_1( "ConnectWithSnapId::AccessPoint - %d", iIapID ); + CApAccessPointItem* ap = APItemFromIAPIdLC( iIapID ); + UpdateCurrentAPL( *ap, EFalse ); + CleanupStack::PopAndDestroy(); // ap + } } #endif @@ -2152,17 +2101,18 @@ if ( !connErr ) { - if(iConnection.SubSessionHandle() <= 0) - { - // RConnection handle is invalid, we haven't opened the RConnection yet. connErr = iConnection.Open( iServ, KAfInet ); - } CLOG_WRITE_1( "RConnection: %d", connErr ); if( connErr == KErrNone ) { //connect with snap id connErr = iSyncConnector->ConnectSnap( overrides ); } + if( connErr != KErrNone ) + { + CLOG_WRITE( "Closing all" ); + iConnection.Close(); + } } CleanupStack::PopAndDestroy();//overrides @@ -2204,15 +2154,5 @@ } iWaitDialog->RunLD(); } - -//------------------------------------------------------------------- -//CInternetConnectionManager::SetOccPreferences -//------------------------------------------------------------------- - -void CInternetConnectionManager::SetOccPreferences( TSetOCCPreferences aOCCPreferences) - { - if( iSyncConnector ) - iSyncConnector->SetOccPreferences(aOCCPreferences); - } // End of File