nn::applet::CTR::AppletHomeButtonCallback Type

Syntax

typedef bool(* nn::applet::CTR::AppletHomeButtonCallback)(uptr arg, bool isActive, nn::applet::CTR::HomeButtonState state);

Description

The type of the callback function invoked when HOME is pressed.

The callback is called when a HOME Button press is detected.

Use the nn::applet::CTR::SetHomeButtonCallback function to set the callback.

The value specified in arg is passed as-is when setting the callback. Use as appropriate.

The isActive argument specifies whether the application is active. A value of true means the application is active.

The state argument specifies the HOME Button state. This is similar to the value obtained by calling the nn::applet::CTR::GetHomeButtonState function.

The return value determines whether to enable detection of HOME Button presses. A return value of false disables HOME Button detection. The return value should generally be the same as for isActive.

Use as shown in the example below.

  Example
  bool myHomeButtonCallback( uptr arg, bool isActive, applet::HomeButtonState state )
  {
      NN_UNUSED_VAR(arg);
      if ( isActive )
      {
          if ( state == applet::HOME_BUTTON_SINGLE_PRESSED )
          {
             NN_LOG("HOME BUTTON is clicked.\n");
          }
          else
          {
             NN_LOG("HOME BUTTON is double-clicked.\n");
          }
          return true;
      }
      else
      {
          return false;
      }
  }
  nnMain()
  {
      applet::SetHomeButtonCallback( myHomeButtonCallback, 0 );
         …
  }

Revision History

2010/12/01
Added details.
2010/11/10
Initial version.

CONFIDENTIAL