Trick:Controlling the backlight(Symbian/UIQ)

类别:软件工程 点击:0 评论:0 推荐:

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.
}

本文地址:http://com.8s8s.com/it/it32948.htm