Power Management

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a .NET CF application that uses SQL CE. Some of my users are running into problems when synchronizing with the server when the PDA turns itself off. This corrupts the SQL CE database when this happens. Is there a way to programmatically modify the power management settings so that the PDA will not turn itself off mid sync.

Thanks
 
You can call SystemIdleTimerReset(). I think that will keep it from
shutting off (you have to call it repeatedly, of course). It takes no
parameters and returns nothing, so it should be easy to P/Invoke. Likely
it's found in coredll.dll.

Paul T.

PCK said:
I have a .NET CF application that uses SQL CE. Some of my users are
running into problems when synchronizing with the server when the PDA turns
itself off. This corrupts the SQL CE database when this happens. Is there
a way to programmatically modify the power management settings so that the
PDA will not turn itself off mid sync.
 
depending on your device you can set it never to turn
itself off by switching off the timeout

settings -->> system -->> power -->> on battery power/on
external power.
 
The problem with calling SystemIdelTimerReset() is that there is a single line of code that is taking longer to process than the power management setting (currently 3 minutes). Therefore if I were to use the SystemIdelTimerReset() both before and immediately after the single line of code it would do no good. I would need to introduce threads into the application to get this to work - which I would like to stay away from if possible

I also do not want to increase the timeout because doing so would put additional strain on the battery while the users are out in the field

Can you think of any other way to by pass the power management with exception to having the user tap the screen every X time period.
 
All there is is the thing which is reset by the idle timer function. That
is, you have to turn off idle checking or you have to reset the timer.
Those are the only two ways to do it, as far as I know.

This is where you come to a cross-roads:

1. You know of a quick and dirty solution that will work, is simple to
implement, but whose 'goodness' quotient is low.

2. There may be an elegant solution that would also work, but you don't know
what it is.

Economics comes into play here: take the quick and dirty solution and move
on to the next thing. If the elegant solution appears later, it should be
easy to start using it instead...

One thing to check:

There is probably an event created by the system which is used to notify the
idle checking routine that it's time to reload the time-out value from the
registry. You might try changing the value, strobing that event, doing a
SystemIdleTimerReset(), and then doing your long process. The event might
be called "PowerManager/ReloadActivityTimeouts". After your process, you
could, then, reset the time-out, fire the event again, and return control of
the system to the user...

Paul T.

PCK said:
The problem with calling SystemIdelTimerReset() is that there is a single
line of code that is taking longer to process than the power management
setting (currently 3 minutes). Therefore if I were to use the
SystemIdelTimerReset() both before and immediately after the single line of
code it would do no good. I would need to introduce threads into the
application to get this to work - which I would like to stay away from if
possible.
I also do not want to increase the timeout because doing so would put
additional strain on the battery while the users are out in the field.
Can you think of any other way to by pass the power management with
exception to having the user tap the screen every X time period.
 
Back
Top