convergedconnectionhandler/cchserver/src/cchserviceinfo.cpp
branchRCL_3
changeset 14 be41ab7b952f
parent 12 876a3df1f464
equal deleted inserted replaced
12:876a3df1f464 14:be41ab7b952f
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-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".
   552     CCHLOGSTRING( "CCCHServiceInfo::UpdateL: IN" );
   552     CCHLOGSTRING( "CCCHServiceInfo::UpdateL: IN" );
   553     
   553     
   554     iIsEnabled = EFalse;
   554     iIsEnabled = EFalse;
   555     if ( aReadServiceTable )
   555     if ( aReadServiceTable )
   556         {
   556         {
   557         TBool found( EFalse );
   557         TUint validSubserviceCount( 0 );
   558         TInt index( KErrNotFound );
   558         TInt index( KErrNotFound );
   559         TCCHService service;
   559         TCCHService service;
   560         // Read service information from service table
   560         // Read service information from service table
   561         iServer.SPSHandler().GetServiceInfoL( iServiceId , service );
   561         iServer.SPSHandler().GetServiceInfoL( iServiceId , service );
       
   562 
   562         for ( TInt i( 0 ); i < service.iSubservices.Count(); i++ )
   563         for ( TInt i( 0 ); i < service.iSubservices.Count(); i++ )
   563             {            
   564             {            
   564             TCCHSubservice subservice = service.iSubservices[ i ];
   565             TCCHSubservice subservice = service.iSubservices[ i ];
   565             
   566             
   566             if ( KErrNotFound != ( index = FindSubservice( 
   567             if ( KErrNotFound != ( index = FindSubservice( 
   573                 iSubservices[ index ]->Update();
   574                 iSubservices[ index ]->Update();
   574                 if ( !iIsEnabled )
   575                 if ( !iIsEnabled )
   575                     {
   576                     {
   576                     iIsEnabled = iSubservices[ index ]->IsEnabled();
   577                     iIsEnabled = iSubservices[ index ]->IsEnabled();
   577                     }
   578                     }
       
   579                 
       
   580                 validSubserviceCount++;
       
   581                 }
       
   582             else if ( ECCHUnknown != subservice.iConnectionInfo.iServiceSelection.iType )
       
   583                 {
       
   584                 AddSubserviceL( subservice );
       
   585                 validSubserviceCount++;
   578                 }
   586                 }
   579             else
   587             else
   580                 {
   588                 {
   581                 AddSubserviceL( subservice );
   589                 // do nothing
   582                 }
   590                 }
   583             }
   591             }
       
   592         
   584         // Check that all subservices really exist in service table
   593         // Check that all subservices really exist in service table
   585         if ( service.iSubservices.Count() < iSubservices.Count() )
   594         if ( validSubserviceCount < iSubservices.Count() )
   586             {
   595             {
       
   596             CCHLOGSTRING( "CCCHServiceInfo::UpdateL: check subservices -> need update" );
       
   597         
   587             for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
   598             for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
   588                 {                
   599                 {
   589                 found = ETrue;
   600                 TBool found( EFalse );
   590                 for ( TInt j( 0 ); j < service.iSubservices.Count() && 
   601                 TCCHSubserviceType type = iSubservices[ i ]->Type();
   591                     found; j++ )
   602                          
       
   603                 for ( TInt j( 0 ) ; j < service.iSubservices.Count() && !found ; j++ )
   592                     {
   604                     {
   593                     found = 
   605                     CCHLOGSTRING2( "CCCHServiceInfo::UpdateL: type 1=%d", type );
   594                         service.iSubservices[ j ].iConnectionInfo.iServiceSelection.iType == 
   606                     CCHLOGSTRING2( "CCCHServiceInfo::UpdateL: type 2=%d", 
   595                             iSubservices[ i ]->Type();
   607                         service.iSubservices[ j ].iConnectionInfo.iServiceSelection.iType );
       
   608                 
       
   609                     if ( service.iSubservices[ j ].iConnectionInfo.iServiceSelection.iType == type )
       
   610                         {
       
   611                         CCHLOGSTRING( "CCCHServiceInfo::UpdateL: check subservices -> found" );
       
   612                         found = ETrue;
       
   613                         }
   596                     }
   614                     }
   597                 // if this subservice is not in service table then remove it.
   615                 
   598                 if ( !found )
   616                 if ( !found )
   599                     {
   617                     {
       
   618                     CCHLOGSTRING( "CCCHServiceInfo::UpdateL: remove subservice" );
       
   619                 
   600                     delete iSubservices[ i ];
   620                     delete iSubservices[ i ];
   601                     iSubservices.Remove( i );
   621                     iSubservices.Remove( i );
   602                     i--;
   622                     i--;
   603                     }                
   623                     }              
   604                 }
   624                 }
   605             }
   625             }
   606         }
   626         }
   607     else
   627     else
   608         {
   628         {
   862     TBool ret( EFalse );
   882     TBool ret( EFalse );
   863     for ( TInt i( 0 ); i < iSubservices.Count() && !ret; i++ )
   883     for ( TInt i( 0 ); i < iSubservices.Count() && !ret; i++ )
   864         {
   884         {
   865         ret = iSubservices[ i ]->GetStartUpFlag(); 
   885         ret = iSubservices[ i ]->GetStartUpFlag(); 
   866         }
   886         }
   867     CCHLOGSTRING2( "CCCHServiceHandler::StartupFlagSet: %d", ret );        
   887     CCHLOGSTRING2( "CCCHServiceInfo::StartupFlagSet: %d", ret );        
   868     return ret;
   888     return ret;
   869     }
   889     }
   870 
   890 
   871 // ---------------------------------------------------------------------------
   891 // ---------------------------------------------------------------------------
   872 // CCCHServiceInfo::StartupFlagSet
   892 // CCCHServiceInfo::StartupFlagSet