S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExEngine Class Reference

#include <SIPExGameEngine.h>

Inheritance diagram for CSIPExEngine:

MSIPExSIPEngineObserver MSIPExSocketEngineObserver List of all members.

Public Types

enum  TPeer { EUnknown, EClient, EServer }
enum  TEngineState { EIdle, EEnabled, EActivating, EActive }

Public Member Functions

IMPORT_C ~CSIPExEngine ()
IMPORT_C void SendInstantMsgL (const TDesC &aAddress, const TDesC &aMsg)
IMPORT_C void InviteL (const TDesC &aAddress)
IMPORT_C void EnableProfileL ()
IMPORT_C void DisableProfileL ()
IMPORT_C void EndGameL ()
IMPORT_C TBool DrawCursor ()
IMPORT_C TBool DrawBoard ()
IMPORT_C void CursorLeft ()
IMPORT_C void CursorRight ()
IMPORT_C void CursorPressed ()
IMPORT_C void MoveCursorL (const TInt aNewCursorPosition)
IMPORT_C TInt BoardValue (TInt aX, TInt aY)
IMPORT_C TInt Cursor ()
IMPORT_C void SetViewNotifier (MSIPExStateViewNotifier &aNotifier)
void SocketState (TInt aNewState)
void SocketData (TDesC8 &aData)

Static Public Member Functions

static IMPORT_C CSIPExEngine * NewL (MSIPExGameObserver &aGameObserver)
static IMPORT_C CSIPExEngine * NewLC (MSIPExGameObserver &aGameObserver)

Private Member Functions

void InviteReceived (const TDesC8 &aFrom, const TUint32 aIapId)
void InviteReceivedByRemote (const TInt aResponse)
void InviteDeclinedByRemote (const TInt aResponse)
void InviteAcceptedByRemote (const TInetAddr &aIPAddress, const TUint32 aIapId)
void InviteAcceptedByUs ()
void InvitationCancelled ()
void EngineError (TInt aError)
void CancelFailed ()
void SessionEnded ()
void ConnectionLost ()
void ProfileEnabled (TUint32 aSIPProfileId)
void ProfileError (TInt aError)
void IMReceived (const TDesC8 &aFrom, const TDesC8 &aMessage)
void WriteLog (const TDesC8 &aLog)
void ResetGame ()
void DestroySocketEngine ()
void ChangeState (TSIPExState &aNewState)
void SendMessage (const TInt aX, const TInt aY)
void StatusInfoL (const TDesC &aTxt)
void InfoL (const TDesC &aInfoTxt)
TInt CalculatePos ()
TInt IsWin (const TInt aX, const TInt aY)
TInt Moves ()
void SetBoard (const TInt aX, const TInt aY, const TInt aValue)
void IncreaseMovesBy (const TInt aAmount)
void SetCursor (const TInt aNewValue)
TPeer Peer ()
void SetPeer (TPeer aPeer)
void SetRemote (const TInt aX, const TInt aY)
TBool AcceptInvitationL (const TDesC8 &aFrom)
CSIPExSIPEngine * SIPEngine ()
CSIPExSocketEngine * SocketEngineL ()
MSIPExGameObserver & GameObserver ()
 CSIPExEngine (MSIPExGameObserver &aGameObserver)
void ConstructL ()

Private Attributes

TSIPExState * iStateIdle
TSIPExState * iStateRegistering
TSIPExState * iStateRegistered
TSIPExState * iStateInviting
TSIPExState * iStateConnecting
TSIPExState * iStateLocal
TSIPExState * iStateRemote
TSIPExState * iStateAcceptingSIP
MSIPExStateViewNotifier * iNotifier
CSIPExSocketEngine * iSocketEngine
CSIPExSIPEngine * iSIPEngine
MSIPExGameObserver & iGameObserver
TInt iMoves
TInt iBoard [KBoxCountX][KBoxCountY]
TInt iCursor
TPeer iPeer
TSIPExState * iActiveState

Friends

class TSIPExState
class TSIPExStateAcceptingSIP
class TSIPExStateConnecting
class TSIPExStateIdle
class TSIPExStateInviting
class TSIPExStateLocal
class TSIPExStateRegistered
class TSIPExStateRegistering
class TSIPExStateRemote

Detailed Description

