WPADSetConnectCallback

Syntax

#include <revolution/wpad.h>

#define WPAD_CHAN0                 0
#define WPAD_CHAN1                 1
#define WPAD_CHAN2                 2
#define WPAD_CHAN3                 3

#define WPAD_ERR_NONE              0
#define WPAD_ERR_NO_CONTROLLER    -1
#define WPAD_ERR_BUSY             -2

typedef void (* WPADConnectCallback )( s32 chan, s32 reason );

WPADConnectCallback WPADSetConnectCallback( s32 chan, WPADConnectCallback callback );

Arguments

chan One of the WPAD_CHANn values.
callback The callback function that notifies whether the Wii Remote for the specified channel was connected or disconnected.

Return Values

Pointer to the most recently registered callback function.

Description

Registers the callback function that gives notification when a Wii Remote or Wii Balance Board was connected or disconnected to the specified channel. If NULL is specified, no notifications are made until the callback is reset.

When a Wii Remote or Wii Balance Board has been connected, the callback argument reason passes WPAD_ERR_NONE to the callback function; at disconnection, it passes WPAD_ERR_NO_CONTROLLER.

The callback function registered through this function will be cleared by the WPADInit function. However, it will not be cleared when the Wii controller is connected or reconnected or when an External Extension Controller is connected or removed. After the WPADInit function has been called, the WPADGetStatus function can be called on WPAD_STATE_SETUP. To obtain the connection immediately after the library initialization with a callback, register a callback function at this time.

Use the WPADProbe function to check whether a Wii Remote or a Wii Balance Board was connected.

See Also

WPADInit, WPADProbe

Revision History

2008/04/16 Added description of the Wii Balance Board.
2006/10/23 Added a description for the connection event immediately after library initialization completes.
2006/09/18 Added mention of the fact that the function will be cleared after the WPADInit function is called.
2006/06/19 Initial version.


CONFIDENTIAL