I don't actually need to figure out what's causing the device to
"dream", but as you suggest I just need to figure out when the device
has really woken up.
My brilliant idea was to record the time I get a late wakeup event, and
set an alarm for 2 seconds in the future. If I get a sleep event before
the alarm fires, I know I was just "dreaming" and I cancel the alarm.
If the alarm fires, I know I've actually woken up.
Trouble is, it seems that just by setting the alarm, I actually wake the
device up fully, and I don't get the immediate sleep event anymore.
Maybe I need to try this strategy again with a proc alarm instead of a
regular alarm.
Any more clues on how to sort this out?
Thanks for your help,
Gary
Jeff Loucks wrote:
What you are seeing is probably a short dream sequence. If you watch
the event queue, you'll probably see an AutoOff character about 3
ticks after the LateWakeup. Some devices, the screen is coming on and
going right back off again. If you put in a delay when the AutoOff of
SleepRequest occurs, you'll probably see the screen come on.
There are several reasons for the device to wake up. Many interrupts
will do it. If you are using the serial port, I've seen it get into a
state where it won't let the device sleep. If the phone needs service,
the device will wake. If NetLib needs to respond to something, the
device wakes. Try shutting down various services and see if your
waking stops.
This has been a thorn in my side for a long time. The spec says
EarlyWakeup, then either SleepRequest/SleepNotify to go back to sleep,
or LateWakeup, signifying it's waking past dream state to fully awake
(screen on). This makes sense, but this is not what happens. What
actually happens is you'll get the EarlyWakeup, then the LateWakeup,
then either AutoOff event to go back to sleep or a selection of other
events indicating you might come fully awake.
Sometimes, I need to know when the device is dreaming, instead of
actually waking. It is difficult to determine. I find you receive the
EarlyWakup and then the LateWakeup, and then you have to wait for
something else to happen. If I just wanted to know if the device is
awake (screen on or not), I don't have to look at anything (if I'm
running, I'm obviously awake!). But, I need to know the difference
between dream and wake. That's tough because you have to 'predict'
waking. It also inserts dead time in your process, because you can't
tell what you'll be (dream or wake) until some later event occurs.
On 9/29/06, Gary <[EMAIL PROTECTED]> wrote:
I've registered myself for three notifications:
sysNotifySleepRequestEvent
sysNotifySleepNotifyEvent
sysNotifyLateWakeupEvent
Mostly I seem to get notified when I would expect, but I'm now seeing
some strange behavior. I'm getting three notifications back to back, in
this order:
sysNotifyLateWakeupEvent
sysNotifySleepRequestEvent
sysNotifySleepNotifyEvent
So it looks like the device is fully waking up, and then immediately
going back to sleep. This patter then repeats every 15 seconds. I'm
watching the device, and it's not waking up (i.e. the screen stays off).
I've currently got my app set on an alarm to wake up once per minute
(for debugging purposes), and this is working correctly. Screen comes
on, app does it's thing, and the device goes back to sleep. I then get
the strange wakeup/sleep combinations every 15 seconds until the device
wakes up "for real" again.
Anyone ever seen anything like this?
Thanks,
Gary
--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/