Chris Faherty wrote:
>
> I'm just wrapping up a datebook/todo viewer. If the device turns on I need
> to detect it so that I can update the display to the correct day. This is
> assuming that the device went to sleep with my application running.
>
> The way I am currently doing it is by testing for hardPowerChr and autoOffChr
> *after* the SysHandleEvent() call. It is my understanding that the device
> goes to sleep in SysHandleEvent() such that I will not detect the
> hardPowerChr or autoOffChr until it wakes up again. Kind of a backwards way
> of testing for poweron, but I can't figure out a better way.
>
> The drawback of this is that even if the device wakes because of another hard
> button, I will still get the hardPowerChr or autoOffChr that put it to sleep
> originally. I suppose that is an advantage if the device wakes due to an
> alarm.
>
> Anyhow, is there a preferred way to tell inside my EventLoop() if the device
> has just awakened via the power button?
>
> /* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */
Chris,
Remember that on OS version 2 and 1 the automatic power off is normally
done under interrupt and not with autoOffChr.
You might keep the time/date display up to date by asking for events
every 30 seconds or so. OS V 3 allows you to put that timeout in the
call to EvtGetEvent(). Older OS's, I've observed, require -1 for the
timeout and your own logic to filter nilEvent's.
Alex Robinson
[EMAIL PROTECTED]
-eom-