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>IsExpectedToProcessPowerButton</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>::IsExpectedToProcessPowerButton</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14bool IsExpectedToProcessPowerButton( 15 void 16); 17</pre> 18 </div> 19<h2>Parameters</h2> 20 <div class="section"> 21<p>None.</p> 22 </div> 23<h2>Return Values</h2> 24<div class="section">A value of <CODE>true</CODE> indicates that the POWER Button was clicked and a value of <CODE>false</CODE> indicates that it was not. </div> 25<h2>Description</h2> 26 <div class="section"> 27<p>Finds the state of the POWER Button.</p><!-- write here --><P> 28A return value of <CODE>true</CODE> indicates that the POWER Button was pressed. In this case, the application must immediately call the <a href="../../../nn/applet/CTR/ProcessPowerButton.html"><CODE>nn::applet::CTR::ProcessPowerButton</CODE></a> function and then wait with the <a href="../../../nn/applet/CTR/WaitForStarting.html"><CODE>nn::applet::CTR::WaitForStarting</CODE></a> function. 29</P><P> 30A value of <CODE>false</CODE> indicates that a POWER Button press was not detected. In this case, do nothing. 31</P><P> 32Call this function periodically (usually every frame). 33</P><P> 34Example 35</P><PRE> 36 if ( <FONT color="red">applet::IsExpectedToProcessPowerButton()</FONT> ) 37 { 38 applet::DisableSleep(); 39 40 // POWER Button processing (transition to HOME Menu) 41 applet::ProcessPowerButton(); 42 43 // Wait 44 applet::WaitForStarting(); 45 if ( applet::IsExpectedToCloseApplication() ) // Probably 'true' 46 { 47 _close_application(); 48 } 49 50 // Control is unlikely to reach this point, so the lines below here can be omitted 51 applet::EnableSleep(); 52 } 53</PRE><BR /><P><FONT COLOR="red">Although this function was planned for removal in SDK 0.14.9, it was determined to be necessary upon further review of the shutdown sequence for the POWER Button. Though this is inconvenient, it is required to implement POWER Button handling.</FONT></P><P> 54We have assumed that determination functions such as this one and the function for actually making the transition will be called successively in the same thread, but it is possible depending on the implementation to call them in different threads. However, be very careful that the determination thread does not continue executing after execution control is passed. 55</P></div> 56<h2>Revision History</h2> 57 <div class="section"> 58 <dl class="history"> 59 <dt>2012/11/09</dt> 60<dd>Added a note about calling the determination function and transition functions in different threads.<br /> 61 </dd> 62 <dt>2011/02/09</dt> 63<dd>Reworked for consistent terminology. 64 </dd> 65 <dt>2011/01/24</dt> 66<dd>Added mention of the <CODE>DisableSleep</CODE> and <CODE>EnableSleep</CODE> functions.<br /> 67 </dd> 68 <dt>2010/12/09</dt> 69<dd>This function was deemed necessary following a review of the shutdown sequence for the POWER Button. 70 </dd> 71 <dt>2010/11/10</dt> 72<dd>Initial version.<br /> 73 </dd> 74 </dl> 75 </div> 76 <hr><p>CONFIDENTIAL</p></body> 77</html> 78