The engine class for SIP Example application. the networking and SIP messaging.

Definition at line 46 of file SIPExGameEngine.h.


Member Enumeration Documentation

enum CSIPExEngine::TPeer
 

Enumerations for the application role. The inviting peer acts as a client and invited peer as a server.

Definition at line 80 of file SIPExGameEngine.h.

00081             {
00082             EUnknown,
00083             EClient,
00084             EServer
00085             };

enum CSIPExEngine::TEngineState
 

Game engine states for UI.

Definition at line 90 of file SIPExGameEngine.h.

00091             {
00092             EIdle,
00093             EEnabled,
00094             EActivating,
00095             EActive
00096             };


Constructor & Destructor Documentation

EXPORT_C CSIPExEngine::~CSIPExEngine (   ) 
 

Destructor.

Definition at line 82 of file SIPExGameEngine.cpp.

References DestroySocketEngine(), iSIPEngine, iStateAcceptingSIP, iStateConnecting, iStateIdle, iStateInviting, iStateLocal, iStateRegistered, iStateRegistering, and iStateRemote.

00083     {
00084     DestroySocketEngine();
00085     delete iSIPEngine;
00086 
00087     // Delete all state objects
00088     delete iStateIdle;
00089     delete iStateRegistering;
00090     delete iStateRegistered;
00091     delete iStateInviting;
00092     delete iStateConnecting;
00093     delete iStateLocal;
00094     delete iStateRemote;
00095     delete iStateAcceptingSIP;
00096     }

CSIPExEngine::CSIPExEngine (  MSIPExGameObserver &  aGameObserver  )  [private]
 

Constructor

Parameters:
aGameObserver The observer reference.

Definition at line 72 of file SIPExGameEngine.cpp.

00073 : iGameObserver( aGameObserver )
00074     {
00075     }


Member Function Documentation

EXPORT_C CSIPExEngine * CSIPExEngine::NewL (  MSIPExGameObserver &  aGameObserver  )  [static]
 

Create new instance of GameEngine.

Parameters:
aGameObserver Reference to observing class.
Returns:
Pointer to new CSIPExEngine instance.

Definition at line 47 of file SIPExGameEngine.cpp.

References NewLC().

00048     {
00049     CSIPExEngine* self = NewLC( aGameObserver );
00050     CleanupStack::Pop(self);
00051     return self;
00052     }

EXPORT_C CSIPExEngine * CSIPExEngine::NewLC (  MSIPExGameObserver &  aGameObserver  )  [static]
 

Create new instance of GameEngine. The GameEngine pointer is left to the CleanupStack returned.

Parameters:
aGameObserver Reference to observing class.
Returns:
Pointer to new CSIPExEngine instance.

Definition at line 59 of file SIPExGameEngine.cpp.

References CSIPExEngine().

00060     {
00061     CSIPExEngine* self = new (ELeave) CSIPExEngine( aGameObserver );
00062     CleanupStack::PushL(self);
00063     self->ConstructL();
00064     return self;
00065     }

EXPORT_C void CSIPExEngine::SendInstantMsgL (  const TDesC &  aAddress,
const TDesC &  aMsg
) 
 

The instant message is send to the remote user. Redirects the call to the active State object.

Parameters:
aAddress The address of the recipient.
aMsg The message.

Definition at line 383 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::SendInstantMsgL().

00386     {
00387     iActiveState->SendInstantMsgL( this, aAddress, aMsg );
00388     }

EXPORT_C void CSIPExEngine::InviteL (  const TDesC &  aAddress  ) 
 

Player invites the remote peer to the game. Redirectes the call to the active State object.

Parameters:
aAddress The address of the invited peer.

Definition at line 353 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteL().

00354     {
00355     iActiveState->InviteL( this, aAddress );
00356     }

EXPORT_C void CSIPExEngine::EnableProfileL (   ) 
 

The SIP profile is enabled. Redirectes the call to the active State object.

Definition at line 363 of file SIPExGameEngine.cpp.

References TSIPExState::EnableProfileL(), and iActiveState.

00364     {
00365     iActiveState->EnableProfileL( this );
00366     }

EXPORT_C void CSIPExEngine::DisableProfileL (   ) 
 

The SIP profile is disabled. Redirectes the call to the active State object.

Definition at line 373 of file SIPExGameEngine.cpp.

