Problem waking up device... I think I've tried everything...

L

LEM

Hi all,

I have been for almost 2 days trying everything.
I need to wake up the device once the PDA is in idle mode (the user
pressed the power button)

I tried with SetSystemPowerState,RunAppAtTime and they don't work.

The only one that works is using the attached code. The problem is once
the device is waken up it will show a Notification dialog. If I change
the NotificationAction to something different (the available options
are Led,Private,Repeat,sound,Vibrate) it just doesn't wake up.

I thought that maybe the device was really awake but the screen was
off, but it doesn't, because I did some testing with a timer and writing
some text to the screen and it doesn't write any text until I press the
Power button again.

Here is the one that works but it shows that damn dialog:

OpenNETCF.WindowsCE.Notification.UserNotificationTrigger trigger = new
OpenNETCF.WindowsCE.Notification.UserNotificationTrigger();

trigger.Application = GetAppPath() + "\\Power.exe";
trigger.Type = OpenNETCF.WindowsCE.Notification.NotificationType.Time;
trigger.StartTime = DateTime.Now.AddSeconds(20);


OpenNETCF.WindowsCE.Notification.UserNotification n = new
OpenNETCF.WindowsCE.Notification.UserNotification();
n.Action = OpenNETCF.WindowsCE.Notification.NotificationAction.Dialog;
n.Title = "Reminder";
n.Text = "test";

OpenNETCF.WindowsCE.Notification.Notify.SetUserNotification(trigger, n);


Any help would be appreciated.

Thanks
 
P

Paul G. Tobey [eMVP]

You can't assume that you're going to be able to arrange for a time-based
event to happen in 20 seconds. Figure on a resolution of no better than 1
minute. 5 minutes might be an even better number. Tell us what exactly it
is that you're trying to accomplish; that is, take a step back from API
calls, etc. and tell us what you are supposed to accomplish. You'll get a
better response that way.

Paul T.
 
L

LEM

Thanks for your reply, Paul.

My program tracks data from a GPS (COM port) every n seconds (let's say
minutes for this example).
If the user presses the power button and turn the device off, I want to
have a timer that wakes up the device after those n minutes, read a new
position from the GPS and turn the device off again.
I will be doing this process continuously...

The reason of doing that is to save power while using my program.

As you probably know, if you turn off the device the COM port is closed.
That's why I need to do this.

Regards
 
P

Paul G. Tobey [eMVP]

OK, I'd say that setting CERunAppAtTime() is the right way to handle that,
probably by having it trigger an event, rather than actually run you,
although either could work. So, if I'm correct about setting the times
properly (time to next appointment not less than a minute or two from now),
you should be OK on the wake-up end. However, there is a power manager
setting that controls how soon after a wake-up it will allow you to suspend
again, so that might be causing you some grief. I didn't really ever run
into it myself, but I've been reading Doug Boling's new "Programming Windows
Embedded CE 6.0" book on and off, and he mentions it there. Frankly,
though, I'm not convinced that, in the general case, you're really going to
be saving all that much power, given that waking up means turning the
display on, etc. You might be better off just setting the power state to
'display off', keeping the device from ever suspending, and requesting that
the power manager keep the serial port at full operation or something.

Well, testing will tell...

Paul T.
 
L

LEM

Actually at this moment I'm have a feature that turns off the screen,
and turns off the GPS between readings, but users asked me to turn off
the device as well to save even more power. So do you think that will
not save much more power?
 
P

Paul G. Tobey [eMVP]

I'm not sure it will save *any* power because of the screen coming back on
when you resume it. The backlight for the screen consumes most of the power
consumed by a device that's in the 'on' state. Again, you'd have to test to
verify that this is the case, but it would not surprise me at all.

Paul T.
 
L

LEM

my idea was to wake up the device and keep the screen off while I was
reading from the GPS.

The problem is I also tried CERunAppAtTime() but that doesn't wake up
the device. If the pda is on it will activate my application correctly,
but if not, it does nothing...
 
P

Paul G. Tobey [eMVP]

