realtimenetprots/sipfw/SampleApp/gameengine/Src/SIPExStateConnecting.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 
       
     2 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include    "SIPExStateConnecting.h"
       
    21 #include    "SIPExGameEngine.h"
       
    22 #include    "SIPExSIPEngine.h"
       
    23 
       
    24 #include    <e32svr.h>
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TSIPExStateConnecting::SocketState
       
    28 // Changes the active state according the new state of the Socket engine.
       
    29 // If the socket is connected the game is reseted first and the turn is given
       
    30 // to the local user.
       
    31 // If not connected, info UI and set Registered to a new active state.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 void TSIPExStateConnecting::SocketState( 
       
    35     CSIPExEngine* aContext, 
       
    36     TInt aNewState )
       
    37     {
       
    38     switch (aNewState)
       
    39         {
       
    40         case CSIPExSocketEngine::ENotConnected:
       
    41             ChangeState( aContext, aContext->iStateRegistered );
       
    42             aContext->InfoL( KNotConnected() );
       
    43             break;
       
    44         case CSIPExSocketEngine::EConnected:
       
    45             if( aContext->Peer() == CSIPExEngine::EClient )
       
    46                 {
       
    47                 aContext->ResetGame();
       
    48                 ChangeState( aContext, aContext->iStateLocal );
       
    49                 aContext->StatusInfoL( KYourMove() );
       
    50                 aContext->InfoL( KConnected() );
       
    51 			    } 
       
    52             break;
       
    53         case CSIPExSocketEngine::ETimedOut:
       
    54             ChangeState( aContext, aContext->iStateRegistered );
       
    55             aContext->InfoL( KTimedOut() );
       
    56             break;
       
    57         default:
       
    58             break;
       
    59         }
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // TSIPExStateInviting::EndGameL
       
    64 // The SIP Session will be ended.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void TSIPExStateConnecting::EndGameL( CSIPExEngine* aContext )
       
    68     {
       
    69     aContext->SIPEngine()->EndSessionL();
       
    70     }
       
    71 
       
    72 
       
    73 // End of file