References TSIPExState::DisableProfileL(), and iActiveState.

00374     {
00375     iActiveState->DisableProfileL( this );
00376     }

EXPORT_C void CSIPExEngine::EndGameL (   ) 
 

The user ends the game. Redirectes the call to the active State object.

Definition at line 395 of file SIPExGameEngine.cpp.

References TSIPExState::EndGameL(), and iActiveState.

00396     {
00397     iActiveState->EndGameL( this );
00398     }

EXPORT_C TBool CSIPExEngine::DrawCursor (   ) 
 

Resolves whether we should draw cursor or not.

Returns:
Returns ETrue if the game is in state where we should draw cursor (if it is our turn). Otherwise EFalse is returned.

Definition at line 405 of file SIPExGameEngine.cpp.

References TSIPExState::DrawCursor(), and iActiveState.

00406     {
00407     return iActiveState->DrawCursor();
00408     }

EXPORT_C TBool CSIPExEngine::DrawBoard (   ) 
 

Resolves whether we should draw board or not.

Returns:
Returns ETrue if the game is in state where we should draw board (if profile is enabled). Otherwise EFalse is returned.

Definition at line 415 of file SIPExGameEngine.cpp.

References TSIPExState::DrawBoard(), and iActiveState.

00416     {
00417     return iActiveState->DrawBoard();
00418     }

EXPORT_C void CSIPExEngine::CursorLeft (   ) 
 

Updates the game state. User has pressed left key.

Definition at line 425 of file SIPExGameEngine.cpp.

References TSIPExState::CursorLeft(), and iActiveState.

00426     {
00427     iActiveState->CursorLeft( this );
00428     }

EXPORT_C void CSIPExEngine::CursorRight (   ) 
 

Updates the game state. User has pressed right key.

Definition at line 435 of file SIPExGameEngine.cpp.

References TSIPExState::CursorRight(), and iActiveState.

00436     {
00437     iActiveState->CursorRight( this );
00438     }

EXPORT_C void CSIPExEngine::CursorPressed (   ) 
 

Updates the game state. User has pressed enter key.

Definition at line 445 of file SIPExGameEngine.cpp.

References TSIPExState::CursorPressed(), and iActiveState.

00446     {
00447     iActiveState->CursorPressed( this );
00448     }

EXPORT_C void CSIPExEngine::MoveCursorL (  const TInt  aNewCursorPosition  ) 
 

Updatas the game state. User moves the cursor with pointer.

Parameters:
aNewCursorPosition A new cursor column position.

Definition at line 455 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::MoveCursorL().

00456     {
00457     iActiveState->MoveCursorL( this, aNewValue );
00458     }

EXPORT_C TInt CSIPExEngine::BoardValue (  TInt  aX,
TInt  aY
) 
 

Returns value in specified place in the board.

Parameters:
aX The place's x coordinate.
aY The place's y coordinate.
Returns:
The value in specified place.

Definition at line 188 of file SIPExGameEngine.cpp.

References iBoard.

00189     {
00190     __ASSERT_DEBUG( aX < KBoxCountX && aY < KBoxCountY, 
00191                     Panic( EBoardValueOOR ) );
00192     return iBoard[ aX ][ aY ];
00193     }

EXPORT_C TInt CSIPExEngine::Cursor (   ) 
 

Returns the cursor position.

Returns:
The cursor's position

Definition at line 200 of file SIPExGameEngine.cpp.

References iCursor.

00201     {
00202     return iCursor;
00203     }

EXPORT_C void CSIPExEngine::SetViewNotifier (  MSIPExStateViewNotifier &  aNotifier  ) 
 

Sets the iNotifier.

Parameters:
aNotifier Reference to the view notifier.

Definition at line 136 of file SIPExGameEngine.cpp.

References iNotifier.

00137     {
00138     iNotifier = &aNotifier;
00139     }

void CSIPExEngine::SocketState (  TInt  aNewState  )  [virtual]
 

Callback from socket observer. Called when the state changes in the socket engine.

Parameters:
aNewState A new state of the socket engine.

Implements MSIPExSocketEngineObserver.

Definition at line 534 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::SocketState().

00535     {
00536     iActiveState->SocketState( this, aNewState );
00537     }

