multimediacommsengine/mmcesrv/mmceserver/src/mcenatstateinitializing.cpp
changeset 0 1bce908db942
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcenatstateinitializing.cpp	Tue Feb 02 01:04:58 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "mcenatstateinitializing.h"
+#include "mcenatevents.h"
+#include "mcenatactions.h"
+#include "mcesrvlogs.h"
+
+#include "mcenatsipsession.h"
+#include "mceactionset.h"
+#include "mceclientserver.h"
+
+// -----------------------------------------------------------------------------
+// CMceNatStateInitializing::CMceNatStateInitializing
+// -----------------------------------------------------------------------------
+//
+CMceNatStateInitializing::CMceNatStateInitializing()
+	{
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMceNatStateInitializing::~CMceNatStateInitializing
+// -----------------------------------------------------------------------------
+//
+CMceNatStateInitializing::~CMceNatStateInitializing()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CMceNatStateInitializing::Accept
+// -----------------------------------------------------------------------------
+//
+TBool CMceNatStateInitializing::Accept( TMceNatStateTransitionEvent& aEvent )
+    {
+	switch ( aEvent.NatCode() )
+		{
+		case EMceNatInitialized:
+		case EMceNatUpdated:
+        	return ETrue;
+
+		default:
+        	return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMceNatStateInitializing::EntryL
+// -----------------------------------------------------------------------------
+//
+void CMceNatStateInitializing::EntryL( TMceNatStateTransitionEvent& /*aEvent*/ )
+	{
+	}	
+
+// -----------------------------------------------------------------------------
+// CMceNatStateInitializing::ExitL
+// When either EMceNatInitialized or EMceNatUpdated is received, enter state
+// KMceNatStateCreateOfferRequested, and wait there for the other event, before
+// entering KMceNatStateIdle.
+// -----------------------------------------------------------------------------
+//
+void CMceNatStateInitializing::ExitL( TMceNatStateTransitionEvent& aEvent )
+	{
+	MCESRV_DEBUG( "*** CMceNatStateInitializing::ExitL, Entry" );
+
+#if 0
+	TMceNatStateIndex nextState( KMceNatStateIdle );
+	
+	if ( aEvent.NatCode() == EMceNatUpdated )
+		{
+		// Media is now ready, but must wait for NAT plugin to get initialized.
+		nextState = KMceNatStateCreateOfferRequested;
+		}
+	aEvent.NatActions().StateChangedL( aEvent, nextState );
+
+#else
+
+	if ( ( CMceComSession::TType(aEvent.Session().Type()) == CMceComSession::EInSession ) 
+	       && ( &aEvent.Session().Request()) 
+	       && ( !MceSip::HasContent( aEvent.Session().Request() )))
+		{
+		aEvent.NatActions().StateChangedL( aEvent,
+									   KMceNatStateIdle );					
+		}
+		
+	else 
+		{
+		
+		aEvent.NatActions().StateChangedL( aEvent,
+							   KMceNatStateCreateOfferRequested );														   
+		}
+		
+#endif
+
+	MCESRV_DEBUG( "*** CMceNatStateInitializing::ExitL, Exit" );
+	}