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>GetSleepNotificationState</title> 8 </head> 9 <body> 10<h1><CODE>nn::applet::CTR::GetSleepNotificationState</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14<a href="../../../nn/applet/CTR/SleepNotificationState.html">AppletSleepNotificationState</a> GetSleepNotificationState( 15 void 16); 17</pre> 18 </div> 19<h2>Arguments</h2> 20 <div class="section"> 21<p>None.</p> 22 </div> 23<h2>Return Values</h2> 24<div class="section">Returns the state. </div> 25<h2>Description</h2> 26 <div class="section"> 27<p>Gets the sleep notification state.</p><!-- write here --><P> 28This function may return the following values to the application. 29</P><TABLE><THEAD><TR><TH>Value</TH><TH>Description</TH></TR></THEAD><TR><TD>applet::NOTIFY_NONE</TD><TD>Normal Use</TD></TR><TR><TD>applet::NOTIFY_SLEEP_QUERY</TD><TD>After <CODE>SLEEP_QUERY</CODE> notification (deferred).</TD></TR><TR><TD>applet::NOTIFY_SLEEP_ACCEPT</TD><TD>After <CODE>SLEEP_QUERY</CODE> notification (accepted).</TD></TR><TR><TD>applet::NOTIFY_SLEEP_REJECT</TD><TD>After <CODE>SLEEP_QUERY</CODE> notification (rejected).</TD></TR><TR><TD>applet::NOTIFY_SLEEP_ACCEPTED</TD><TD>After <CODE>SLEEP</CODE> confirmed.</TD></TR><TR><TD>applet::NOTIFY_AWAKE</TD><TD>After <CODE>AWAKE</CODE> notification.</TD></TR></TABLE><P> 30This function returns <CODE>applet::NOTIFY_SLEEP_QUERY</CODE> when the application's sleep query callback returned <CODE>applet::REPLY_LATER</CODE>. 31</P><P> 32In this case, <FONT color="red">the <a href="../../../nn/applet/CTR/ReplySleepQuery.html"><CODE>ReplySleepQuery</CODE></a> function must immediately return either <CODE>nn::applet::CTR::REPLY_ACCEPT</CODE> or <CODE>nn::applet::CTR::REPLY_REJECT</CODE>.</FONT></P><P> 33This function returns <CODE>applet::NOTIFY_SLEEP_ACCEPT</CODE> when the query callback return value or the <a href="../../../nn/applet/CTR/ReplySleepQuery.html"><CODE>nn::applet::CTR:ReplySleepQuery</CODE></a> return value is <CODE>applet::REPLY_ACCEPT</CODE>. 34</P><P> 35This function returns <CODE>applet::NOTIFY_SLEEP_REJECT</CODE> when the query callback return value or the <a href="../../../nn/applet/CTR/ReplySleepQuery.html"><CODE>nn::applet::CTR:ReplySleepQuery</CODE></a> return value is <CODE>applet::REPLY_REJECT</CODE>. 36</P><P> 37This function returns <CODE>applet::NOTIFY_SLEEP_ACCEPTED</CODE> when all applications and applets reply "accept" to the sleep query and confirm sleep mode. However, in such cases, the system immediately transitions to sleep mode, so it is almost impossible to actually use this value in the application. 38</P><P> 39This function returns <CODE>applet::NOTIFY_AWAKE</CODE> after the system wakes up and the <CODE>AWAKE</CODE> callback is called. 40</P><P>This function returns <CODE>applet::NOTIFY_NONE</CODE> after a call to the <a href="../../../nn/applet/CTR/ClearSleepNotificationState.html"><CODE>nn::applet::CTR::ClearSleepNotificationState</CODE></a> function. 41</P><P> 42This function is intended to be used to check if the application needs to reply to sleep queries using the main thread. The API also includes the inline <a href="../../../nn/applet/CTR/IsExpectedToReplySleepQuery.html"><CODE>nn::applet::CTR::IsExpectedToReplySleepQuery</CODE></a> function for this purpose. That function simply checks whether the sleep notification state is <CODE>NOTIFY_SLEEP_QUERY</CODE>. 43</P><PRE> 44 Example 45 // Okay to write this way too: 46 if ( applet::GetSleepNotificationState() == applet::NOTIFY_SLEEP_QUERY ) 47 { 48 applet::ReplySleepQuery( applet::REPLY_ACCEPT ); 49 awakeEvent.Wait(); // Sleep 50 } 51 // Or write it this way: 52 if ( applet::IsExpectedToReplySleepQuery() ) 53 { 54 applet::ReplySleepQuery( applet::REPLY_ACCEPT ); 55 awakeEvent.Wait(); // Sleep 56 } 57</PRE></div> 58<h2>Revision History</h2> 59 <div class="section"> 60 <dl class="history"> 61 <dt>2010/12/22</dt> 62<dd>Corrected mistakes.<br /> 63 </dd> 64 <dt>2010/12/01</dt> 65<dd>Added details about return values.<br /> 66 </dd> 67 <dt>2010/11/10</dt> 68<dd>Initial version.<br /> 69 </dd> 70 </dl> 71 </div> 72 <hr><p>CONFIDENTIAL</p></body> 73</html> 74