static Boolean HwrBacklight(Boolean set, Boolean newState)
 SYS_TRAP(sysTrapHwrBacklightV33);
static UInt8 SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel)
       SYS_TRAP(sysTrapSysLCDBrightness);
static Boolean BacklightIsOn(void) {
 UInt32 glRomVersion;

 FtrGet(sysFtrCreator, sysFtrNumROMVersion, &glRomVersion);
 if (glRomVersion < sysMakeROMVersion(5,0,0,sysROMStageRelease,0)) {
  return HwrBacklight(false, false);
 }
 else {
  UInt8 brightnessLevel = SysLCDBrightness(false, 0);
  return brightnessLevel ? true : false;
 }
}


Horst

"Robert" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi..
>
> I have been looking for the same thing (read the toggle status, which
> will not work at all)!!
>
> There is one command that may be worth looking at:
>
> SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel)
>
> in SystemMgr.h file.
>
> Robert
>
> --- In [EMAIL PROTECTED], Jeff Ishaq <[EMAIL PROTECTED]> wrote:
> > At 08:34 PM 6/27/2003 -0700, [EMAIL PROTECTED] wrote:
> > >Hello,
> > >
> > >    I need to check whether backlight is on or off.
> > >How can i check?
> >
> > Good question, I couldn't find a good way to tell for sure whether the
> > backlight is on.  Surely there's a bit somewhere in the low-memory
> globals
> > that will tell you precisely the information you need, but I suspect
> you'd
> > need to become a Palm OS licensee to get the official documentation
> (and
> > support) for this bit.
> >
> > I found a few ways of getting close to the info you need.  :)
> >
> > I know in OSes 3.5 and earlier, there is a HwrBacklight() function you
> > could call to get the status of the backlight.  I think it was an
> > undocumented function that you just had to trap into manually with
> inline
> > assembly.  That API has been deprecated in newer versions of Palm OS.
> >
> > There is a vchrBacklight character defined in Chars.h that appears to
> > toggle the state of the backlight.  I would imagine this key gets
> enqueued
> > when the user holds down the power-on button long enough to toggle the
> > backlight.  When the OS gets ahold of this character, it calls internal
> > routine(s) to physically toggle the backlight's state.  Your app can
> > intercept these characters in your event loop, and this will tell
> you when
> > the user has toggled the backlight while your app is running.
> However, it
> > won't give you any indication of the state of the backlight, so
> might not
> > be of any use to you.
> >
> > Other ways to get close to the information you need is to use the
> > notification manager to determine when the device is asleep or
> awake.  You
> > can use SysBatteryInfo() to determine if the device is on the cradle
> > (charging) and combine that with the state of
> prefStayLitWhenPluggedIn (aka
> > stayLitWhenPluggedIn) OS preference.
> >
> > Maybe somebody else on this forum has a better technique?
> >
> > -Jeff Ishaq
> >
> >
> >
> > -- 
> > For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
>
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to