You tried this with the wake up time set, say, 5 minutes into the future? I
don't know of any way to "wake up but keep display off", although I do know
how to "turn display off, but keep device awake".

Paul T.

LEM said:
my idea was to wake up the device and keep the screen off while I was
reading from the GPS.

The problem is I also tried CERunAppAtTime() but that doesn't wake up the
device. If the pda is on it will activate my application correctly,
but if not, it does nothing...

I'm not sure it will save *any* power because of the screen coming back
on when you resume it. The backlight for the screen consumes most of the
power consumed by a device that's in the 'on' state. Again, you'd have
to test to verify that this is the case, but it would not surprise me at
all.

Paul T.

LEM said:
Actually at this moment I'm have a feature that turns off the screen,
and turns off the GPS between readings, but users asked me to turn off
the device as well to save even more power. So do you think that will
not save much more power?



Paul G. Tobey [eMVP] wrote:
OK, I'd say that setting CERunAppAtTime() is the right way to handle
that, probably by having it trigger an event, rather than actually run
you, although either could work. So, if I'm correct about setting the
times properly (time to next appointment not less than a minute or two
from now), you should be OK on the wake-up end. However, there is a
power manager setting that controls how soon after a wake-up it will
allow you to suspend again, so that might be causing you some grief. I
didn't really ever run into it myself, but I've been reading Doug
Boling's new "Programming Windows Embedded CE 6.0" book on and off, and
he mentions it there. Frankly, though, I'm not convinced that, in the
general case, you're really going to be saving all that much power,
given that waking up means turning the display on, etc. You might be
better off just setting the power state to 'display off', keeping the
device from ever suspending, and requesting that the power manager keep
the serial port at full operation or something.

Well, testing will tell...

Paul T.

Thanks for your reply, Paul.

My program tracks data from a GPS (COM port) every n seconds (let's
say
minutes for this example).
If the user presses the power button and turn the device off, I want
to have a timer that wakes up the device after those n minutes, read a
new position from the GPS and turn the device off again.
I will be doing this process continuously...

The reason of doing that is to save power while using my program.

As you probably know, if you turn off the device the COM port is
closed.
That's why I need to do this.

Regards
 
L

LEM

You tried this with the wake up time set, say, 5 minutes into the
future?

Yes, this is what I tried:

OpenNETCF.WindowsCE.Notification.Notify.RunAppAtTime(GetAppPath() +
"\\Power.exe", DateTime.Now.AddMinutes(5));

which should be the same than using CERunAppAtTime()

Nothing happens after 5 minutes.
 
G

Guest

I've never encountered a device where CeRunAppAtTime sidn't work for any
setting of 11 seconds (it's a number hard-coded in the default kernel).
You're certain it's not powering at all? Simply incrementing a number on a
thread will show if it is or not.

If you're using SDF 2.1, try using the LargeIntervalTimer as well - it's
specifically designed for this type of an operation. It will simply fire a
managed event in your app at the desired time whether you are asleep or not.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com
 
P

Paul G. Tobey [eMVP]

And Power.exe was *not already running*? If it's already running, Pocket PC
isn't going to start it up again...

Paul T.
 
L

LEM

Yes, it's running. If the program is running it should activate it.
Actually that's what it does if I don't power off the device and I call
that function.

Anyway, the problem is already solved using <ctacke/>'s solution.

I also want to thank you for your help, Paul.
 
M

marco melli

Hello LEM,
I Have the the same problem you had.
I need to send the GPS Position to a server every 20 minutes, and I need to save the batteries.

I tried the OpenNETCF.WindowsCE.LargeIntervalTimer.
It seems to fire the tick correctly, but i cannot resume the gps. (SO i cannot get the position)

Can you please help me to understand how you solved the problem.

Thank You.
Marco
 
S

Selma G?zel

Hi,
I have searched the subject and have found something which is done via OpennetCF.Windows dll.

But i haven't been able to find the absolute solution.

Can you write a code snippet for this purpose?

Thanks.
 

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

Similar Threads


Top