nn::applet::CTR::ProcessPowerButtonAndWait Function

Syntax

void ProcessPowerButtonAndWait();

Arguments

None.

Return Values

None.

Description

Processes power button transition and goes into standby until activated.

This function was designed to be used as follows. Only call this function if the nn::applet::CTR::IsExpectedToProcessPowerButton function returns true. After this function returns, be sure to check whether to exit the application using the nn::applet::CTR::IsExpectedToCloseApplication function.

    if ( nn::applet::CTR::IsExpectedToProcessPowerButton() )
    {
        // Perform processing as needed here before transition to the POWER Menu.
        nn::applet::CTR::ProcessPowerButtonAndWait();
        if ( nn::applet::CTR::IsExpectedToCloseApplication )
        {
            // Leave the main loop, and perform termination processing
        }
        // Perform processing as needed here after returning from the POWER Menu.
    }

This function performs the following processing internally.

    // Disable sleep
    bool e = IS_SLEEP_ENABLED();  // pseudocode: Check if sleep is enabled.
    if ( e )
    {
        nn::applet::CTR::DisableSleep();
    }
    // Process power button
    nn::applet::CTR::ProcessPowerButton();
    nn::applet::CTR::WaitForStarting();
    // Enable sleep if necessary
    if ( e )
    {
        nn::applet::CTR::EnableSleep();
    }

There is no need to take the sleep-enabled status into account when calling this function. This is because although it will return to Sleep Mode regardless of the return value of the nn::applet::CTR::IsExpectedToCloseApplication function, the sleep-related callback will not be called if the application termination flag is true.

In addition, you must initialize the graphics library using the nngxInitialize function before calling this function.

Revision History

2011/03/30
Added note about the need for the nngxInitialize function.
2011/03/07
Initial version.

CONFIDENTIAL