bearermanagement/S60MCPR/src/s60mcprstates.cpp
branchRCL_3
changeset 69 cf1b3ddbe9a1
parent 62 bb1f80fb7db2
equal deleted inserted replaced
65:14754bf06654 69:cf1b3ddbe9a1
   212         error = err.iStateChange.iError;
   212         error = err.iStateChange.iError;
   213         }
   213         }
   214 
   214 
   215     ASSERT( error != KErrNone );
   215     ASSERT( error != KErrNone );
   216     
   216     
       
   217     // Special handling for GoneDown errors. In this phase it is necessary
       
   218     // to make sure that we are actually in GoneDown recovery, not in 
       
   219     // start recovery. So check activity instead of error code
       
   220     if (iContext.iNodeActivity->ActivityId() == ECFActivityConnectionGoneDownRecovery)
       
   221         {
       
   222         // We are requesting error recovery from MPM for GoneDown error
       
   223         // Set the flag indicating that lower layer is not in a valid state
       
   224         // so that we can discard NoBearer request coming from data clients
       
   225         // for the time being.
       
   226         S60MCPRLOGSTRING1("S60MCPR<%x>::TProcessError::DoL() Setting GoneDown recovery flag",(TInt*)&iContext.Node())
       
   227         node.SetGoneDownRecoveryOngoing();
       
   228         }    
       
   229     
   217     // Create the callback that will eventually create the message that completes this state.
   230     // Create the callback that will eventually create the message that completes this state.
   218     CProcessErrorCb* cb = new( ELeave ) CProcessErrorCb( node, iContext.iNodeActivity );  // codescanner::leave
   231     CProcessErrorCb* cb = new( ELeave ) CProcessErrorCb( node, iContext.iNodeActivity );  // codescanner::leave
   219     CleanupStack::PushL( cb );  // codescanner::leave
   232     CleanupStack::PushL( cb );  // codescanner::leave
   220     // We always need to ask MPM to handle the error.
   233     // We always need to ask MPM to handle the error.
   221     node.Policy()->ProcessErrorL( error, cb );  // codescanner::leave
   234     node.Policy()->ProcessErrorL( error, cb );  // codescanner::leave
   222     CleanupStack::Pop( cb );
   235     CleanupStack::Pop( cb );
   223     // After this we wait for cancellation/error/completion.
   236     // After this we wait for cancellation/error/completion.
   224     }
   237     }
   225 
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // THandleNoBearerDuringGoneDownRecovery::DoL
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 DEFINE_SMELEMENT( THandleNoBearerDuringGoneDownRecovery, NetStateMachine::MStateTransition, TContext )
       
   244 void THandleNoBearerDuringGoneDownRecovery::DoL() // codescanner::leave
       
   245     { 
       
   246     // As this is a single triple activity, there is no real activity
       
   247     // instance available. Therefore, we need to live with the info
       
   248     // available in the context.
       
   249     S60MCPRLOGSTRING1("S60MCPR<%x>::THandleNoBearerDuringGoneDownRecovery::DoL() Return error",(TInt*)&iContext.Node())
       
   250     TEBase::TError errorMsg ( iContext.iMessage.MessageId(), KErrNotReady );
       
   251     iContext.PostToSender( errorMsg );
       
   252     }
   226 
   253 
   227 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   228 // TAwaitingSelectNextLayerCompletedOrError::Accept
   255 // TAwaitingSelectNextLayerCompletedOrError::Accept
   229 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   230 //
   257 //
   480         }
   507         }
   481 
   508 
   482     return EFalse;
   509     return EFalse;
   483     }
   510     }
   484 
   511 
   485 
   512 // -----------------------------------------------------------------------------
       
   513 // TAwaitingDataClientIdle::Accept
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 DEFINE_SMELEMENT( TAwaitingDataClientIdle, NetStateMachine::MState, TContext )
       
   517 TBool TAwaitingDataClientIdle::Accept()
       
   518     {
       
   519     if (!iContext.iMessage.IsMessage<TCFControlProvider::TIdle>())
       
   520         {
       
   521         return EFalse;
       
   522         }
       
   523     __ASSERT_DEBUG(iContext.iPeer, User::Panic(KS60MCprPanic, KPanicPeerMessage));
       
   524     iContext.iPeer->ClearFlags(TCFClientType::EActive);
       
   525     return ETrue;
       
   526     }
       
   527 
       
   528 // -----------------------------------------------------------------------------
       
   529 // TAwaitingDataClientStatusChange::Accept
       
   530 // -----------------------------------------------------------------------------
       
   531 //
       
   532 DEFINE_SMELEMENT( TAwaitingDataClientStatusChange, NetStateMachine::MState, TContext )
       
   533 TBool TAwaitingDataClientStatusChange::Accept()
       
   534     {
       
   535     // Consume the received DataClientStatusChange if a DataClientIdle activity is running
       
   536     if (iContext.iMessage.IsMessage<TCFControlProvider::TDataClientStatusChange>() &&
       
   537         (iContext.Node().CountActivities( ECFActivityS60McprDataClientIdle ) > 0))
       
   538         {
       
   539         return ETrue;
       
   540         }
       
   541     return EFalse;
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // TAwaitingNoBearerInGoneDownRecovery::Accept
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 DEFINE_SMELEMENT( TAwaitingNoBearerInGoneDownRecovery, NetStateMachine::MState, TContext )
       
   549 TBool TAwaitingNoBearerInGoneDownRecovery::Accept()
       
   550     {
       
   551     if ( iContext.iMessage.IsMessage<TCFControlProvider::TNoBearer>() )
       
   552         {
       
   553         // Get MCPR to check gone down flag status 
       
   554         CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
       
   555         if ( node.IsGoneDownRecoveryOngoing() )
       
   556             {
       
   557             // We have received a NoBearer while recovering from a GoneDown error
       
   558             // Needs special handling -> accept
       
   559             S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingNoBearerInGoneDownRecovery::Accept() return true", (TInt*)&iContext.Node())
       
   560             return ETrue;
       
   561             }
       
   562         }
       
   563     return EFalse;
       
   564     }
   486 
   565 
   487 // -----------------------------------------------------------------------------
   566 // -----------------------------------------------------------------------------
   488 // TRetrieveServiceId::DoL
   567 // TRetrieveServiceId::DoL
   489 // -----------------------------------------------------------------------------
   568 // -----------------------------------------------------------------------------
   490 //
   569 //