void CSIPExEngine::SocketData (  TDesC8 &  aData  )  [virtual]
 

Callback from socket observer. Called when the data is received from the socket.

Parameters:
aData The data received from the socket.

Implements MSIPExSocketEngineObserver.

Definition at line 545 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::SocketData().

00546     {
00547     iActiveState->SocketData( this, aData );
00548     }

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

InviteReceived Called when an INVITE is received by the SIP Client.

Parameters:
aFrom The sender of the INVITE
aIapId The access point id of used conection

Implements MSIPExSIPEngineObserver.

Definition at line 559 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteReceived().

00560     {
00561     iActiveState->InviteReceived( this, aFrom, aIapId );
00562     }

void CSIPExEngine::InviteReceivedByRemote (  const TInt  aResponse  )  [private, virtual]
 

InviteReceivedByRemote Called when a provisional response (1xx, not 100 (Trying)) is received after sending INVITE.

Implements MSIPExSIPEngineObserver.

Definition at line 601 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteReceivedByRemote().

00602     {
00603     iActiveState->InviteReceivedByRemote( this, aResponse );
00604     }

void CSIPExEngine::InviteDeclinedByRemote (  const TInt  aResponse  )  [private, virtual]
 

InviteDeclinedByRemote Called when a 4xx, 5xx, or 6xx response is received after sending INVITE. As the session isn't established, the engine should be deleted.

Parameters:
aResponse Value of the received response.

Implements MSIPExSIPEngineObserver.

Definition at line 591 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteDeclinedByRemote().

00592     {
00593     iActiveState->InviteDeclinedByRemote( this, aResponse );
00594     }

void CSIPExEngine::InviteAcceptedByRemote (  const TInetAddr &  aIPAddress,
const TUint32  aIapId
)  [private, virtual]
 

InviteAcceptedByRemote Called when the response 200 (OK) is received after sending INVITE.

Parameters:
aIPAddr The IP Address of the remote party.
aIapId iap id used.

Implements MSIPExSIPEngineObserver.

Definition at line 569 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteAcceptedByRemote().

00572     {
00573     iActiveState->InviteAcceptedByRemote( this, aIPAddress, aIapId );
00574     }

void CSIPExEngine::InviteAcceptedByUs (   )  [private, virtual]
 

InviteAcceptedByUs Called when the response ACK is received after responding with 200 (OK) to an invitation.

Implements MSIPExSIPEngineObserver.

Definition at line 581 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InviteAcceptedByUs().

00582     {
00583     iActiveState->InviteAcceptedByUs( this );
00584     }

void CSIPExEngine::InvitationCancelled (   )  [private, virtual]
 

InvitationCancelled Called when an INVITE has been successfully cancelled.

Implements MSIPExSIPEngineObserver.

Definition at line 621 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::InvitationCancelled().

00622     {
00623     iActiveState->InvitationCancelled( this );
00624     }

void CSIPExEngine::EngineError (  TInt  aError  )  [private, virtual]
 

EngineError Called when an error occurs in the SIP Example SIP Engine.

Parameters:
aError Error number

Implements MSIPExSIPEngineObserver.

Definition at line 611 of file SIPExGameEngine.cpp.

References TSIPExState::EngineError(), and iActiveState.

00612     {
00613     iActiveState->EngineError( this, aError );
00614     }

void CSIPExEngine::CancelFailed (   )  [private, virtual]
 

CancelFailed Called when the cancellation of an INVITE fails.

Implements MSIPExSIPEngineObserver.

Definition at line 631 of file SIPExGameEngine.cpp.

References TSIPExState::CancelFailed(), and iActiveState.

00632     {
00633     iActiveState->CancelFailed( this );
00634     }

void CSIPExEngine::SessionEnded (   )  [private, virtual]
 

SessionEnded Called when the session has been closed, ie. when the the response 200 (OK) is received after sending BYE, or after 200 (OK) has been sent after receiving BYE. Or we have declined a received INVITE. The observer should delete the engine.

Implements MSIPExSIPEngineObserver.

Definition at line 641 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::SessionEnded().

00642     {
00643     iActiveState->SessionEnded( this );
00644     }

void CSIPExEngine::ConnectionLost (   )  [private, virtual]
 

ConnectionLost Called when the connection is lost because of an error. The observer should delete the engine.

