388 { |
389 { |
389 return EFalse; |
390 return EFalse; |
390 } |
391 } |
391 } |
392 } |
392 |
393 |
|
394 |
|
395 // ----------------------------------------------------------------------------- |
|
396 // TAwaitingStopIAPNotification::Accept |
|
397 // ----------------------------------------------------------------------------- |
|
398 // |
|
399 DEFINE_SMELEMENT( TAwaitingStopIAPNotification, NetStateMachine::MState, TContext ) |
|
400 TBool TAwaitingStopIAPNotification::Accept() |
|
401 { |
|
402 TUint32 iapId( 0 ); |
|
403 TCFS60MCPRMessage::TMPMStopIAPNotificationMsg* msg = |
|
404 message_cast<TCFS60MCPRMessage::TMPMStopIAPNotificationMsg>(&iContext.iMessage); |
|
405 if ( msg ) |
|
406 { |
|
407 iapId = msg->iValue; |
|
408 // Only accept the notification if it matches current service provider, or if the IAP is undefined |
|
409 if ( iContext.Node().ServiceProvider() && |
|
410 (((RMetaServiceProviderInterface*)iContext.Node().ServiceProvider())->ProviderInfo().APId() == iapId || |
|
411 iapId == 0 ) ) |
|
412 { |
|
413 return ETrue; |
|
414 } |
|
415 #ifdef _DEBUG |
|
416 else |
|
417 { |
|
418 S60MCPRLOGSTRING2("S60MCPR<%x>::TAwaitingStopIAPNotification() NO MATCH! IAP %d",(TInt*)this,iapId); |
|
419 } |
|
420 #endif |
|
421 } |
|
422 return EFalse; |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // TProcessError::DoL |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 DEFINE_SMELEMENT( TSendStop, NetStateMachine::MStateTransition, TContext ) |
|
430 void TSendStop::DoL() // codescanner::leave |
|
431 { |
|
432 __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity)); |
|
433 __ASSERT_DEBUG(iContext.Node().ServiceProvider(), User::Panic(KS60MCprPanic, KPanicNoServiceProvider)); |
|
434 |
|
435 // Send TStop to current Service Provider. |
|
436 iContext.iNodeActivity->PostRequestTo( |
|
437 iContext.Node().ServiceProvider()->RecipientId(), |
|
438 TCFServiceProvider::TStop( KErrDisconnected ).CRef() ); |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // TAwaitingStoppedOrError::Accept |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 DEFINE_SMELEMENT( TAwaitingStoppedOrError, NetStateMachine::MState, TContext ) |
|
446 TBool TAwaitingStoppedOrError::Accept() |
|
447 { |
|
448 __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity)); |
|
449 |
|
450 if ( iContext.iMessage.IsMessage<TCFServiceProvider::TStopped>() ) |
|
451 { |
|
452 return ETrue; |
|
453 } |
|
454 |
|
455 // Error is returned if S60MCPR leaves IPProtoMCPr before Stopped is received |
|
456 if( iContext.iMessage.IsMessage<TEBase::TError>() ) |
|
457 { |
|
458 // Ignore the error code. It's better than crashing. |
|
459 // Propagating might lead to situation where self-posted message ends up to a dead node. |
|
460 return ETrue; |
|
461 } |
|
462 |
|
463 // Rare scenario: if the stopping service provider is sending a TStateChange message, |
|
464 // and a mobility activity is ongoing, the message must be ignored in order to keep |
|
465 // harmful connection stages such as KLinkLayerClosed from reaching the client |
|
466 TUint32 mobilityActivities = iContext.Node().CountActivities( ECFActivityMCprMobility ); |
|
467 TBool isStateChange = iContext.iMessage.IsMessage<TCFMessage::TStateChange>(); |
|
468 TBool isServProvider = |
|
469 iContext.iPeer && |
|
470 iContext.iPeer->Type() == TCFClientType::EServProvider && |
|
471 iContext.iPeer->Flags() & TCFClientType::EActive; |
|
472 |
|
473 S60MCPRLOGSTRING4("S60MCPR<%x>::TAwaitingStoppedOrError() M %d, SC %d, SP %d",(TInt*)this, |
|
474 mobilityActivities, isStateChange, isServProvider ); |
|
475 |
|
476 if ( isStateChange && isServProvider && mobilityActivities > 0 ) |
|
477 { |
|
478 // Discard the message |
|
479 iContext.iMessage.ClearMessageId(); |
|
480 } |
|
481 |
|
482 return EFalse; |
|
483 } |
|
484 |
|
485 // ----------------------------------------------------------------------------- |
|
486 // TAwaitingDataClientIdle::Accept |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 DEFINE_SMELEMENT( TAwaitingDataClientIdle, NetStateMachine::MState, TContext ) |
|
490 TBool TAwaitingDataClientIdle::Accept() |
|
491 { |
|
492 if (!iContext.iMessage.IsMessage<TCFControlProvider::TIdle>()) |
|
493 { |
|
494 return EFalse; |
|
495 } |
|
496 __ASSERT_DEBUG(iContext.iPeer, User::Panic(KS60MCprPanic, KPanicPeerMessage)); |
|
497 iContext.iPeer->ClearFlags(TCFClientType::EActive); |
|
498 return ETrue; |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // TAwaitingDataClientStatusChange::Accept |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 DEFINE_SMELEMENT( TAwaitingDataClientStatusChange, NetStateMachine::MState, TContext ) |
|
506 TBool TAwaitingDataClientStatusChange::Accept() |
|
507 { |
|
508 // Consume the received DataClientStatusChange if a DataClientIdle activity is running |
|
509 if (iContext.iMessage.IsMessage<TCFControlProvider::TDataClientStatusChange>() && |
|
510 (iContext.Node().CountActivities( ECFActivityS60McprDataClientIdle ) > 0)) |
|
511 { |
|
512 return ETrue; |
|
513 } |
|
514 return EFalse; |
|
515 } |
|
516 |
393 // ----------------------------------------------------------------------------- |
517 // ----------------------------------------------------------------------------- |
394 // TRetrieveServiceId::DoL |
518 // TRetrieveServiceId::DoL |
395 // ----------------------------------------------------------------------------- |
519 // ----------------------------------------------------------------------------- |
396 // |
520 // |
397 DEFINE_SMELEMENT( TRetrieveServiceId, NetStateMachine::MStateTransition, TContext ) |
521 DEFINE_SMELEMENT( TRetrieveServiceId, NetStateMachine::MStateTransition, TContext ) |