nn::applet::CTR::WaitForStarting FunctionAppletWakeupState WaitForStarting( AppletId * pSenderId = NULL, u8 * pParam = NULL, size_t paramSize = 0, s32 * pReadLen = NULL, nn::Handle * pHandle = NULL, nn::fnd::TimeSpan timeout = NN_APPLET_WAIT_INFINITE );
| Name | Description | |
|---|---|---|
| out | pSenderId | ID of the Applet that sent the event. |
| out | pParam | Parameter buffer. |
| in | paramSize | Parameter buffer size. |
| out | pReadLen | Amount of data to read. |
| out | pHandle | Handler. |
| in | timeout | Timeout interval. |
Waits for this object's start event.
This function does not return until the start event is received.
This function returns a value from the AppletWakeupState enumerated type. You must use this value to determine what to do next (for example, whether to resume an application normally or close it).
However, because the nn::applet::CTR::IsExpectedToCloseApplication function returns a value of true when the application must be closed, always use nn::applet::CTR::IsExpectedToCloseApplication to make a decision immediately after this function returns instead of simply checking this function's return value directly.
If the application is preparing to close based on the results of this check, then ignore the return value and obtained parameters from this function.
| Return Values | State | Expected Behavior |
|---|---|---|
applet::WAKEUP_SKIP | Skipped WaitForStarting. | Continues operating. |
applet::WAKEUP_TO_START | Woken up by a normal request. | Continues operating. |
applet::WAKEUP_BY_EXIT | Woken up by another applet closing. | Continues operating. |
applet::WAKEUP_BY_PAUSE | Woken up by another applet pausing. | Continues operating. |
applet::WAKEUP_BY_CANCEL | Woken up by a cancel notification. | Closes. |
applet::WAKEUP_BY_POWER_BUTTON_CLICK | Woken up by a POWER Button press. | Closes. |
applet::WAKEUP_BY_TIMEOUT | Woken up by timeout. | Context-dependent. |
The return values obtainable by the application are those listed above.
Example
applet::WaitForStarting();
if ( applet::IsExpectedToCloseApplication() )
{
_application_finalize(); // Finalizing to release application resources
applet::PrepareToCloseApplication();
applet::CloseApplication();
// Execution doesn't reach this point.
}
IsExpectedToCloseApplication function, rather than the return value, to make a decision.
IsExpectedToCloseApplication.CONFIDENTIAL