S60 3rd Edition SDK for Symbian OS
Example Applications Guide

TSIPExStateRegistered Class Reference

#include <SIPExStateRegistered.h>

Inheritance diagram for TSIPExStateRegistered:

TSIPExState List of all members.

Public Member Functions

 TSIPExStateRegistered ()
virtual void InviteL (CSIPExEngine *aContext, const TDesC &aAddress)
virtual void SendInstantMsgL (CSIPExEngine *aContext, const TDesC &aAddress, const TDesC &aMsg)
virtual void SessionEnded (CSIPExEngine *aContext)
virtual void InviteReceived (CSIPExEngine *aContext, const TDesC8 &aFrom, const TUint32 aIapId)
virtual void DisableProfileL (CSIPExEngine *aContext)
virtual void SocketState (CSIPExEngine *aContext, TInt aNewState)

Public Attributes

TBool iEnded

Detailed Description

The state is valid when the SIP profile has enabled and the socket connection is not openned yet.

Definition at line 27 of file SIPExStateRegistered.h.


Constructor & Destructor Documentation

TSIPExStateRegistered::TSIPExStateRegistered (   )  [inline]
 

Constructor

Definition at line 35 of file SIPExStateRegistered.h.

00035 : iEnded( EFalse ) {}


Member Function Documentation

void TSIPExStateRegistered::InviteL (  CSIPExEngine *  aContext,
const TDesC &  aAddress
)  [virtual]
 

InviteL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 28 of file SIPExStateRegistered.cpp.

References TSIPExState::ChangeState(), CSIPExEngine::InfoL(), CSIPExEngine::iStateInviting, CSIPExSIPEngine::SendInviteL(), CSIPExEngine::SIPEngine(), and CSIPExEngine::StatusInfoL().

00031     {
00032     ChangeState( aContext, aContext->iStateInviting );
00033     
00034     HBufC8* address = HBufC8::NewLC( aAddress.Length() );
00035     address->Des().Copy( aAddress );
00036     aContext->SIPEngine()->SendInviteL( *address );
00037     aContext->InfoL( KInviting() );
00038     aContext->InfoL( aAddress );
00039     aContext->StatusInfoL( KGameStarting() );
00040     CleanupStack::PopAndDestroy( address );
00041     }

void TSIPExStateRegistered::SendInstantMsgL (  CSIPExEngine *  aContext,
const TDesC &  aAddress,
const TDesC &  aMsg
)  [virtual]
 

SendInstantMsgL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 48 of file SIPExStateRegistered.cpp.

References CSIPExSIPEngine::CreateIML(), and CSIPExEngine::SIPEngine().

00050     {
00051     HBufC8* addr = HBufC8::NewLC( aAddress.Length() );
00052     addr->Des().Copy( aAddress );
00053 
00054     HBufC8* msg = HBufC8::NewLC( aMsg.Length() );
00055     msg->Des().Copy( aMsg );
00056 
00057     aContext->SIPEngine()->CreateIML( *msg, *addr );
00058 
00059     CleanupStack::PopAndDestroy( msg );
00060     CleanupStack::PopAndDestroy( addr );
00061     }

void TSIPExStateRegistered::SessionEnded (  CSIPExEngine *  aContext  )  [virtual]
 

SessionEnded From TSIPExState

Reimplemented from TSIPExState.

Definition at line 68 of file SIPExStateRegistered.cpp.

References CSIPExEngine::DestroySocketEngine(), iEnded, TSIPExState::Info(), CSIPExEngine::SocketEngineL(), TSIPExState::StatusInfo(), and CSIPExSocketEngine::Stop().

00069     {
00070     // Keep track whether session ended while accept dialog was shown to user.
00071     iEnded = ETrue;
00072 
00073     Info( aContext, KSessionEnded() );
00074     StatusInfo( aContext, KGameOver() );
00075     TRAPD( ignore, aContext->SocketEngineL()->Stop() );
00076     aContext->DestroySocketEngine();
00077     }

void TSIPExStateRegistered::InviteReceived (  CSIPExEngine *  aContext,
const TDesC8 &  aFrom,
const TUint32  aIapId
)  [virtual]
 

InviteReceived From TSIPExState

Reimplemented from TSIPExState.

Definition at line 86 of file SIPExStateRegistered.cpp.

References CSIPExEngine::AcceptInvitationL(), TSIPExState::ChangeState(), iEnded, TSIPExState::Info(), CSIPExEngine::iStateAcceptingSIP, CSIPExEngine::ResetGame(), CSIPExEngine::SetPeer(), CSIPExEngine::SocketEngineL(), CSIPExSocketEngine::StartListeningL(), and TSIPExState::StatusInfo().

00090     {
00091     iEnded = EFalse;
00092     
00093     TBool retVal( EFalse );
00094     TRAPD( ignore, retVal = aContext->AcceptInvitationL( aFrom ) );
00095     if ( iEnded )
00096         {
00097         return;
00098         }
00099     if( retVal )
00100         {
00101         StatusInfo( aContext, KGameStarting() );
00102         ChangeState( aContext, aContext->iStateAcceptingSIP );
00103         aContext->ResetGame();
00104         aContext->SetPeer( CSIPExEngine::EServer );
00105         Info( aContext, KListening() );
00106         TInetAddr addr;
00107         TRAP( ignore, addr = 
00108                         aContext->SocketEngineL()->StartListeningL( aIapId ) );
00109         Info( aContext, KAccepting() );
00110         TRAP( ignore, aContext->SIPEngine()->AcceptInviteL( addr ) );
00111         Info( aContext, KWaitingRemoteConn() );
00112         }
00113     else 
00114         {
00115         TRAP( ignore, aContext->SIPEngine()->DeclineInviteL() );
00116         Info( aContext, KInviteDeclined() );
00117         }
00118     }

void TSIPExStateRegistered::DisableProfileL (  CSIPExEngine *  aContext  )  [virtual]
 

DisableProfile From TSIPExState

Reimplemented from TSIPExState.

Definition at line 125 of file SIPExStateRegistered.cpp.

References TSIPExState::ChangeState(), CSIPExSIPEngine::DisableProfileL(), CSIPExEngine::InfoL(), CSIPExEngine::iStateIdle, and CSIPExEngine::SIPEngine().

00126     {
00127     ChangeState( aContext, aContext->iStateIdle );
00128     aContext->SIPEngine()->DisableProfileL();
00129     aContext->InfoL( KProfileDisabled() );
00130     }

void TSIPExStateRegistered::SocketState (  CSIPExEngine *  aContext,
TInt  aNewState
)  [virtual]
 

SocketState From TSIPExState

Reimplemented from TSIPExState.

Definition at line 137 of file SIPExStateRegistered.cpp.

References TSIPExState::Info(), and TSIPExState::StatusInfo().

00138     {
00139     if( aNewState == CSIPExSocketEngine::ENotConnected )
00140         {
00141         Info( aContext, KConnectionDropped() );
00142         StatusInfo( aContext, KGameOver() );
00143         }
00144     }


© Nokia 2006

Back to top