bearermanagement/S60MCPR/src/s60mcprstates.cpp
changeset 23 7ec726f93df1
parent 18 fcbbe021d614
child 41 bbb64eb3bdee
equal deleted inserted replaced
20:9c97ad6591ae 23:7ec726f93df1
   127     // Choose Service Providers to work on
   127     // Choose Service Providers to work on
   128     TClientIter<TDefaultClientMatchPolicy> iter = 
   128     TClientIter<TDefaultClientMatchPolicy> iter = 
   129         iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
   129         iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
   130     
   130     
   131     RMetaServiceProviderInterface* itf = NULL;
   131     RMetaServiceProviderInterface* itf = NULL;
   132     //RNodeInterface* itf = NULL;
       
   133     
   132     
   134     for ( itf = (RMetaServiceProviderInterface*)iter++;
   133     for ( itf = (RMetaServiceProviderInterface*)iter++;
   135              ( itf != NULL && ( stoppingSP == NULL || startingSP == NULL ) );
   134              ( itf != NULL && ( stoppingSP == NULL || startingSP == NULL ) );
   136              itf = (RMetaServiceProviderInterface*)iter++ )
   135              itf = (RMetaServiceProviderInterface*)iter++ )
   137         {
   136         {
   153                 }
   152                 }
   154             // no else.
   153             // no else.
   155             //
   154             //
   156             }
   155             }
   157         }
   156         }
   158     // One must be started since this is already a reconnection
   157     
   159     if ( stoppingSP==NULL )
   158     if ( stoppingSP == NULL )
   160         { 
   159         { 
   161         // Indication of a serious problem.
   160         // If the above loop did not select a stoppingSP, the only reasonable chance is that
   162         S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnect::DoL() - started service provider not found.",(TInt*)&iContext.Node())
   161         // this is one of the rare cases where reconnection is done to the same service provider.
   163         ASSERT( EFalse );
   162         S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnect::DoL() - reconnection to same service provider",(TInt*)&iContext.Node())
   164         User::Leave( KErrCorrupt );  // codescanner::leave
   163         stoppingSP = startingSP;
   165         }
   164         }
   166 
   165 
   167     //If there is no other Service Provider to try, return KErrNotFound
   166     //If there is no other Service Provider to try, return KErrNotFound
   168     if ( startingSP == NULL )
   167     if ( startingSP == NULL )
   169         {
   168         {
   178     iContext.iNodeActivity->PostRequestTo( iContext.NodeId(),
   177     iContext.iNodeActivity->PostRequestTo( iContext.NodeId(),
   179                                            TCFMcpr::TReConnect( stoppingSP->RecipientId(), 
   178                                            TCFMcpr::TReConnect( stoppingSP->RecipientId(), 
   180                                                                 startingSP->RecipientId()).CRef() );
   179                                                                 startingSP->RecipientId()).CRef() );
   181     }
   180     }
   182 
   181 
   183 // -----------------------------------------------------------------------------
   182 
   184 // TRequestReConnectToCurrentSP::DoL
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 DEFINE_SMELEMENT( TRequestReConnectToCurrentSP, NetStateMachine::MStateTransition, TContext )
       
   188 void TRequestReConnectToCurrentSP::DoL() // codescanner::leave
       
   189     {
       
   190     __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
       
   191     S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnectToCurrentSP::DoL()",(TInt*)&iContext.Node())
       
   192     RNodeInterface* currentSP = iContext.Node().ServiceProvider();
       
   193 
       
   194     // There MUST be a service provider
       
   195     __ASSERT_DEBUG( currentSP != NULL, User::Panic(KS60MCprPanic, KPanicNoServiceProvider));
       
   196     
       
   197     // Diagnostic - there must be a data client or we cannot be here
       
   198     __ASSERT_DEBUG(iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData)),
       
   199                    User::Panic(KS60MCprPanic, KPanicNoDataClient));    
       
   200     
       
   201     iContext.iNodeActivity->PostRequestTo( iContext.NodeId(),
       
   202                                            TCFMcpr::TReConnect( currentSP->RecipientId(), 
       
   203                                                                 currentSP->RecipientId()).CRef() );
       
   204     }
       
   205 // -----------------------------------------------------------------------------
   183 // -----------------------------------------------------------------------------
   206 // TProcessError::DoL
   184 // TProcessError::DoL
   207 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   208 //
   186 //
   209 DEFINE_SMELEMENT( TProcessError, NetStateMachine::MStateTransition, TContext )
   187 DEFINE_SMELEMENT( TProcessError, NetStateMachine::MStateTransition, TContext )