On/off Timer Application

S

Sam

Hi,
I developed a simple application that allow to turn off/on phone (or
wifi,bluetooth) modules at specific time. It woks good but if I turn off
(freeze, not without supply) my device, the backgroung process seems to be
freezed as well. Is there any way to create a process that works always in
background?

Thanks,
Sam
 
C

Christopher Fairbairn [MVP]

Hi,

Sam said:
It woks good but if I turn off (freeze, not without supply) my device, the
backgroung process seems to be freezed as well. Is there any way to create
a process that works always in background?

There are a couple of possible solutions to this "issue". In general you
don't want to force a device to stay out of suspend or low power mode(s) in
order to maximise battery live etc.

In your case you could look at using a function called CeRunAppAtTime
(documented on MSDN at
http://msdn.microsoft.com/en-us/library/ms913957.aspx).

If you determine the time when your next event is required (i.e. the next
radio needs turned on / off) you could platform invoke CeRunAppAtTime from
your .NET CF application and get the device to automatically wake up if it
was suspended at that point in time.

If you can use OpenNETCF's smart device framework it has a
OpenNETCF.WindowsCE.Notification.Notify class which contains a
SetNamedEventAtTime method that would be of interest (it wraps up
CeRunAppAtTime). In particular this method uses a special feature that
enables an event to be signaled rather than a second instance of your
application launching.

Hope this helps,
Christopher Fairbairn
 
S

Sam

If you can use OpenNETCF's smart device framework it has a
OpenNETCF.WindowsCE.Notification.Notify class which contains a
SetNamedEventAtTime method that would be of interest (it wraps up
CeRunAppAtTime). In particular this method uses a special feature that
enables an event to be signaled rather than a second instance of your
application launching.
I was looking for information about SetNamedEventAtTime method when I found
OpenNETCF.WindowsCE.LargeIntervalTimer Class. It is very useful and easy to
use class, so I use it.
Anyway, I haven't understand the first param of SetNamedEventAtTime method.
I cannot use it. Do you have any example?
Thank you very much!!
Sam.
 
C

Chris Tacke, eMVP

The first parameter is the string name of the named event. If you use a
ManualResetEvent or an AutoResetEvent with the override accepting a string
name (only exposed in the SDF, not in the CF), then you can use the same
name to cause that event to be set, even cross process. This is the exact
mechanism that the LIT uses internally.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top