S60 3rd Edition SDK for Symbian OS
Example Applications Guide

SIPExStateAcceptingSIP.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : SIPExStateAcceptingSIP.cpp
00004 *  Part of     : SIPExEngine
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2004-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 // INCLUDES
00017 #include    "SIPExStateAcceptingSIP.h"
00018 #include    "SIPExGameEngine.h"
00019 #include    "SIPExSIPEngine.h"
00020 
00021 // -----------------------------------------------------------------------------
00022 // TSIPExState::SocketState
00023 // Changes the active state according the new state of the Socket engine.
00024 // If the socket is connected the game is reseted first and the turn is given
00025 // to the remote peer.
00026 // If not connected, info UI and set Registered to a new active state.
00027 // -----------------------------------------------------------------------------
00028 //
00029 void TSIPExStateAcceptingSIP::SocketState( 
00030     CSIPExEngine* aContext, 
00031     TInt aNewState )
00032     {
00033     aContext->SetPeer( CSIPExEngine::EServer );
00034     switch (aNewState)
00035         {
00036         case CSIPExSocketEngine::ENotConnected:
00037             ChangeState( aContext, aContext->iStateRegistered );
00038             aContext->InfoL( KNotConnected() );
00039             break;
00040         case CSIPExSocketEngine::EConnected:
00041             aContext->ResetGame();
00042             ChangeState( aContext, aContext->iStateRemote );
00043             aContext->StatusInfoL( KWaitingRemote() );
00044             aContext->InfoL( KConnected() );
00045             break;
00046 
00047         case CSIPExSocketEngine::ETimedOut:
00048             ChangeState( aContext, aContext->iStateRegistered );
00049             aContext->InfoL( KTimedOut() );
00050             break;
00051         default:
00052             break;
00053         }
00054     }
00055 
00056 
00057 // -----------------------------------------------------------------------------
00058 // TSIPExStateAcceptingSIP::EndGameL
00059 // The SIP session will be ended.
00060 // -----------------------------------------------------------------------------
00061 //
00062 void TSIPExStateAcceptingSIP::EndGameL( CSIPExEngine* aContext )
00063     {
00064     aContext->SIPEngine()->EndSessionL();
00065     }
00066 
00067 // -----------------------------------------------------------------------------
00068 // TSIPExStateAcceptingSIP::InvitationCancelled
00069 // The invitation is cancelled. The active state is changed to the registered
00070 // and the socket engine is destroyed.
00071 // -----------------------------------------------------------------------------
00072 //
00073 void TSIPExStateAcceptingSIP::InvitationCancelled( CSIPExEngine* aContext)
00074     {
00075     ChangeState( aContext, aContext->iStateRegistered );
00076     TRAPD( ignore, aContext->SocketEngineL()->Stop() );
00077     aContext->DestroySocketEngine();
00078     }
00079     
00080 // End of file
00081 

© Nokia 2006

Back to top