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>Enable</title>
8  </head>
9  <body>
10<h1><CODE>nn::applet::CTR::Enable</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14void Enable(
15     bool isSleepEnabled = true
16);
17</pre>
18    </div>
19<h2>Arguments</h2>
20    <div class="section">
21      <table class="arguments">
22        <thead>
23          <tr>
24            <td width="15" />
25<th>Name</th>
26<td>Description</td>
27          </tr>
28        </thead>
29        <tr>
30<td>in</td>
31<th>isSleepEnabled</th>
32<td>This option specifies whether sleep is enabled.</td>
33        </tr> </table>
34    </div>
35<h2>Return Values</h2>
36    <div class="section">
37None.
38               </div>
39<h2>Description</h2>
40    <div class="section">
41<p>Enables features specific to the applet library.</p><P>
42You must always call this function. Calling this function enables the features provided by the Applet library.
43</P><P>
44Because the various callbacks are enabled immediately after this function is called, applications must configure each of the callbacks as quickly as possible and then call this function.
45</P><P>
46Specify <CODE>true</CODE> for the <SPAN class="argument">isSleepEnabled</SPAN> argument to have the function call <CODE><a href="../../../nn/applet/CTR/EnableSleep.html">nn::applet::CTR::EnableSleep</a>(applet::NO_SHELL_CHECK)</CODE> internally. In other words, this enables sleep notifications. However, the <CODE>applet::NO_SHELL_CHECK</CODE> argument indicates that when the <a href="../../../nn/applet/CTR/EnableSleep.html"><CODE>nn::applet::CTR::EnableSleep</CODE></a> function is called it does not check whether the system is closed. If you want to account for the possibility that that system may already be closed by that time, call <CODE><a href="../../../nn/applet/CTR/EnableSleep.html">nn::applet::CTR::EnableSleep</a>(applet::SLEEP_IF_SHELL_CLOSED)</CODE> immediately after this function.
47</P><P>
48Specify <CODE>false</CODE> for the <SPAN class="argument">isSleepEnabled</SPAN> argument to not enable sleep notifications. After this, call the <a href="../../../nn/applet/CTR/EnableSleep.html"><CODE>nn::applet::CTR::EnableSleep</CODE></a> function as appropriate.
49</P><P>
50This function calls <a href="../../../nn/applet/CTR/WaitForStarting.html"><CODE>nn::applet::CTR::WaitForStarting</CODE></a>. Because you must determine whether to close the application when this function returns, call the <a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html"><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE></a> function after this one exits.
51</P><PRE>
52Example
53
54  nnMain()
55  {
56      applet::SetSleepQueryCallback( mySleepQueryCallback, 0 );
57      applet::SetAwakeCallback( myAwakeCallback, 0 );
58      <FONT color="red">applet::Enable();</FONT>
59      if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) // Check for a close request
60      {
61          _finalize_application();
62          applet::PrepareToCloseApplication();
63          applet::CloseApplication();
64      }
65      <FONT color="red">applet::EnableSleep( applet::SLEEP_IF_SHELL_CLOSED );</FONT>
66       ...
67</PRE><P>
68(NOTE)
69</P><P>
70When applications that do not call this function are run on a debugger, the following problems occur because the applications are running outside of the CTR system.</P><UL><LI>The DevMenu runs in parallel and accepts key input, even though this is not intended.</LI><LI>After the system enters and recovers from sleep, the upper and lower screens remain black.</LI></UL><P>
71This second problem can be resolved by calling the <CODE>nngxStartLcdDisplay</CODE> function.
72</P></div>
73<h2>Revision History</h2>
74    <div class="section">
75      <dl class="history">
76        <dt>2010/12/14</dt>
77<dd>Added information related to determining whether to close the application. Added information on the <CODE>EnableSleep</CODE> function.
78        </dd>
79        <dt>2010/11/30</dt>
80<dd>Added example.<br />
81        </dd>
82        <dt>2010/11/15</dt>
83<dd>Initial version.<br />
84        </dd>
85      </dl>
86    </div>
87  <hr><p>CONFIDENTIAL</p></body>
88</html>