realtimenetprots/sipfw/SampleApp/gameengine/Src/SIPExStateInviting.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    "SIPExStateInviting.h"
       
    21 #include    "SIPExGameEngine.h"
       
    22 #include    "SIPExSIPEngine.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // TSIPExStateInviting::InviteAcceptedByRemote
       
    26 // Resets game, sets the peer to client and starts to connect to the remote 
       
    27 // peer. The active state is changed to the Connecting
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 void TSIPExStateInviting::InviteAcceptedByRemote( 
       
    31     CSIPExEngine* aContext, 
       
    32     const TInetAddr& aIPAddress, 
       
    33     const TUint32 aIapId )
       
    34     {
       
    35     Info( aContext, K200Received() ); 
       
    36     Info( aContext, KSendingAck() ); 
       
    37     ChangeState( aContext, aContext->iStateConnecting );
       
    38     aContext->ResetGame();
       
    39     aContext->SetPeer( CSIPExEngine::EClient );
       
    40     aContext->SocketEngineL()->ConnectL( aIapId, aIPAddress );
       
    41     aContext->InfoL( KConnecting() );
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // TSIPExStateInviting::InviteDeclinedByRemote
       
    46 // The active state is changed to the Registered and the UI is notified.
       
    47 // -----------------------------------------------------------------------------
       
    48 //  
       
    49 void TSIPExStateInviting::InviteDeclinedByRemote( 
       
    50     CSIPExEngine* aContext, 
       
    51     const TInt aResponse )
       
    52     {
       
    53     ChangeState( aContext, aContext->iStateRegistered );
       
    54     TRAPD( ignore, 
       
    55         CombineAndShowInfoL( aContext, KInviteDeclinedByRemote(), aResponse ) );
       
    56     StatusInfo( aContext, KGameOver() );
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // TSIPExStateInviting::InvitationCancelled
       
    61 // Notifies the UI and changes the active state to the Registered.
       
    62 // -----------------------------------------------------------------------------
       
    63 //          
       
    64 void TSIPExStateInviting::InvitationCancelled( CSIPExEngine* aContext ) 
       
    65     {
       
    66     ChangeState( aContext, aContext->iStateRegistered );
       
    67     Info( aContext, KInvitationCancelled() );
       
    68     StatusInfo( aContext, KGameOver() );
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // TSIPExStateInviting::EndGameL
       
    73 // The SIP session will be ended.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 void TSIPExStateInviting::EndGameL( CSIPExEngine* aContext )
       
    77     {
       
    78     aContext->SIPEngine()->CancelInviteL();
       
    79     }
       
    80 // End of file