Jim (or anyone else out there),
Do you know the best way to have the app put the Palm into sleep mode?
Currently I have the app generate appStopEvents but now I am at the point to
where I actually need to just write my info the database and I want it then
to go to sleep. Also is there a way to cause my app to always start when the
palm starts? Is this shared library something that I need for this?

Thanks,
Daniel A. Schultz
Software Consultant
Symmetry Software, LLC
mailto:<[EMAIL PROTECTED]>



-----Original Message-----
From: Jim Schram [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 17, 1999 1:36 PM
To: [EMAIL PROTECTED]
Subject: Re: hooks entering and exiting sleep mode?


At 9:37 AM -0700 1999/04/17, [EMAIL PROTECTED] wrote:
>Is there a way, without hacking on the Palm OS code,  to get a
"notification"
>(Application launch) when the system is about to enter "sleep mode" ?
>Likewise, can I get a "notification" that the system has just went into
>"running mode"?
>
>I will humbly accept pointers to documentation or faq's that address this
>question.  I have tried the Palm published faq's and went through the Palm
>development documentation and at this point I'm starting to think it is not
>possible.

You're more or less correct -- without hacking there is no way for an
application to reliably detect the sleep/wake cycle. There is one for shared
libraries, but the issue there is the API can be called at interrupt time,
which prevents your app from doing things like allocating memory or calling
user interface routines. So really it's of limited utility -- it was
designed for hardware-twiddling actions like powering off a serial port, for
example.

If you're only concerned about 'noticing' the sleep and wake in your
application, you can look for the hardPowerChr command key event before
passing it to SysHandleEvent. That should catch most non-emergency
sleep/wake cycles, as SysHandleEvent calls SysSleep when the hardPowerChr
command key occurs, and SysSleep doesn't return until there's a reason for
the device to wake up again.

Keep in mind this path isn't guaranteed to be the ONLY path to SysSleep,
however. Some 3rd party hacks call SysSleep directly. Similarly, SysSleep
may be called directly by the OS when there's a power-loss emergency, to
protect the contents of RAM.

On slightly brighter news, this is one of the areas we've been considering
expanding a bit via the notification manager...

Regards,

Jim Schram
3Com/Palm Computing
Partner Engineering

Reply via email to