none
After I call SetSystemPowerState(NULL, POWER_STATE_OFF,POWER_FORCE), how can I realize power off the system?

    Question

  •  Hi, all

        I have program the MFC smart device application to realize power off the Windows CE7 OS。 While I can realize the suspend system with the function: SetSystemPowerState(NULL, POWER_STATE_SUSPEND,POWER_FORCE), but could not realize the power off the system, with the command SetSystemPowerState(NULL, POWER_STATE_OFF,POWER_FORCE) .

    How will I change the  program? sincerely hope U 

    THX ~

    Regards

    Henda

    Thursday, June 27, 2013 5:09 AM

All replies

  • There is no power off option by default, until you have customized the power mananger driver to do this. you can see the SetSystemPowerState function implementated as PlatformSetSystemPowerState() in 

    \WINCE700\PUBLIC\COMMON\OAK\DRIVERS\PM\PDD\DEFAULT\platform.cpp. See the comments given in hte below code snippet

      
                    // Handle resets and shutdowns here, after flushing files.  Since Windows CE does
                    // not define a standard mechanism for handling shutdown (via POWER_STATE_OFF),
                    // OEMs will need to fill in the appropriate code here.  Similarly, if an OEM does
                    // not support IOCTL_HAL_REBOOT, they should not support POWER_STATE_RESET.
                    if((dwNewStateFlags & POWER_STATE_RESET) != 0) {
                        // is this to be a cold boot?
                        if(_tcscmp(pszName, _T("coldreboot")) == 0) {
                            SetCleanRebootFlag();
                        }
    
                        // should not return from this call, but if we do just suspend the system
                        KernelLibIoControl((HANDLE)KMOD_OAL, IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
                        RETAILMSG(TRUE, (_T("PM: PlatformSetSystemPowerState: KernelIoControl(IOCTL_HAL_REBOOT) returned!\r\n")));
                        DEBUGCHK(FALSE);        // break into the debugger
                    } 

    Are you an app developer or BSP developer? if you are the BSP developer, can clone the PM to your local BSP and you can add the power off support here.

    if you are an app developer then you can contact your device vendor, they can help you.


    Vinoth.R

    www.e-consystems.com

    http://vinoth-vinothblog.blogspot.com

    Thursday, June 27, 2013 5:41 AM
  •  

    Vinoth,

        Thank you for your reply. I am just a learner and confused by this  problem now I'll follow your advice to try.

    Thanks.

    Friday, June 28, 2013 5:41 AM