To turn on the backlight and keep it turned on, a timer can be used that fires every ten seconds. When the timer fires a raw event is simulated, which keeps the backlight turned on.
The following example code illustrates this.
void CStreamingClientAppUi::ConstructL() { ...... iTimer=CPeriodic::NewL(CActive::EPriorityStandard); // CPeriodic *iTimer; iTimer->Start(KTimerTick,KTimerTick,TCallBack(Tick,this));//const TInt KTimerTick = 10 * 1000 * 1000; ...... }
CStreamingClientAppUi::~CStreamingClientAppUi() { iTimer->Cancel(); delete iTimer; }
//This method should be declared as static // static TInt Tick(TAny* /*aAny*/);
TInt CStreamingClientAppUi::Tick(TAny */*aObject*/) { User::ResetInactivityTime(); RWsSession session; session.Connect();
TRawEvent event; event.Set(TRawEvent::EActive); session.SimulateRawEvent(event);
session.Flush(); session.Close(); return KErrNone; //Return that we want the timer to continue calling us. }

|