connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
changeset 52 bbe4544dfd31
parent 44 a0c4ceac30d0
child 71 9f263f780e41
equal deleted inserted replaced
50:6a30cdd10231 52:bbe4544dfd31
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   419 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   420 //
   420 //
   421 TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
   421 TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
   422     {
   422     {
   423     // Server must be 'blocked' while updating the connection table.
   423     // Server must be 'blocked' while updating the connection table.
   424     TConnectionInfoBuf connInfoBuf;
       
   425     TBearerInfo bearerInfo;
   424     TBearerInfo bearerInfo;
   426     TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
   425     TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
   427     TInt err( KErrNone );
   426     TInt err( KErrNone );
   428 
   427 
   429     aCount = 0;
   428     aCount = 0;
  2310             delete iConnInfos[index].iConnAttach;
  2309             delete iConnInfos[index].iConnAttach;
  2311             iConnInfos[index].iConnAttach = NULL;
  2310             iConnInfos[index].iConnAttach = NULL;
  2312             }
  2311             }
  2313 
  2312 
  2314         iConnInfos.Remove( index );
  2313         iConnInfos.Remove( index );
       
  2314 
       
  2315         // If dial-up PDP context override feature is enabled and active (a dial-up
       
  2316         // connection is about to start), connection closures need to be reported
       
  2317         // in case dial-up connection is waiting for a free PDP context.
       
  2318         if ( iServer->GetDialUpOverrideStatus() == EConnMonDialUpOverrideActive )
       
  2319             {
       
  2320             if ( !ActivePacketdataConnectionsFound() )
       
  2321                 {
       
  2322                 iServer->ConnectionsClosedForDialUpOverride();
       
  2323                 }
       
  2324             }
       
  2325 
  2315         err = KErrNone;
  2326         err = KErrNone;
  2316         }
  2327         }
  2317 
  2328 
  2318     // Print connection info array to log
  2329     // Print connection info array to log
  2319     #ifdef _DEBUG
  2330     #ifdef _DEBUG
  3328             }
  3339             }
  3329         }
  3340         }
  3330     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
  3341     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
  3331     }
  3342     }
  3332 
  3343 
       
  3344 // -----------------------------------------------------------------------------
       
  3345 // CConnMonIAP::ActivePacketdataConnectionsFound
       
  3346 // Return ETrue if one or more active packetdata connections are found,
       
  3347 // EFalse otherwise.
       
  3348 // -----------------------------------------------------------------------------
       
  3349 //
       
  3350 TBool CConnMonIAP::ActivePacketdataConnectionsFound()
       
  3351     {
       
  3352     LOGENTRFN("CConnMonIAP::ActivePacketdataConnectionsFound()")
       
  3353     TBool result( EFalse );
       
  3354     TInt unknownBearers( 0 );
       
  3355 
       
  3356     const TInt count = iConnInfos.Count();
       
  3357     for ( TInt i = 0; i < count; i++ )
       
  3358         {
       
  3359         // Bearer might still be uninitialized
       
  3360         if ( iConnInfos[i].iBearer == EBearerUnknown )
       
  3361             {
       
  3362             unknownBearers++;
       
  3363             }
       
  3364         else if ( iConnInfos[i].iBearer == EBearerGPRS ||
       
  3365                 iConnInfos[i].iBearer == EBearerEdgeGPRS ||
       
  3366                 iConnInfos[i].iBearer == EBearerWCDMA )
       
  3367             {
       
  3368             result = ETrue;
       
  3369             break;
       
  3370             }
       
  3371         }
       
  3372     if ( !result && unknownBearers )
       
  3373         {
       
  3374         for ( TInt i = 0; i < count; i++ )
       
  3375             {
       
  3376             if ( iConnInfos[i].iBearer == EBearerUnknown )
       
  3377                 {
       
  3378                 LOGIT1("ActivePacketdataConnectionsFound: bearer unknown for conn.id %d",
       
  3379                         iConnInfos[i].iConnectionId)
       
  3380                 TInt err = GetBearer(
       
  3381                         iConnInfos[i].iConnectionId,
       
  3382                         iConnInfos[i].iBearer,
       
  3383                         iConnInfos[i].iBearerInfo );
       
  3384 
       
  3385                 if ( err == KErrNone )
       
  3386                     {
       
  3387                     if ( iConnInfos[i].iBearer == EBearerGPRS ||
       
  3388                             iConnInfos[i].iBearer == EBearerEdgeGPRS ||
       
  3389                             iConnInfos[i].iBearer == EBearerWCDMA )
       
  3390                         {
       
  3391                         result = ETrue;
       
  3392                         break;
       
  3393                         }
       
  3394                     }
       
  3395                 }
       
  3396             }
       
  3397         }
       
  3398 
       
  3399     LOGEXITFN1("CConnMonIAP::ActivePacketdataConnectionsFound()", result)
       
  3400     return result;
       
  3401     }
  3333 
  3402 
  3334 // -----------------------------------------------------------------------------
  3403 // -----------------------------------------------------------------------------
  3335 // CConnMonIAP::GetBearerSupportInfo
  3404 // CConnMonIAP::GetBearerSupportInfo
  3336 // Checks whether the current cell and the phone support a bearer (GPRS or CSD).
  3405 // Checks whether the current cell and the phone support a bearer (GPRS or CSD).
  3337 // -----------------------------------------------------------------------------
  3406 // -----------------------------------------------------------------------------