03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 17.10<br />

The Start(), RunL(), and DoCancel() functions of CFlashing Hello show how to<br />

maintain an outstanding request. Here's Start():<br />

void CFlashingHello::Start(TTimeIntervalMicroSeconds32 aHalfPeriod)<br />

{<br />

_LIT(KFlashingHelloPeriodPanic, "CFlashingHello");<br />

__ASSERT_ALWAYS(!IsActive(), User::Panic<br />

(KFlashingHelloPeriodPanic, 1));<br />

// Remember half-period<br />

iHalfPeriod=aHalfPeriod;<br />

// Hide the text, to begin with<br />

ShowText(EFalse);<br />

// Issue request<br />

iTimer.After(iStatus, iHalfPeriod);<br />

SetActive();<br />

}<br />

Start() begins by asserting that a request is not already active and ends by issuing a<br />

request – just as before. Because a whole series of requests will be issued, Start()<br />

doesn't merely pass the half-period parameter to the iTimer.After(), but stores it as a<br />

member variable for later use.<br />

Start()also starts off the visible aspect of the flashing process by immediately hiding the<br />

text (which is visible until Start() is called).<br />

When the timer completes, RunL() is called:<br />

void CFlashingHello::RunL()<br />

{

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

Saved successfully!

Ooh no, something went wrong!