Implements MSIPExSIPEngineObserver.

Definition at line 651 of file SIPExGameEngine.cpp.

References TSIPExState::ConnectionLost(), and iActiveState.

00652     {
00653     iActiveState->ConnectionLost( this );
00654     }

void CSIPExEngine::ProfileEnabled (  TUint32  aSIPProfileId  )  [private, virtual]
 

ProfileEnabled Called when the EnableProfile method has completed successfully.

Parameters:
aSIPProfileId ID of the enabled profile

Implements MSIPExSIPEngineObserver.

Definition at line 661 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::ProfileEnabled().

00662     {
00663     iActiveState->ProfileEnabled( this, aSIPProfileId );
00664     }

void CSIPExEngine::ProfileError (  TInt  aError  )  [private, virtual]
 

ProfileError An error has occurred during a profile operation

Parameters:
aError Error number

Implements MSIPExSIPEngineObserver.

Definition at line 671 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::ProfileError().

00672     {
00673     iActiveState->ProfileError( this, aError );
00674     }

void CSIPExEngine::IMReceived (  const TDesC8 &  aFrom,
const TDesC8 &  aMessage
)  [private, virtual]
 

IMReceived Called when an Instant Message is received.

Parameters:
aFrom The sender of the IM.
aMessage The message received.

Implements MSIPExSIPEngineObserver.

Definition at line 681 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::IMReceived().

00683     {
00684     iActiveState->IMReceived( this, aFrom, aMessage );
00685     }

void CSIPExEngine::WriteLog (  const TDesC8 &  aLog  )  [private, virtual]
 

WriteLog

Parameters:
aLog,log entry.

Implements MSIPExSIPEngineObserver.

Definition at line 692 of file SIPExGameEngine.cpp.

References iNotifier, and MSIPExStateViewNotifier::ShowInfoL().

00693     {
00694     if( iNotifier )
00695         {
00696         TRAPD( ignore, iNotifier->ShowInfoL( aLog ) );
00697         }
00698     }

void CSIPExEngine::ResetGame (   )  [private]
 

Initilizes the game state.

Definition at line 146 of file SIPExGameEngine.cpp.

References iBoard, iCursor, iMoves, and iPeer.

00147     {
00148     for ( TInt i=0 ; i < KBoxCountX; i++ ) 
00149         {
00150                 for ( TInt j=0 ; j < KBoxCountY; j++ ) 
00151             {
00152                         iBoard[i][j] = -1;
00153             }
00154         }
00155 
00156         iCursor = 0;
00157     iMoves = 0;
00158     iPeer = EUnknown;
00159     }

void CSIPExEngine::DestroySocketEngine (   )  [private]
 

Destroys the iSocketEngine.

Definition at line 303 of file SIPExGameEngine.cpp.

References iSocketEngine.

00304     {
00305     delete iSocketEngine;
00306     iSocketEngine = NULL;
00307     }

void CSIPExEngine::ChangeState (  TSIPExState &  aNewState  )  [private]
 

Changes the active state.

Parameters:
aNewState A reference the to new active state.

Definition at line 220 of file SIPExGameEngine.cpp.

References MSIPExGameObserver::GameStateChanged(), iActiveState, iGameObserver, iStateAcceptingSIP, iStateConnecting, iStateIdle, iStateInviting, iStateLocal, iStateRegistered, iStateRegistering, and iStateRemote.

00221     {
00222     iActiveState = &aNewState;
00223 
00224     TEngineState state( EIdle );
00225     if( iActiveState == iStateIdle || iActiveState == iStateRegistering )
00226         {
00227         state = EIdle;
00228         }
00229     else if( iActiveState == iStateRegistered )
00230         {
00231         state = EEnabled;
00232         }
00233     else if ( iActiveState == iStateInviting ||
00234               iActiveState == iStateAcceptingSIP ||
00235               iActiveState == iStateConnecting )
00236         {
00237         state = EActivating;
00238         }
00239     else if( iActiveState == iStateLocal || iActiveState == iStateRemote )      
00240         {
00241         state = EActive;
00242         }
00243     else { /*Nothing to do*/ }
00244 
00245     iGameObserver.GameStateChanged( state );
00246     }

void CSIPExEngine::SendMessage (  const TInt  aX,
const TInt  aY
)  [private]
 

