views:

30

answers:

1

I am trying to get the powerstate for my windows mobile device.

The states are defined as:

#define POWER_STATE(f)           ((f) &  0xFFFF0000) // power state mask
#define POWER_STATE_ON           (DWORD)(0x00010000) // on state
#define POWER_STATE_OFF          (DWORD)(0x00020000) // no power, full off
#define POWER_STATE_CRITICAL     (DWORD)(0x00040000) // critical off
#define POWER_STATE_BOOT         (DWORD)(0x00080000) // boot state
#define POWER_STATE_IDLE         (DWORD)(0x00100000) // idle state
#define POWER_STATE_SUSPEND      (DWORD)(0x00200000) // suspend state
#define POWER_STATE_UNATTENDED   (DWORD)(0x00400000) // Unattended state.
#define POWER_STATE_RESET        (DWORD)(0x00800000) // reset state
#define POWER_STATE_USERIDLE     (DWORD)(0x01000000) // user idle state
#define POWER_STATE_BACKLIGHTON  (DWORD)(0x02000000) // device scree backlight on
#define POWER_STATE_PASSWORD     (DWORD)(0x10000000) // This state is password protected.

I am getting 0x10010000. So I have POWER_STATE_ON and POWER_STATE_PASSWORD set.

I get this when my device goes to an idle state (I am using RequestPowerNotifications to get that notification). You can see the example I am using here.

Since it is going idle, I am fairly sure that there is more info that I am not getting.

So my question is "how can I supply the password"? and what is the password? (My code is running on Symbol/Motorola devices owned by my company so I should be able to get the password, what ever it is.)

I am using C#, Visual Studio 2008 and CF3.5.

Any help (on this issue) would be most .... helpful.

+1  A: 

I'm not sure what you're asking. My guess is that the state has gone through a timeout that would then bring you to a password screen when you try to use it again. If you don't have that option set, then it's probably meaningless.

If you do have it set, then the password is the one set in the Control Panel.

ctacke
After re-reading this I can see it was a bit confusing as to what I was asking. I am trying to catch when my device goes idle. I am getting an event that fires when it goes idle, but the Idle Flag is not set. (Only "on" and "password" is set). Since the comment for password is that the state is password protected, I assumed that I need to pass in a password to get the full state info out (including the needed "idle" flag). Reading your comment it is sounding like that is not what the password means... If it is not for what I am supposing, then what do I need to do to get an idle state?
Vaccano
NOTE: I don't have any password set on the device (like a device locking kind of thing).
Vaccano
I changed my approach on this after finding your excellent article on how to detect if an application is idle (which is what I was trying to accomplish). Here is the link for future searchers: http://blog.opennetcf.com/ctacke/2009/05/19/DetectingApplicationIdle.aspx
Vaccano