1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7<title>ProcessPowerButtonAndWait</title>
8  </head>
9  <body>
10<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/applet/Overview.html">applet</a>::<a href="../../../nn/applet/CTR/Overview.html">CTR</a>::ProcessPowerButtonAndWait</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14void ProcessPowerButtonAndWait();
15</pre>
16    </div>
17<h2>Arguments</h2>
18    <div class="section">
19<p>None.</p>
20    </div>
21<h2>Return Values</h2>
22    <div class="section">
23None.
24               </div>
25<h2>Description</h2>
26    <div class="section">
27<p>Processes power button transition and goes into standby until activated.</p><p>
28This function was designed to be used as follows. Only call this function if the <CODE><a href="../../../nn/applet/CTR/IsExpectedToProcessPowerButton.html">nn::applet::CTR::IsExpectedToProcessPowerButton</a></CODE> function returns <CODE>true</CODE>. After this function returns, be sure to check whether to exit the application using the <CODE><a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html">nn::applet::CTR::IsExpectedToCloseApplication</a></CODE> function.
29      </p><pre>
30    if ( nn::applet::CTR::IsExpectedToProcessPowerButton() )
31    {
32        // Perform processing as needed here before transition to the POWER Menu.
33        nn::applet::CTR::ProcessPowerButtonAndWait();
34        if ( nn::applet::CTR::IsExpectedToCloseApplication )
35        {
36            // Leave the main loop, and perform termination processing
37        }
38        // Perform processing as needed here after returning from the POWER Menu.
39    }
40</pre><p>
41This function performs the following processing internally.
42<pre>
43    // Disable sleep
44    bool e = IS_SLEEP_ENABLED();  // pseudocode: Check if sleep is enabled.
45    if ( e )
46    {
47        nn::applet::CTR::DisableSleep();
48    }
49    // Process power button
50    nn::applet::CTR::ProcessPowerButton();
51    nn::applet::CTR::WaitForStarting();
52    // Enable sleep if necessary
53    if ( e )
54    {
55        nn::applet::CTR::EnableSleep();
56    }
57</pre></p><p>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 <CODE><a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html">nn::applet::CTR::IsExpectedToCloseApplication</a></CODE> function, the sleep-related callback will not be called if the application termination flag is <CODE>true</CODE>.
58      </p><p>
59In addition, you must initialize the graphics library using the <CODE>nngxInitialize</CODE> function before calling this function.
60      </p></div>
61<h2>Revision History</h2>
62    <div class="section">
63      <dl class="history">
64        <dt>2011/03/30</dt>
65<dd>Added note about the need for the <CODE>nngxInitialize</CODE> function.
66        </dd>
67        <dt>2011/03/07</dt>
68<dd>Initial version.<br />
69        </dd>
70      </dl>
71    </div>
72  <hr><p>CONFIDENTIAL</p></body>
73</html>
74