Send the move to the remote peer.

Parameters:
aX The x coordinate of the move.
aY The y coordinate of the move.

Definition at line 253 of file SIPExGameEngine.cpp.

References iSocketEngine, and CSIPExSocketEngine::Write().

00254     {
00255     __ASSERT_DEBUG( aX < KBoxCountX && aY < KBoxCountY, 
00256                     Panic( EBoardValueOOR ) );
00257 
00258     TBuf8<8> msg;
00259     msg.Format( KMoveFormatStr(), aX, aY );
00260 
00261     iSocketEngine->Write( msg );
00262     }

void CSIPExEngine::StatusInfoL (  const TDesC &  aTxt  )  [private]
 

Shows the text in the status info area. The call is redirected to the view notifier.

Parameters:
aTxt The text shown in the status info area.

Definition at line 281 of file SIPExGameEngine.cpp.

References iNotifier, and MSIPExStateViewNotifier::ShowStatusInfoL().

00282     {
00283     __ASSERT_DEBUG( iNotifier, Panic( ENoGameViewNotifier ) );
00284 
00285     iNotifier->ShowStatusInfoL( aTxt );
00286     }

void CSIPExEngine::InfoL (  const TDesC &  aInfoTxt  )  [private]
 

Shows the text in the info area. The call is redirected to the view notifier.

Parameters:
aTxt The text shown in the info area.

Definition at line 269 of file SIPExGameEngine.cpp.

References iNotifier, and MSIPExStateViewNotifier::ShowInfoL().

00270     {
00271     __ASSERT_DEBUG( iNotifier, Panic( ENoGameViewNotifier ) );
00272 
00273     iNotifier->ShowInfoL( aInfoTxt );
00274     }

TInt CSIPExEngine::CalculatePos (   )  [private]
 

Calculates the next free place in cursor's column.

Returns:
The next free position on the board.

Definition at line 465 of file SIPExGameEngine.cpp.

References TSIPExState::CalculatePos(), and iActiveState.

00466     {
00467     return iActiveState->CalculatePos( this );
00468     }

TInt CSIPExEngine::IsWin (  const TInt  aX,
const TInt  aY
)  [private]
 

Checks if the move is win move.

Parameters:
aX The x coordinate of the move.
aY The y coordinate of the move.
Returns:
1 if you won, 2 if the remote player has won, -1 if not win move.

Definition at line 475 of file SIPExGameEngine.cpp.

References iActiveState, and TSIPExState::IsWin().

00476     {
00477     return iActiveState->IsWin( this, aX, aY );
00478     }

TInt CSIPExEngine::Moves (   )  [private]
 

Returns the count of moves in this game.

Returns:
The count of moves.

Definition at line 485 of file SIPExGameEngine.cpp.

References iMoves.

00486     {
00487     return iMoves;
00488     }

void CSIPExEngine::SetBoard (  const TInt  aX,
const TInt  aY,
const TInt  aValue
)  [private]
 

Sets the specified value in to the specified place in the board.

Parameters:
aX The x coordinate value.
aY The y coordinate value.
aValue The value to be set to the (x, y) position.

Definition at line 166 of file SIPExGameEngine.cpp.

References iBoard.

00167     {
00168     __ASSERT_DEBUG( aX < KBoxCountX && aY < KBoxCountY, 
00169                     Panic( EBoardValueOOR ) );
00170     iBoard[ aX ][ aY ] = aValue;
00171     }

void CSIPExEngine::IncreaseMovesBy (  const TInt  aAmount  )  [private]
 

Increases the moves value by specified amount.

Parameters:
aAmount The amount of the increased moves.

Definition at line 178 of file SIPExGameEngine.cpp.

References iMoves.

00179     {
00180     iMoves += aAmount;
00181     }

void CSIPExEngine::SetCursor (  const TInt  aNewValue  )  [private]
 

Set cursor the specified position.

Parameters:
aNewValue The new position value for the cursor.

Definition at line 210 of file SIPExGameEngine.cpp.

References iCursor.

00211     {
00212     iCursor = aNewValue;
00213     }

CSIPExEngine::TPeer CSIPExEngine::Peer (   )  [private]
 

Returns the peer value.

Returns:
The iPeer value.

Definition at line 495 of file SIPExGameEngine.cpp.

References iPeer.

