Nokia N97 SDK
Example Applications Guide

CWsEventReceiver Class Reference

#include <gamecontroller.h>

Inheritance diagram for CWsEventReceiver:

List of all members.

Detailed Description

The Active Object that waits for Windows Server events and passes it on the Game Controller.

Definition at line 144 of file gamecontroller.h.


Public Member Functions

virtual void  RunL ()
virtual void  DoCancel ()
  ~CWsEventReceiver ()

Static Public Member Functions

static CWsEventReceiver *  NewL (CGameController &aParent)

Private Member Functions

  CWsEventReceiver ()
void  ConstructL (CGameController &aParent)

Private Attributes

RWsSession  iWsSession
CGameController *  iParent


Constructor & Destructor Documentation

CWsEventReceiver::~CWsEventReceiver (   ) 
 

Destructor.

Definition at line 448 of file gamecontroller.cpp.

00449 {
00450     Cancel();
00451 }

CWsEventReceiver::CWsEventReceiver (   )  [private]
 

Constructor.

Definition at line 437 of file gamecontroller.cpp.

00438                  :CActive( CActive::EPriorityStandard ),
00439                   iParent( NULL )
00440 {                      
00441 }


Member Function Documentation

void CWsEventReceiver::RunL (   )  [virtual]
 

Recieves events from the Windows Server.

This function gets called in the CGameController::ProcessBackgroundTasks() function, when the CActiveScheduler gets a chance to run.

Definition at line 502 of file gamecontroller.cpp.

References CGameController::HandleWsEvent(), iParent, and iWsSession.

00503 {
00504     TWsEvent wsEvent;
00505     iWsSession.GetEvent( wsEvent );
00506     
00507     // Pass the event on to the Game Controller.
00508     iParent->HandleWsEvent( wsEvent );
00509     
00510     // Request for more events.
00511     iWsSession.EventReady( &iStatus );
00512     
00513     SetActive();
00514 }

void CWsEventReceiver::DoCancel (   )  [virtual]
 

Cancels event request from the Windows Server.

Definition at line 521 of file gamecontroller.cpp.

References iWsSession.

00522 {
00523     iWsSession.EventReadyCancel();
00524 }

CWsEventReceiver * CWsEventReceiver::NewL (  CGameController &  aParent  )  [static]
 

Static Constructor.

Parameters:
aParent  The Game Controller requesting for the events.

Definition at line 458 of file gamecontroller.cpp.

References ConstructL().

00459 {
00460     CWsEventReceiver* self = new (ELeave) CWsEventReceiver;
00461     
00462     CleanupStack::PushL( self );
00463     
00464     self->ConstructL( aParent );
00465     
00466     CleanupStack::Pop( self );
00467     
00468     return self;    
00469 }

void CWsEventReceiver::ConstructL (  CGameController &  aParent  )  [private]
 

Two phase Constructor.

Parameters:
aParent  The Game controller which will be notified of Windows Server events .

Definition at line 477 of file gamecontroller.cpp.

References iParent, and iWsSession.

Referenced by NewL().

00478 {
00479     if( !CCoeEnv::Static() )
00480         User::Leave( KErrCoeEnvNotCreated );
00481     
00482     iParent = &aParent;
00483      
00484     // Register with the Windows Server for events.
00485     iWsSession = CCoeEnv::Static()->WsSession();
00486     
00487     iWsSession.EventReady( &iStatus );
00488     
00489     CActiveScheduler::Add( this );
00490     
00491     SetActive();
00492 }


Member Data Documentation

RWsSession CWsEventReceiver::iWsSession [private]
 

The Windows Server Session

Definition at line 189 of file gamecontroller.h.

Referenced by ConstructL(), DoCancel(), and RunL().

CGameController* CWsEventReceiver::iParent [private]
 

The Game controller

Definition at line 192 of file gamecontroller.h.

Referenced by ConstructL(), and RunL().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top