browserutilities/connectionmanager/Src/InternetConnectionManager.cpp
branchRCL_3
changeset 36 c711bdda59f4
parent 35 1f3c3f2f5b0a
child 37 ac77f89b1d9e
equal deleted inserted replaced
35:1f3c3f2f5b0a 36:c711bdda59f4
    73 
    73 
    74 using namespace CMManager;
    74 using namespace CMManager;
    75 
    75 
    76 // CONSTANTS
    76 // CONSTANTS
    77 _LIT(KConnectionResourceFile, "\\resource\\ConnectionManager.rsc");
    77 _LIT(KConnectionResourceFile, "\\resource\\ConnectionManager.rsc");
    78 
    78 #ifdef BRDO_OCC_ENABLED_FF
       
    79 //As per OCC, number of Connection observer states
       
    80 const TInt KMaxOccStages = 1;
       
    81 #endif
    79 // ============================ MEMBER FUNCTIONS ===============================
    82 // ============================ MEMBER FUNCTIONS ===============================
    80 //--------------------------------------------------------------------------
    83 //--------------------------------------------------------------------------
    81 //CInternetConnectionManager::ConnectL( TUint32 aIAPId1, TUint32 aIAPId2 )
    84 //CInternetConnectionManager::ConnectL( TUint32 aIAPId1, TUint32 aIAPId2 )
    82 //--------------------------------------------------------------------------
    85 //--------------------------------------------------------------------------
    83 EXPORT_C TInt CInternetConnectionManager::ConnectL(  TUint32 /*aIAPId1*/, TUint32 /*aIAPId2*/ )
    86 EXPORT_C TInt CInternetConnectionManager::ConnectL(  TUint32 /*aIAPId1*/, TUint32 /*aIAPId2*/ )
   650 
   653 
   651     StopConnectionObserving();
   654     StopConnectionObserving();
   652     if( iConnected )
   655     if( iConnected )
   653         {
   656         {
   654         CLOG_WRITE( "StopConnectionL() Stop the Connection" );
   657         CLOG_WRITE( "StopConnectionL() Stop the Connection" );
   655         iConnection.Stop(RConnection::EStopAuthoritative);
   658         iConnection.Close();
   656         }
   659         }
   657     
   660     
   658 //    iServ.Close();
   661 //    iServ.Close();
   659     iConnected = EFalse;
   662     iConnected = EFalse;
   660     iEasyWlan = EFalse;
   663     iEasyWlan = EFalse;
  1334     CLOG_ENTERFN( "StartConnectionObservingL()" );
  1337     CLOG_ENTERFN( "StartConnectionObservingL()" );
  1335 
  1338 
  1336     TName* name = ConnectionNameL();
  1339     TName* name = ConnectionNameL();
  1337     __ASSERT_DEBUG( name, User::Panic( KNullDesC, KErrCorrupt ) );
  1340     __ASSERT_DEBUG( name, User::Panic( KNullDesC, KErrCorrupt ) );
  1338     CleanupStack::PushL( name );
  1341     CleanupStack::PushL( name );
  1339     
  1342 
       
  1343 #ifdef BRDO_OCC_ENABLED_FF
       
  1344     iSatges[0] = KLinkLayerClosed;
       
  1345     iStageNotifier->StartNotificationL( name,iSatges,KMaxOccStages,this, ETrue );
       
  1346 #else
  1340     iSatges[0] = KConnectionUninitialised;
  1347     iSatges[0] = KConnectionUninitialised;
  1341     iSatges[1] = KConnectionClosed;
  1348     iSatges[1] = KConnectionClosed;
  1342     iSatges[2] = KLinkLayerClosed;
  1349     iSatges[2] = KLinkLayerClosed;
  1343 
  1350 
  1344     iStageNotifier->StartNotificationL( name,iSatges,KMaxStages,this, ETrue );
  1351     iStageNotifier->StartNotificationL( name,iSatges,KMaxStages,this, ETrue );
       
  1352 #endif
  1345 
  1353 
  1346     CleanupStack::PopAndDestroy( name );
  1354     CleanupStack::PopAndDestroy( name );
  1347     }
  1355     }
  1348 
  1356 
  1349 //-------------------------------------------------------------------
  1357 //-------------------------------------------------------------------
  1369  //   CLOG_WRITE_1( "ConnectionStageAchievedL() Stage = %d ", aStage);
  1377  //   CLOG_WRITE_1( "ConnectionStageAchievedL() Stage = %d ", aStage);
  1370      if(iConnected) 
  1378      if(iConnected) 
  1371      {
  1379      {
  1372      	// this is a connection closed event
  1380      	// this is a connection closed event
  1373         CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" );
  1381         CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" );
  1374         iConnection.Stop();
  1382         iConnection.Close();
  1375     	iConnected = EFalse;
  1383     	iConnected = EFalse;
  1376 
  1384 
  1377     	if( !iSilentMode )
  1385     	if( !iSilentMode )
  1378         // Temp fix for CDMA
  1386         // Temp fix for CDMA
  1379         {
  1387         {
  1699 	{
  1707 	{
  1700 	CLOG_ENTERFN("CInternetConnectionManager::SetConnectionType");
  1708 	CLOG_ENTERFN("CInternetConnectionManager::SetConnectionType");
  1701 	CLOG_WRITE_1( "CInternetConnectionManager::SetConnectionType - %d", aConnectionType );
  1709 	CLOG_WRITE_1( "CInternetConnectionManager::SetConnectionType - %d", aConnectionType );
  1702 	iConnectionType = aConnectionType;
  1710 	iConnectionType = aConnectionType;
  1703 	}
  1711 	}
  1704     
       
  1705 //-------------------------------------------------------------------
  1712 //-------------------------------------------------------------------
  1706 //CInternetConnectionManager::SetRequestedSnap
  1713 //CInternetConnectionManager::SetRequestedSnap
  1707 //-------------------------------------------------------------------
  1714 //-------------------------------------------------------------------
  1708 //    
  1715 //    
  1709 EXPORT_C void CInternetConnectionManager::SetRequestedSnap (TUint32 aRequestedSnapId)
  1716 EXPORT_C void CInternetConnectionManager::SetRequestedSnap (TUint32 aRequestedSnapId)
  2014 
  2021 
  2015     if( !iServ.Handle() )
  2022     if( !iServ.Handle() )
  2016         {
  2023         {
  2017         User::LeaveIfError( iServ.Connect() );
  2024         User::LeaveIfError( iServ.Connect() );
  2018         }
  2025         }
  2019 
       
  2020     CLOG_WRITE( "Fully initialized" );
  2026     CLOG_WRITE( "Fully initialized" );
  2021     iInitialized = ETrue;    
  2027     iInitialized = ETrue;    
  2022     }
  2028     }
  2023     
  2029     
  2024 //------------------------------------------------------------------------
  2030 //------------------------------------------------------------------------
  2037 	
  2043 	
  2038     DisplayConnErrorL();
  2044     DisplayConnErrorL();
  2039 #ifndef __WINS__
  2045 #ifndef __WINS__
  2040     if( KErrNone == connErr )
  2046     if( KErrNone == connErr )
  2041         {
  2047         {
  2042         TUint32 iIapID;
  2048         if( iSilentMode )
  2043         TBuf<20> query;
  2049         // Temp fix for CDMA
  2044         query.Format( _L("%s\\%s"), IAP, COMMDB_ID );
  2050            {
  2045         if( iConnection.GetIntSetting( query, iIapID ) == KErrNone )
  2051            TUint32 iapId;
  2046             {
  2052            TBuf<20> query;
  2047             CLOG_WRITE_1( "ConnectWithSnapId::AccessPoint - %d", iIapID );
  2053            TBuf<40> val;
  2048             CApAccessPointItem* ap = APItemFromIAPIdLC( iIapID );
  2054         
  2049             UpdateCurrentAPL( *ap, EFalse );
  2055            query.Format( _L("%s\\%s"), IAP, COMMDB_ID );
  2050             CleanupStack::PopAndDestroy();  // ap
  2056            User::LeaveIfError( iConnection.GetIntSetting( query, iapId ) );
  2051             }
  2057            iCurrentAP = (CApAccessPointItem*)iapId;
       
  2058         
       
  2059            query.Format(_L("%s\\%s"), IAP, COMMDB_NAME);
       
  2060            User::LeaveIfError( iConnection.GetDesSetting( query, val ) );
       
  2061         
       
  2062            iConnName = val.AllocL();
       
  2063            CLOG_WRITE_1( "Iap id used : %d", iapId );
       
  2064            CLOG_WRITE_1( "Conn name   : %S", iConnName);
       
  2065            }
       
  2066         else
       
  2067            {
       
  2068            TUint32 iIapID;
       
  2069            TBuf<20> query;
       
  2070            query.Format( _L("%s\\%s"), IAP, COMMDB_ID );
       
  2071            if( iConnection.GetIntSetting( query, iIapID ) == KErrNone )
       
  2072                {
       
  2073                CLOG_WRITE_1( "ConnectWithSnapId::AccessPoint - %d", iIapID );
       
  2074                CApAccessPointItem* ap = APItemFromIAPIdLC( iIapID );
       
  2075                UpdateCurrentAPL( *ap, EFalse );
       
  2076                CleanupStack::PopAndDestroy();  // ap
       
  2077                }
       
  2078            }
  2052         }
  2079         }
  2053             
  2080             
  2054 #endif
  2081 #endif
  2055 
  2082 
  2056 	return connErr;
  2083 	return connErr;