locked
Device power levels RRS feed

  • Question

  • Currently I have an application that will respond to system events. I've found that these events fire even if the power of the machine has been turned off, which is good for my application. However, I’ve also found that while my application is processing the events the machine will go back to sleep mode after a bit of time. So I have the following question:

     

    How can I prevent the power from turning completely off while my application is processing the event, but not turn on the machine fully?


    Everything I’ve found/tried so far causes the machine to turn on all the way:
    SHIdleTimerReset();

    SystemIdleTimerReset();
    SetSystemPowerState(null, POWER_STATE_ON, POWER_FORCE);

     

    Any help would be appreciated.


    Thanks
    Wayne

    Saturday, August 8, 2009 8:25 PM

Answers


  • First to answer your question your application needs to run in unattended mode.  What you are observing when the screen turns off is that some other process is running in unattended mode so the processor is continuing to run when the screen turns off.  This isn't uncommon as a lot of times the OEM may have some processes that need to do things when the device is suspending.

    If you would like detailed information on "Windows Mobile Power Management" a google or bing search on that exact phrase will bring you to an article I put on CodeProject about the topic.  I addressed the question that you just asked in a section under the heading "Wake up and Quietly Work."  Code Project is undergoing a hardware upgrade so their site is currently unavailable, but a cached version of the article can be found at http://74.125.47.132/search?q=cache:YuublKHksPsJ:www.codeproject.com/KB/mobile/WiMoPower1.aspx+windows+mobile+power+management&cd=1&hl=en&ct=clnk&gl=us

    Enter Unattended mode:
    PowerPolicyNotify(PPN_UNATTENDEDMODE, -1);

    Exit Unattended Mode:
    PowerPolicyNotify(PPN_UNATTENDEDMODE, -1);





    Joel Ivory Johnson
    Sunday, August 9, 2009 12:26 AM
  • Hello,

    Small Rectification :-
    Enter Unattended Mode
    PowerPolicyNotify(PPN_UNATTENDEDMODE, True);

    Exit Unattended mode
    PowerPolicyNotify(PPN_UNATTENDEDMODE, False);

    System can go to suspended mode as follows:-

    1) IdleTimer expires
    2) System Power Button pressed by user

    above API will prevent system to go to suspended mode only in case of 2 option. so one need to call SystemIdleTimerReset();

    or if you can then simulate power button press event.
    using the same API

    PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);

    But keep in mind it this API implementation is OEM dependent, might be the case will not work on few HS.

     

    Thanks

    Arpit Pradhan


    WinCE CODER (If you think my solution help you in some sense do mark my Reply as Answer)
    • Edited by NEO131 Sunday, August 9, 2009 4:28 AM rectification and suggestion
    • Marked as answer by Guang-Ming Bian - MSFT Friday, August 14, 2009 2:34 AM
    Sunday, August 9, 2009 4:24 AM

All replies


  • First to answer your question your application needs to run in unattended mode.  What you are observing when the screen turns off is that some other process is running in unattended mode so the processor is continuing to run when the screen turns off.  This isn't uncommon as a lot of times the OEM may have some processes that need to do things when the device is suspending.

    If you would like detailed information on "Windows Mobile Power Management" a google or bing search on that exact phrase will bring you to an article I put on CodeProject about the topic.  I addressed the question that you just asked in a section under the heading "Wake up and Quietly Work."  Code Project is undergoing a hardware upgrade so their site is currently unavailable, but a cached version of the article can be found at http://74.125.47.132/search?q=cache:YuublKHksPsJ:www.codeproject.com/KB/mobile/WiMoPower1.aspx+windows+mobile+power+management&cd=1&hl=en&ct=clnk&gl=us

    Enter Unattended mode:
    PowerPolicyNotify(PPN_UNATTENDEDMODE, -1);

    Exit Unattended Mode:
    PowerPolicyNotify(PPN_UNATTENDEDMODE, -1);





    Joel Ivory Johnson
    Sunday, August 9, 2009 12:26 AM
  • Hello,

    Small Rectification :-
    Enter Unattended Mode
    PowerPolicyNotify(PPN_UNATTENDEDMODE, True);

    Exit Unattended mode
    PowerPolicyNotify(PPN_UNATTENDEDMODE, False);

    System can go to suspended mode as follows:-

    1) IdleTimer expires
    2) System Power Button pressed by user

    above API will prevent system to go to suspended mode only in case of 2 option. so one need to call SystemIdleTimerReset();

    or if you can then simulate power button press event.
    using the same API

    PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);

    But keep in mind it this API implementation is OEM dependent, might be the case will not work on few HS.

     

    Thanks

    Arpit Pradhan


    WinCE CODER (If you think my solution help you in some sense do mark my Reply as Answer)
    • Edited by NEO131 Sunday, August 9, 2009 4:28 AM rectification and suggestion
    • Marked as answer by Guang-Ming Bian - MSFT Friday, August 14, 2009 2:34 AM
    Sunday, August 9, 2009 4:24 AM