Handling Multiple Device Wakes

  • Thread starter Thread starter Haggy
  • Start date Start date
H

Haggy

Hi

As I mentioned somewhere before the deviceWake Event of smartDevice may
fire multiple times.

Now the Question is how may I handle this if I got code which is only
allowed to fire exact ones , when the device is turned on.

My first thought was to use the PowerDown event to set a flag which is
used by the wake event.

But sometimes the powerdown is triggerd after the wake when the device
is turned on.

So what may I do to handle this problem ?
Any Ideas?
 
Use a timer or static variable to make sure that multiple wake event within
a specific period of time are treated as one.

-Chris
 
Hi
I implemented this.
So now when multiple Devicewakes will fire within one second they will
beignored.

unforturnately if the user turns the device very quick off and on again
this would also be ignored .-(
 
Correct, there's no way to avoid that. On the plus side, you'd decreased
the possibility of error from always to unlikely, which is an improvement.
If you want to "fix" it completely, you need to make your code so it doesn't
matter if it's called multiple times.

-Chris
 
Hi Chris

thanks for your reply I hoped there would be an better way then I implented.

Firing multiple times the DevicesWake event doesn't crash the
application but it costs a lot of performance.

But it seems like i could minimize the timeframe to 0,5 seconds so that
it is nearly impossible for the user to turn the device off and on again
in this small timespan

The difference is great . Before the changes it took about 3-8 seconds
till the applicatio was running, now its just 1 second left
 
Back
Top