S60 3rd Edition SDK for Symbian OS
Example Applications Guide

TSIPExStateLocal Class Reference

#include <SIPExStateLocal.h>

Inheritance diagram for TSIPExStateLocal:

TSIPExState List of all members.

Public Member Functions

virtual void CursorPressed (CSIPExEngine *aContext)
virtual void CursorRight (CSIPExEngine *aContext)
virtual void CursorLeft (CSIPExEngine *aContext)
virtual void MoveCursorL (CSIPExEngine *aContext, const TInt aNewPosition)
virtual TBool DrawCursor ()
virtual void SendInstantMsgL (CSIPExEngine *aContext, const TDesC &aAddress, const TDesC &aMsg)
virtual void InviteL (CSIPExEngine *aContext, const TDesC &aAddress)
virtual void DisableProfileL (CSIPExEngine *aContext)
virtual void EndGameL (CSIPExEngine *aContext)

Detailed Description

The state is valid when waiting the user move.

Definition at line 26 of file SIPExStateLocal.h.


Member Function Documentation

void TSIPExStateLocal::CursorPressed (  CSIPExEngine *  aContext  )  [virtual]
 

CursorPressed From TSIPExState

Reimplemented from TSIPExState.

Definition at line 29 of file SIPExStateLocal.cpp.

References CSIPExEngine::CalculatePos(), TSIPExState::ChangeState(), CSIPExEngine::Cursor(), EndGameL(), CSIPExEngine::IncreaseMovesBy(), CSIPExEngine::iStateRemote, CSIPExEngine::IsWin(), CSIPExEngine::Moves(), CSIPExEngine::SendMessage(), CSIPExEngine::SetBoard(), and CSIPExEngine::StatusInfoL().

00030     {
00031     TInt y = aContext->CalculatePos();
00032         if ( y != -1 ) 
00033         {
00034         aContext->SetBoard( aContext->Cursor(), y, 1 );
00035                 aContext->IncreaseMovesBy( 1 );
00036                 aContext->SendMessage( aContext->Cursor(), y );
00037                 TInt ret = aContext->IsWin( aContext->Cursor(),y ); 
00038                 
00039         if (ret == 1) 
00040             {
00041             ChangeState( aContext, aContext->iStateRemote );
00042             aContext->StatusInfoL( KYouWin() );
00043             EndGameL( aContext );
00044                         }
00045         else  if ( aContext->Moves() == KMaxMoves ) 
00046             {
00047             ChangeState( aContext, aContext->iStateRemote );
00048                         aContext->StatusInfoL( KGameTie() );
00049             EndGameL( aContext );
00050                     }         
00051         else 
00052             {
00053             ChangeState( aContext, aContext->iStateRemote );
00054             aContext->StatusInfoL( KWaitingRemote() );
00055                         }
00056                 }
00057     }

void TSIPExStateLocal::CursorRight (  CSIPExEngine *  aContext  )  [virtual]
 

CursorRight From TSIPExState

Reimplemented from TSIPExState.

Definition at line 64 of file SIPExStateLocal.cpp.

References CSIPExEngine::Cursor(), and CSIPExEngine::SetCursor().

00065     {
00066     aContext->SetCursor( aContext->Cursor() + 1 );
00067         if ( aContext->Cursor() > KBoxCountX - 1 )
00068         {
00069                 aContext->SetCursor( 0 );
00070         }
00071     }

void TSIPExStateLocal::CursorLeft (  CSIPExEngine *  aContext  )  [virtual]
 

CursorLeft From TSIPExState

Reimplemented from TSIPExState.

Definition at line 78 of file SIPExStateLocal.cpp.

References CSIPExEngine::Cursor(), and CSIPExEngine::SetCursor().

00079     {
00080         aContext->SetCursor( aContext->Cursor() - 1 );
00081         if ( aContext->Cursor() < 0 )
00082         {
00083                 aContext->SetCursor( KBoxCountX - 1 );
00084         }
00085     }

void TSIPExStateLocal::MoveCursorL (  CSIPExEngine *  aContext,
const TInt  aNewPosition
)  [virtual]
 

MoveCursorL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 156 of file SIPExStateLocal.cpp.

References CSIPExEngine::SetCursor().

00159     {
00160     aContext->SetCursor( aNewPosition );
00161     }

TBool TSIPExStateLocal::DrawCursor (   )  [virtual]
 

DrawCursor From TSIPExState

Reimplemented from TSIPExState.

Definition at line 93 of file SIPExStateLocal.cpp.

00094     {
00095     return ETrue;
00096     }

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

SendInstantMsgL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 103 of file SIPExStateLocal.cpp.

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

00105     {
00106     HBufC8* addr = HBufC8::NewLC( aAddress.Length() );
00107     addr->Des().Copy( aAddress );
00108 
00109     HBufC8* msg = HBufC8::NewLC( aMsg.Length() );
00110     msg->Des().Copy( aMsg );
00111 
00112     aContext->SIPEngine()->CreateIML( *msg, *addr );
00113 
00114     CleanupStack::PopAndDestroy( msg );
00115     CleanupStack::PopAndDestroy( addr );
00116     }

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

InviteL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 123 of file SIPExStateLocal.cpp.

References CSIPExEngine::InfoL().

00126     {
00127     aContext->InfoL( KGameAlreadyRunning() );
00128     }

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

DisableProfile From TSIPExState

Reimplemented from TSIPExState.

Definition at line 135 of file SIPExStateLocal.cpp.

References CSIPExEngine::InfoL().

00136     {
00137     aContext->InfoL( KGameAlreadyRunning() );
00138     }

void TSIPExStateLocal::EndGameL (  CSIPExEngine *  aContext  )  [virtual]
 

EndGameL From TSIPExState

Reimplemented from TSIPExState.

Definition at line 146 of file SIPExStateLocal.cpp.

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

00147     {
00148     aContext->SIPEngine()->EndSessionL();
00149     }


© Nokia 2006

Back to top