nn::applet::CTR::IsExpectedToProcessPowerButton Function
bool IsExpectedToProcessPowerButton(
void
);
None.
true indicates that the POWER Button was clicked and a value of false indicates that it was not. Finds the state of the POWER Button.
A return value of true indicates that the POWER Button was pressed. In this case, the application must immediately call the nn::applet::CTR::ProcessPowerButton function and then wait with the nn::applet::CTR::WaitForStarting function.
A value of false indicates that a POWER Button press was not detected. In this case, do nothing.
Call this function periodically (usually every frame).
Example
if ( applet::IsExpectedToProcessPowerButton() )
{
applet::DisableSleep();
// POWER Button processing (transition to HOME Menu)
applet::ProcessPowerButton();
// Wait
applet::WaitForStarting();
if ( applet::IsExpectedToCloseApplication() ) // Probably 'true'
{
_close_application();
}
// Control is unlikely to reach this point, so the lines below here can be omitted
applet::EnableSleep();
}
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.
We 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.
DisableSleep and EnableSleep functions.CONFIDENTIAL