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>WaitForStarting</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>::WaitForStarting</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14<a href="../../../nn/applet/CTR/WakeupState.html">AppletWakeupState</a> WaitForStarting( 15 <a href="../../../nn/applet/CTR/AppletId.html">AppletId</a> * pSenderId = NULL, 16 <a href="../../../nn_types/u8.html">u8</a> * pParam = NULL, 17 size_t paramSize = 0, 18 <a href="../../../nn_types/s32.html">s32</a> * pReadLen = NULL, 19 nn::Handle * pHandle = NULL, 20 <a href="../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> timeout = NN_APPLET_WAIT_INFINITE 21); 22</pre> 23 </div> 24<h2>Parameters</h2> 25 <div class="section"> 26 <table class="arguments"> 27 <thead> 28 <tr> 29 <td width="15" /> 30<th>Name</th> 31<td>Description</td> 32 </tr> 33 </thead> 34 <tr> 35<td>out</td> 36<th>pSenderId</th> 37<td>ID of the Applet that sent the event.</td> 38 </tr> 39 <tr> 40<td>out</td> 41<th>pParam</th> 42<td>Parameter buffer.</td> 43 </tr> 44 <tr> 45<td>in</td> 46<th>paramSize</th> 47<td>Parameter buffer size.</td> 48 </tr> 49 <tr> 50<td>out</td> 51<th>pReadLen</th> 52<td>Amount of data to read.</td> 53 </tr> 54 <tr> 55<td>out</td> 56<th>pHandle</th> 57<td>Handler.</td> 58 </tr> 59 <tr> 60<td>in</td> 61<th>timeout</th> 62<td>Timeout interval.</td> 63 </tr> </table> 64 </div> 65<h2>Return Values</h2> 66<div class="section">Returns the reason that processing was resumed. </div> 67<h2>Description</h2> 68 <div class="section"> 69<p>Waits for this object's start event.</p><!-- write here --><P> 70This function does not return until the start event is received. 71</P><P> 72This function returns a value from the <CODE>AppletWakeupState</CODE> enumerated type. You must use this value to determine what to do next (for example, whether to resume an application normally or close it). 73</P><P> 74However, because the <a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html"><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE></a> function returns a value of <CODE>true</CODE> when the application must be closed, <FONT color="red">always use <a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html"><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE></a> to make a decision immediately after this function returns</FONT> instead of simply checking this function's return value directly.</P><P> 75If the application is preparing to close based on the results of this check, then ignore the return value and obtained parameters from this function. 76</P><TABLE><THEAD><TR bgcolor="#ccccdd"><TH>Return Values</TH><TH>State</TH><TH>Expected Behavior</TH></TR></THEAD><TR><TD><CODE>applet::WAKEUP_SKIP</CODE></TD><TD>Skipped <CODE>WaitForStarting</CODE>.</TD><TD>Continues operating.</TD></TR><TR><TD><CODE>applet::WAKEUP_TO_START</CODE></TD><TD>Woken up by a normal request.</TD><TD>Continues operating.</TD></TR><TR><TD><CODE>applet::WAKEUP_BY_EXIT</CODE></TD><TD>Woken up by another applet closing.</TD><TD>Continues operating.</TD></TR><TR><TD><CODE>applet::WAKEUP_BY_PAUSE</CODE></TD><TD>Woken up by another applet pausing.</TD><TD>Continues operating.</TD></TR><TR><TD><CODE>applet::WAKEUP_BY_CANCEL</CODE></TD><TD>Woken up by a cancel notification.</TD><TD>Closes.</TD></TR><TR><TD><CODE>applet::WAKEUP_BY_POWER_BUTTON_CLICK</CODE></TD><TD>Woken up by a POWER Button press.</TD><TD>Closes.</TD></TR><TR><TD><CODE>applet::WAKEUP_BY_TIMEOUT</CODE></TD><TD>Woken up by timeout.</TD><TD>Context-dependent.</TD></TR></TABLE><P> 77The return values obtainable by the application are those listed above. 78</P><P> 79Example 80</P><PRE> 81 applet::WaitForStarting(); 82 if ( applet::IsExpectedToCloseApplication() ) 83 { 84 _application_finalize(); // Finalizing to release application resources 85 applet::PrepareToCloseApplication(); 86 applet::CloseApplication(); 87 // Execution doesn't reach this point. 88 } 89</PRE></div> 90<h2>Revision History</h2> 91 <div class="section"> 92 <dl class="history"> 93 <dt>2010/12/10</dt> 94<dd>Recommended use of the <CODE>IsExpectedToCloseApplication</CODE> function, rather than the return value, to make a decision. 95 </dd> 96 <dt>2010/11/30</dt> 97<dd>Added description of checking via <CODE>IsExpectedToCloseApplication</CODE>.<br /> 98 </dd> 99 <dt>2010/11/10</dt> 100<dd>Initial version.<br /> 101 </dd> 102 </dl> 103 </div> 104 <hr><p>CONFIDENTIAL</p></body> 105</html> 106