03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17.3.1 Maintaining an Outstanding Request<br />

The active example shows the outstanding-request active object pattern, in which RunL()<br />

handles the completion of a previous request and then issues a new request.<br />

Here's the declaration of CFlashingHello:<br />

class CFlashingHello : public CActive<br />

{<br />

public: private:<br />

// Construct/destruct<br />

static CFlashingHello* NewL(CActiveHelloAppView* aAppView);<br />

~CFlashingHello();<br />

// Request<br />

void Start(TTimeIntervalMicroSeconds32 aHalfPeriod);<br />

private:<br />

// Construct/destruct<br />

CFlashingHello();<br />

void ConstructL(CActiveHelloAppView* aAppView);<br />

// from CActive<br />

void RunL();<br />

void DoCancel();<br />

// Utility<br />

void ShowText(TBool eShowText);<br />

private:<br />

// Member variables<br />

RTimer iTimer;<br />

TTimeIntervalMicroSeconds32 iHalfPeriod;<br />

// Pointers elsewhere<br />

CActiveHelloAppView* iAppView;<br />

};<br />

Figure 17.10 shows how it fits into the application program:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!