realtimenetprots/sipfw/SIP/ConnectionMgr/src/TStateActiveResolved.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name        : TStateActiveResolved.cpp
       
    15 // Part of     : ConnectionMgr
       
    16 // Implementation
       
    17 // Version     : SIP/4.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 #include "TStateActiveResolved.h"
       
    23 #include "msipconnectioncontext.h"
       
    24 #include "SipLogs.h"
       
    25 #include <featmgr.h>
       
    26 
       
    27 
       
    28 // ----------------------------------------------------------------------------
       
    29 // TStateActiveResolved::SendL
       
    30 // ----------------------------------------------------------------------------
       
    31 //
       
    32 void TStateActiveResolved::SendL( const TSIPTransportParams& aParams,
       
    33                                   CSIPRequest& aRequest,
       
    34                                   TBool aForceUDP,
       
    35                                   const CUri8* aOutboundProxy,
       
    36 								  const TInetAddr& aRemoteAddr,
       
    37 								  TRequestStatus& aStatus )
       
    38 	{
       
    39 	iContext.SendToTransportL( 
       
    40 	    aParams, aRequest, aForceUDP, aOutboundProxy, aRemoteAddr, aStatus );
       
    41 	}
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // TStateActiveResolved::SendL
       
    45 // ----------------------------------------------------------------------------
       
    46 //
       
    47 void TStateActiveResolved::SendL( const TSIPTransportParams& aParams,
       
    48                                   CSIPResponse& aResponse,
       
    49 								  TTransactionId aId,
       
    50 								  TRequestStatus& aStatus )
       
    51 	{
       
    52 	iContext.SendToTransportL( aParams, aResponse, aId, aStatus );
       
    53 	}
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // TStateActiveResolved::NetworkStateChanged
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 void TStateActiveResolved::NetworkStateChanged(
       
    60     MSIPNetworkObserver::TNetworkState aState,
       
    61     TInt aError )
       
    62 	{
       
    63 	 __SIP_INT_LOG2( "TStateActiveResolved::NetworkStateChanged", aState, aError )
       
    64 	if( aError)
       
    65 		{
       
    66 	if(FeatureManager::FeatureSupported( KFeatureIdFfSipCustomPdpHandling ))
       
    67 		{
       
    68 			if(iContext.ConnectionType() != MSIPConnectionContext::ELanBearer)
       
    69 				{
       
    70 				if( aState == MSIPNetworkObserver::EConnectionLost )
       
    71 					{
       
    72 					if(iContext.ContinueMonitoring( aError ))
       
    73 						EnterState( MStateModel::EInactiveMonitoring, aError );
       
    74 					}
       
    75 				}
       
    76 		}
       
    77 		if (iContext.ConnectionType()==MSIPConnectionContext::ELanBearer)
       
    78 		{
       
    79 		EnterState( MStateModel::EInactiveMonitoring, aError ); // For Any Error on WLAN, Enable Recovery Timers.
       
    80 		}
       
    81 		else
       
    82 		{
       
    83 		EnterState( MStateModel::EUnavailable, aError ); //For other bearers No recovery possible.
       
    84 		}
       
    85 		return;
       
    86 		}
       
    87 
       
    88 	if( aState == MSIPNetworkObserver::ENetworkSuspended )
       
    89 		{
       
    90 		EnterState( MStateModel::ESuspended );
       
    91 		}
       
    92 	else if( aState == MSIPNetworkObserver::ENetworkInactive )
       
    93 		{
       
    94 		EnterState( MStateModel::EInactiveMonitoring );
       
    95 		}
       
    96 	else if( aState == MSIPNetworkObserver::EConnectionLost )
       
    97 		{
       
    98 		EnterState( MStateModel::EInactiveConnecting );
       
    99 		}		
       
   100 	else
       
   101 		{
       
   102 		// do nothing, "else" required by PC-Lint..
       
   103 		}
       
   104 	}