connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
branchRCL_3
changeset 23 fc7b30ed2058
parent 12 4dc3bb0099b0
child 24 05bc53fe583b
equal deleted inserted replaced
22:984e13af52c4 23:fc7b30ed2058
     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;
  2296             delete iConnInfos[index].iConnAttach;
  2295             delete iConnInfos[index].iConnAttach;
  2297             iConnInfos[index].iConnAttach = NULL;
  2296             iConnInfos[index].iConnAttach = NULL;
  2298             }
  2297             }
  2299 
  2298 
  2300         iConnInfos.Remove( index );
  2299         iConnInfos.Remove( index );
       
  2300 
       
  2301         // If dial-up PDP context override feature is enabled and active (a dial-up
       
  2302         // connection is about to start), connection closures need to be reported
       
  2303         // in case dial-up connection is waiting for a free PDP context.
       
  2304         if ( iServer->GetDialUpOverrideStatus() == EConnMonDialUpOverrideActive )
       
  2305             {
       
  2306             if ( !ActivePacketdataConnectionsFound() )
       
  2307                 {
       
  2308                 iServer->ConnectionsClosedForDialUpOverride();
       
  2309                 }
       
  2310             }
       
  2311 
  2301         err = KErrNone;
  2312         err = KErrNone;
  2302         }
  2313         }
  2303 
  2314 
  2304     // Print connection info array to log
  2315     // Print connection info array to log
  2305     #ifdef _DEBUG
  2316     #ifdef _DEBUG
  2963 
  2974 
  2964 // -----------------------------------------------------------------------------------
  2975 // -----------------------------------------------------------------------------------
  2965 // CConnMonIAP::GetDeleteNotifyStatus
  2976 // CConnMonIAP::GetDeleteNotifyStatus
  2966 // -----------------------------------------------------------------------------------
  2977 // -----------------------------------------------------------------------------------
  2967 //
  2978 //
  2968 TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent )
  2979 TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection )
  2969     {
  2980     {
  2970     TInt index( KErrNotFound );
  2981     TInt index( KErrNotFound );
  2971 
  2982 
  2972     if ( aConnection.iBearer >= EBearerExternalCSD )
  2983     if ( aConnection.iBearer >= EBearerExternalCSD )
  2973         {
  2984         {
  2981         return KErrNotFound;
  2992         return KErrNotFound;
  2982         }
  2993         }
  2983 
  2994 
  2984     aConnection.iConnectionId = iConnInfos[index].iConnectionId;
  2995     aConnection.iConnectionId = iConnInfos[index].iConnectionId;
  2985     aConnection.iBearer = iConnInfos[index].iBearer;
  2996     aConnection.iBearer = iConnInfos[index].iBearer;
  2986 
       
  2987     TInt connectionStatus( 0 );
       
  2988     GetConnectionStatus( index, connectionStatus );
       
  2989 
       
  2990     if ( ( iConnInfos[index].iConnDownNotifier != 0 ) &&
       
  2991          ( iConnInfos[index].iProgressNotifier != 0 ) )
       
  2992         {
       
  2993         if ( !iConnInfos[index].iConnDownNotifier->DeleteSent() &&
       
  2994              !iConnInfos[index].iConnDownNotifier->IsActive() &&
       
  2995              ( !iConnInfos[index].iProgressNotifier->IsActive() ||
       
  2996                ( connectionStatus != KLinkLayerOpen ) ) )
       
  2997             {
       
  2998             aSent = EFalse;
       
  2999             }
       
  3000         else
       
  3001             {
       
  3002             aSent = ETrue;
       
  3003             }
       
  3004         }
       
  3005     else
       
  3006         {
       
  3007         aSent = EFalse;
       
  3008         }
       
  3009 
  2997 
  3010     return KErrNone;
  2998     return KErrNone;
  3011     }
  2999     }
  3012 
  3000 
  3013 // -----------------------------------------------------------------------------------
  3001 // -----------------------------------------------------------------------------------
  3337             }
  3325             }
  3338         }
  3326         }
  3339     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
  3327     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
  3340     }
  3328     }
  3341 
  3329 
       
  3330 // -----------------------------------------------------------------------------
       
  3331 // CConnMonIAP::ActivePacketdataConnectionsFound
       
  3332 // Return ETrue if one or more active packetdata connections are found,
       
  3333 // EFalse otherwise.
       
  3334 // -----------------------------------------------------------------------------
       
  3335 //
       
  3336 TBool CConnMonIAP::ActivePacketdataConnectionsFound()
       
  3337     {
       
  3338     LOGENTRFN("CConnMonIAP::ActivePacketdataConnectionsFound()")
       
  3339     TBool result( EFalse );
       
  3340     TInt unknownBearers( 0 );
       
  3341 
       
  3342     const TInt count = iConnInfos.Count();
       
  3343     for ( TInt i = 0; i < count; i++ )
       
  3344         {
       
  3345         // Bearer might still be uninitialized
       
  3346         if ( iConnInfos[i].iBearer == EBearerUnknown )
       
  3347             {
       
  3348             unknownBearers++;
       
  3349             }
       
  3350         else if ( iConnInfos[i].iBearer == EBearerGPRS ||
       
  3351                 iConnInfos[i].iBearer == EBearerEdgeGPRS ||
       
  3352                 iConnInfos[i].iBearer == EBearerWCDMA )
       
  3353             {
       
  3354             result = ETrue;
       
  3355             break;
       
  3356             }
       
  3357         }
       
  3358     if ( !result && unknownBearers )
       
  3359         {
       
  3360         for ( TInt i = 0; i < count; i++ )
       
  3361             {
       
  3362             if ( iConnInfos[i].iBearer == EBearerUnknown )
       
  3363                 {
       
  3364                 LOGIT1("ActivePacketdataConnectionsFound: bearer unknown for conn.id %d",
       
  3365                         iConnInfos[i].iConnectionId)
       
  3366                 TInt err = GetBearer(
       
  3367                         iConnInfos[i].iConnectionId,
       
  3368                         iConnInfos[i].iBearer,
       
  3369                         iConnInfos[i].iBearerInfo );
       
  3370 
       
  3371                 if ( err == KErrNone )
       
  3372                     {
       
  3373                     if ( iConnInfos[i].iBearer == EBearerGPRS ||
       
  3374                             iConnInfos[i].iBearer == EBearerEdgeGPRS ||
       
  3375                             iConnInfos[i].iBearer == EBearerWCDMA )
       
  3376                         {
       
  3377                         result = ETrue;
       
  3378                         break;
       
  3379                         }
       
  3380                     }
       
  3381                 }
       
  3382             }
       
  3383         }
       
  3384 
       
  3385     LOGEXITFN1("CConnMonIAP::ActivePacketdataConnectionsFound()", result)
       
  3386     return result;
       
  3387     }
  3342 
  3388 
  3343 // -----------------------------------------------------------------------------
  3389 // -----------------------------------------------------------------------------
  3344 // CConnMonIAP::GetBearerSupportInfo
  3390 // CConnMonIAP::GetBearerSupportInfo
  3345 // Checks whether the current cell and the phone support a bearer (GPRS or CSD).
  3391 // Checks whether the current cell and the phone support a bearer (GPRS or CSD).
  3346 // -----------------------------------------------------------------------------
  3392 // -----------------------------------------------------------------------------