nn::applet::CTR::Enable Function

Syntax

void Enable(
     bool isSleepEnabled = true
);

Arguments

Name Description
in isSleepEnabled This option specifies whether sleep is enabled.

Return Values

None.

Description

Enables features specific to the applet library.

You must always call this function. Calling this function enables the features provided by the Applet library.

Because the various callbacks are enabled immediately after this function is called, applications must configure each of the callbacks as quickly as possible and then call this function.

Specify true for the isSleepEnabled argument to have the function call nn::applet::CTR::EnableSleep(applet::NO_SHELL_CHECK) internally. In other words, this enables sleep notifications. However, the applet::NO_SHELL_CHECK argument indicates that when the nn::applet::CTR::EnableSleep function is called it does not check whether the system is closed. If you want to account for the possibility that that system may already be closed by that time, call nn::applet::CTR::EnableSleep(applet::SLEEP_IF_SHELL_CLOSED) immediately after this function.

Specify false for the isSleepEnabled argument to not enable sleep notifications. After this, call the nn::applet::CTR::EnableSleep function as appropriate.

This function calls nn::applet::CTR::WaitForStarting. Because you must determine whether to close the application when this function returns, call the nn::applet::CTR::IsExpectedToCloseApplication function after this one exits.

Example

  nnMain()
  {
      applet::SetSleepQueryCallback( mySleepQueryCallback, 0 );
      applet::SetAwakeCallback( myAwakeCallback, 0 );
      applet::Enable();
      if ( applet::IsExpectedToCloseApplication() ) // Check for a close request
      {
          _finalize_application();
          applet::PrepareToCloseApplication();
          applet::CloseApplication();
      }
      applet::EnableSleep( applet::SLEEP_IF_SHELL_CLOSED );
       ...

(NOTE)

When applications that do not call this function are run on a debugger, the following problems occur because the applications are running outside of the CTR system.

This second problem can be resolved by calling the nngxStartLcdDisplay function.

Revision History

2010/12/14
Added information related to determining whether to close the application. Added information on the EnableSleep function.
2010/11/30
Added example.
2010/11/15
Initial version.

CONFIDENTIAL