00496     {
00497     return iPeer;
00498     }

void CSIPExEngine::SetPeer (  TPeer  aPeer  )  [private]
 

Sets the iPeer's value

Parameters:
aPeer A new value for the iPeer.

Definition at line 505 of file SIPExGameEngine.cpp.

References iPeer.

00506     {
00507     iPeer = aPeer;
00508     }

void CSIPExEngine::SetRemote (  const TInt  aX,
const TInt  aY
)  [private]
 

Sets remote peer's move to the board.

Parameters:
aX The x coordinate value.
aY The y coordinate value.

Definition at line 293 of file SIPExGameEngine.cpp.

References SetBoard().

00294     {
00295     SetBoard( aX, aY, 2 );
00296     }

TBool CSIPExEngine::AcceptInvitationL (  const TDesC8 &  aFrom  )  [private]
 

The acceptance is asked from the user Redirectes the call to the game observer.

Parameters:
aFrom The summoner's address
Returns:
Whether we accept the invitation or not.

Definition at line 515 of file SIPExGameEngine.cpp.

References MSIPExGameObserver::AcceptInvitationL(), and iGameObserver.

00516     {
00517     HBufC* from = HBufC::NewLC( aFrom.Length() );
00518     from->Des().Copy( aFrom );
00519     TBool retVal = iGameObserver.AcceptInvitationL( *from );
00520     CleanupStack::PopAndDestroy( from );
00521     return retVal;
00522     }

CSIPExSIPEngine * CSIPExEngine::SIPEngine (   )  [private]
 

Returns the SIP Engine pointer.

Returns:
The pointer to the CSIPExSIPEngine. The ownership is NOT transferred.

Definition at line 314 of file SIPExGameEngine.cpp.

References iSIPEngine.

00315     { 
00316     return iSIPEngine; 
00317     }

CSIPExSocketEngine * CSIPExEngine::SocketEngineL (   )  [private]
 

Returns the socket engine. If the socket engine (iSocketEngine) is NULL it will be created.

Returns:
The pointer to the CSIPExSocketEngine. The ownership is NOT transferred.

Definition at line 325 of file SIPExGameEngine.cpp.

References iSocketEngine, and CSIPExSocketEngine::NewL().

00326     { 
00327     if( !iSocketEngine )
00328         {
00329         iSocketEngine = CSIPExSocketEngine::NewL( *this );
00330         }
00331     return iSocketEngine;
00332     }

MSIPExGameObserver & CSIPExEngine::GameObserver (   )  [private]
 

Returns the game observer reference.

Returns:
The reference to the MSIPExGameObserver.

Definition at line 339 of file SIPExGameEngine.cpp.

References iGameObserver.

00340     { 
00341     return iGameObserver; 
00342     }

void CSIPExEngine::ConstructL (   )  [private]
 

2nd phase constructor

Definition at line 104 of file SIPExGameEngine.cpp.

References iActiveState, iSIPEngine, iSocketEngine, iStateAcceptingSIP, iStateConnecting, iStateIdle, iStateInviting, iStateLocal, iStateRegistered, iStateRegistering, iStateRemote, CSIPExSIPEngine::NewL(), CSIPExSocketEngine::NewL(), and ResetGame().

00105     {
00106     // Init all state objects
00107     iStateIdle          = new (ELeave) TSIPExStateIdle;
00108     iStateRegistering   = new (ELeave) TSIPExStateRegistering;
00109     iStateRegistered    = new (ELeave) TSIPExStateRegistered;
00110     iStateInviting      = new (ELeave) TSIPExStateInviting;
00111     iStateConnecting    = new (ELeave) TSIPExStateConnecting;
00112     iStateLocal         = new (ELeave) TSIPExStateLocal;
00113     iStateRemote        = new (ELeave) TSIPExStateRemote;
00114     iStateAcceptingSIP  = new (ELeave) TSIPExStateAcceptingSIP;
00115 
00116     iSocketEngine = CSIPExSocketEngine::NewL( *this );
00117     iSIPEngine = CSIPExSIPEngine::NewL( KUidSIPExApp, this );
00118 
00119     // Set the first state as active state
00120     iActiveState = iStateIdle;
00121 
00122     // Reset game data
00123     ResetGame();
00124     }


© Nokia 2006

Back to top