convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifconnectionhandler.cpp
branchRCL_3
changeset 16 df4dfb214df5
parent 15 43658d24f35d
equal deleted inserted replaced
15:43658d24f35d 16:df4dfb214df5
   199     
   199     
   200     CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationsL - OUT" );
   200     CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationsL - OUT" );
   201     }
   201     }
   202 
   202 
   203 // ---------------------------------------------------------------------------
   203 // ---------------------------------------------------------------------------
       
   204 // CCchUiNotifConnectionHandler::GetDestinationL
       
   205 // ---------------------------------------------------------------------------
       
   206 //
       
   207 void CCchUiNotifConnectionHandler::GetDestinationL( 
       
   208     TUint aIapId, TInt& aError, TUint32& aDestinationId )
       
   209     {
       
   210     CCHUIDEBUG2(
       
   211         "CCchUiNotifConnectionHandler::GetDestinationL - IN aIapID = %d", &aIapId );
       
   212     
       
   213     aError = KErrNotFound;
       
   214     RArray<TUint32> destinationIds;
       
   215     CleanupClosePushL( destinationIds );
       
   216     
       
   217     iCmManagerExt.AllDestinationsL( destinationIds );
       
   218     
       
   219     // Find our service destination from Iap ids.
       
   220     for ( TInt i( 0 ) ; i < destinationIds.Count() && KErrNone != aError; i++ )
       
   221         {
       
   222         RCmDestinationExt refDestination = 
       
   223             iCmManagerExt.DestinationL( destinationIds[ i ] );
       
   224         CleanupClosePushL( refDestination );
       
   225         
       
   226         HBufC* destName = refDestination.NameLC();
       
   227         RCmConnectionMethodExt connectionMethod;
       
   228         CleanupClosePushL( connectionMethod );
       
   229         
       
   230         TRAPD( error, connectionMethod =
       
   231             refDestination.ConnectionMethodByIDL( aIapId ) );
       
   232         
       
   233         if ( KErrNone == error )
       
   234             {
       
   235             CCHUIDEBUG( 
       
   236                 "GetDestinationsL - IapID found from destination" );
       
   237             aDestinationId = destinationIds[ i ];
       
   238             aError = KErrNone;
       
   239             }
       
   240         CleanupStack::PopAndDestroy( &connectionMethod );
       
   241         CleanupStack::PopAndDestroy( destName );
       
   242         CleanupStack::PopAndDestroy( &refDestination );
       
   243         }
       
   244     
       
   245     CleanupStack::PopAndDestroy( &destinationIds );
       
   246 
       
   247     CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationL - OUT" );
       
   248     }
       
   249 
       
   250 // ---------------------------------------------------------------------------
   204 // Gets all access point ids from SNAP.
   251 // Gets all access point ids from SNAP.
   205 // ---------------------------------------------------------------------------
   252 // ---------------------------------------------------------------------------
   206 //
   253 //
   207 void CCchUiNotifConnectionHandler::GetAccessPointsFromSnapL( 
   254 void CCchUiNotifConnectionHandler::GetAccessPointsFromSnapL( 
   208     RArray<TUint32>& aIapIds, TUint32 aDestinationId )
   255     RArray<TUint32>& aIapIds, TUint32 aDestinationId )
   276         }
   323         }
   277 
   324 
   278     CCHUIDEBUG( 
   325     CCHUIDEBUG( 
   279         "CCchUiNotifConnectionHandler::GetGprsAccessPointsFromSnapL - OUT" );
   326         "CCchUiNotifConnectionHandler::GetGprsAccessPointsFromSnapL - OUT" );
   280     }
   327     }
       
   328 
       
   329 // ---------------------------------------------------------------------------
       
   330 // CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL
       
   331 // ---------------------------------------------------------------------------
       
   332 //
       
   333 TInt CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL(
       
   334     CDesCArray& aIaps, RArray<TUint32>& aIapIds, TUint aIapId )
       
   335     {
       
   336     CCHUIDEBUG2( 
       
   337         "CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL - IN aIapId = %d", aIapId );
       
   338     
       
   339     TUint32 destinationId = 0;
       
   340     TInt error;
       
   341     GetDestinationL( aIapId, error, destinationId );
       
   342     if ( KErrNone == error )
       
   343         {
       
   344         CCHUIDEBUG2( 
       
   345             "GetGprsAccessPointsSetToServiceSnapL - destinationId = %d", destinationId );
       
   346         
       
   347         RCmDestinationExt refDestination;
       
   348         CleanupClosePushL( refDestination );
       
   349         TRAPD( error,
       
   350             refDestination = iCmManagerExt.DestinationL( destinationId ) );
       
   351         CCHUIDEBUG2(
       
   352             "GetGprsAccessPointsSetToServiceSnapL -Destination error %d", error );
       
   353         
       
   354         if ( KErrNone == error )
       
   355             {
       
   356             GetGprsAccessPointsFromSnapL( aIaps, aIapIds, refDestination );
       
   357             }
       
   358         CleanupStack::PopAndDestroy( &refDestination );
       
   359         }
       
   360 
       
   361     CCHUIDEBUG2(
       
   362         "CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL -return %d", error );
       
   363     
       
   364     return error;
       
   365     }
       
   366 
       
   367 // ---------------------------------------------------------------------------
       
   368 // CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL
       
   369 // ---------------------------------------------------------------------------
       
   370 //
       
   371 TBool CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL(
       
   372     TUint32 aIapId, TUint32 aIapIdToCompare )
       
   373     {
       
   374     CCHUIDEBUG( "CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL - IN" );
       
   375     
       
   376     TBool returnVal = EFalse;
       
   377     TUint32 bearerType = iCmManagerExt.GetConnectionMethodInfoIntL(
       
   378         aIapId, CMManager::ECmBearerType );
       
   379     if ( bearerType == iCmManagerExt.GetConnectionMethodInfoIntL(
       
   380         aIapIdToCompare, CMManager::ECmBearerType ) )
       
   381         {
       
   382         HBufC* buffer = NULL;
       
   383         HBufC* bufferToCompare = NULL;
       
   384         
       
   385         switch( bearerType )
       
   386             {
       
   387             case KUidWlanBearerType:
       
   388                 CCHUIDEBUG( "IsConnectionMethodSimilarL - KUidWlanBearerType" );
       
   389                 buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
       
   390                     aIapId, CMManager::EWlanSSID );
       
   391                 CCHUIDEBUG( "GetConnectionMethodInfoStringL - aIapId EWlanSSID OUT" );
       
   392                 CleanupStack::PushL( buffer );
       
   393                 bufferToCompare = iCmManagerExt.GetConnectionMethodInfoStringL(
       
   394                     aIapIdToCompare, CMManager::EWlanSSID );
       
   395                 if ( buffer->Compare( *bufferToCompare ) == 0 )
       
   396                     {
       
   397                     returnVal = ETrue;
       
   398                     }
       
   399                 CleanupStack::PopAndDestroy( buffer );
       
   400                 delete bufferToCompare;
       
   401                 bufferToCompare = NULL;
       
   402                 break;
       
   403             case KUidPacketDataBearerType:
       
   404                 CCHUIDEBUG( "IsConnectionMethodSimilarL - KUidPacketDataBearerType" );
       
   405                 buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
       
   406                     aIapId, CMManager::EPacketDataAPName );
       
   407                 CleanupStack::PushL( buffer );
       
   408                 bufferToCompare = iCmManagerExt.GetConnectionMethodInfoStringL(
       
   409                     aIapIdToCompare, CMManager::EPacketDataAPName );
       
   410                 if ( buffer->Compare( *bufferToCompare ) == 0 )
       
   411                     {
       
   412                     returnVal = ETrue;
       
   413                     }
       
   414                 CleanupStack::PopAndDestroy( buffer );
       
   415                 delete bufferToCompare;
       
   416                 bufferToCompare = NULL;
       
   417                 break;
       
   418             default:
       
   419 			    CCHUIDEBUG( "IsConnectionMethodSimilarL - Bearer type unknown" );
       
   420                 break;
       
   421             }
       
   422         }
       
   423     CCHUIDEBUG2(
       
   424         "CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL -return = %d", returnVal );
       
   425     
       
   426     return returnVal;
       
   427     }