699 } |
699 } |
700 #endif // _DEBUG |
700 #endif // _DEBUG |
701 } |
701 } |
702 |
702 |
703 // ----------------------------------------------------------------------------- |
703 // ----------------------------------------------------------------------------- |
704 // CMPMServer::CheckIfStarted |
704 // CMPMServer::CheckUsageOfIap |
705 // ----------------------------------------------------------------------------- |
705 // ----------------------------------------------------------------------------- |
706 // |
706 // |
707 TBool CMPMServer::CheckIfStarted( const TUint32 aIapId , |
707 TConnectionState CMPMServer::CheckUsageOfIap( const TUint32 aIapId , |
708 const TConnectionId aConnId ) |
708 const TConnectionId aOwnConnId ) |
709 { |
709 { |
710 MPMLOGSTRING3( "CMPMServer::CheckIfStarted - aIapId = %i, aConnId = 0x%x", |
710 MPMLOGSTRING3( "CMPMServer::CheckUsageOfIap - aIapId = %i, aOwnConnId = 0x%x", |
711 aIapId, aConnId ) |
711 aIapId, aOwnConnId ) |
712 |
712 |
713 TConnectionState state( EIdle ); |
713 TConnectionState state = EIdle; |
714 TBool stopLoop( EFalse ); |
|
715 |
714 |
716 // Loop all connections until EStarted is found or no more connections |
715 // Loop all connections until EStarted is found or no more connections |
717 // |
716 // |
718 for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ ) |
717 for ( TInt i = 0; i < iActiveBMConns.Count(); i++ ) |
719 { |
718 { |
720 // Check if IAP Id matches; exclude matching with own connection |
719 // Check if IAP Id matches; exclude matching with own connection |
721 // |
720 // |
722 if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId && |
721 if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId && |
723 iActiveBMConns[i].iConnInfo.iConnId != aConnId) |
722 iActiveBMConns[i].iConnInfo.iConnId != aOwnConnId) |
724 { |
723 { |
725 state = iActiveBMConns[i].iConnInfo.iState; |
724 state = iActiveBMConns[i].iConnInfo.iState; |
726 |
725 |
727 // Stop looping if EStarted found |
726 // Stop looping if EStarted found |
728 // |
727 // |
729 if ( state == EStarted ) |
728 if ( state == EStarted ) |
730 { |
729 { |
731 stopLoop = ETrue; |
730 break; // Breaks the for loop |
732 } |
731 } |
733 } |
732 } |
734 } |
733 } |
735 |
734 |
736 #ifdef _DEBUG |
735 #ifdef _DEBUG |
737 switch( state ) |
736 switch( state ) |
738 { |
737 { |
739 case EStarting: |
738 case EStarting: |
740 { |
739 { |
741 MPMLOGSTRING( "CMPMServer::CheckIfStarted - Starting" ) |
740 MPMLOGSTRING( "CMPMServer::CheckUsageOfIap - Starting" ) |
742 break; |
741 break; |
743 } |
742 } |
744 case EStarted: |
743 case EStarted: |
745 { |
744 { |
746 MPMLOGSTRING( "CMPMServer::CheckIfStarted - Started" ) |
745 MPMLOGSTRING( "CMPMServer::CheckUsageOfIap - Started" ) |
747 break; |
746 break; |
748 } |
747 } |
749 case EIdle: |
748 case EIdle: |
750 { |
749 { |
751 MPMLOGSTRING( "CMPMServer::CheckIfStarted - Idle" ) |
750 MPMLOGSTRING( "CMPMServer::CheckUsageOfIap - Idle" ) |
752 break; |
751 break; |
753 } |
752 } |
754 case ERoaming: |
753 case ERoaming: |
755 { |
754 { |
756 MPMLOGSTRING( "CMPMServer::CheckIfStarted - Roaming" ) |
755 MPMLOGSTRING( "CMPMServer::CheckUsageOfIap - Roaming" ) |
757 break; |
756 break; |
758 } |
757 } |
759 default: |
758 default: |
760 { |
759 { |
761 MPMLOGSTRING( "CMPMServer::CheckIfStarted - Unknown" ) |
760 MPMLOGSTRING( "CMPMServer::CheckUsageOfIap - Unknown" ) |
762 break; |
761 break; |
763 } |
762 } |
764 } |
763 } |
765 #endif // _DEBUG |
764 #endif // _DEBUG |
766 |
765 |
767 //Return true incase the matching connection is in EStarting state also because |
766 return state; |
768 //sometimes when connections are started simultaneously (for same iapID) |
|
769 //the first connection may still be in EStarting state. |
|
770 // |
|
771 if ( state == EStarted || state == EStarting ) |
|
772 { |
|
773 return ETrue; |
|
774 } |
|
775 else |
|
776 { |
|
777 return EFalse; |
|
778 } |
|
779 } |
767 } |
780 |
768 |
781 // ----------------------------------------------------------------------------- |
769 // ----------------------------------------------------------------------------- |
782 // CMPMServer::IsWlanConnectionStartedL |
770 // CMPMServer::IsWlanConnectionStartedL |
783 // ----------------------------------------------------------------------------- |
771 // ----------------------------------------------------------------------------- |