realtimenetprots/sipfw/SampleApp/gameengine/Src/SIPExStateInviting.cpp
changeset 0 307788aac0a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/SampleApp/gameengine/Src/SIPExStateInviting.cpp	Tue Feb 02 01:03:15 2010 +0200
@@ -0,0 +1,80 @@
+
+// Copyright (c) 2004-2009 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:
+//
+
+
+
+// INCLUDES
+#include    "SIPExStateInviting.h"
+#include    "SIPExGameEngine.h"
+#include    "SIPExSIPEngine.h"
+
+// -----------------------------------------------------------------------------
+// TSIPExStateInviting::InviteAcceptedByRemote
+// Resets game, sets the peer to client and starts to connect to the remote 
+// peer. The active state is changed to the Connecting
+// -----------------------------------------------------------------------------
+//
+void TSIPExStateInviting::InviteAcceptedByRemote( 
+    CSIPExEngine* aContext, 
+    const TInetAddr& aIPAddress, 
+    const TUint32 aIapId )
+    {
+    Info( aContext, K200Received() ); 
+    Info( aContext, KSendingAck() ); 
+    ChangeState( aContext, aContext->iStateConnecting );
+    aContext->ResetGame();
+    aContext->SetPeer( CSIPExEngine::EClient );
+    aContext->SocketEngineL()->ConnectL( aIapId, aIPAddress );
+    aContext->InfoL( KConnecting() );
+    }
+
+// -----------------------------------------------------------------------------
+// TSIPExStateInviting::InviteDeclinedByRemote
+// The active state is changed to the Registered and the UI is notified.
+// -----------------------------------------------------------------------------
+//  
+void TSIPExStateInviting::InviteDeclinedByRemote( 
+    CSIPExEngine* aContext, 
+    const TInt aResponse )
+    {
+    ChangeState( aContext, aContext->iStateRegistered );
+    TRAPD( ignore, 
+        CombineAndShowInfoL( aContext, KInviteDeclinedByRemote(), aResponse ) );
+    StatusInfo( aContext, KGameOver() );
+    }
+
+// -----------------------------------------------------------------------------
+// TSIPExStateInviting::InvitationCancelled
+// Notifies the UI and changes the active state to the Registered.
+// -----------------------------------------------------------------------------
+//          
+void TSIPExStateInviting::InvitationCancelled( CSIPExEngine* aContext ) 
+    {
+    ChangeState( aContext, aContext->iStateRegistered );
+    Info( aContext, KInvitationCancelled() );
+    StatusInfo( aContext, KGameOver() );
+    }
+
+// -----------------------------------------------------------------------------
+// TSIPExStateInviting::EndGameL
+// The SIP session will be ended.
+// -----------------------------------------------------------------------------
+//
+void TSIPExStateInviting::EndGameL( CSIPExEngine* aContext )
+    {
+    aContext->SIPEngine()->CancelInviteL();
+    }
+// End of file