WPADSetConnectCallback

C Specification

#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
#define WPAD_ERR_TRANSFER         -3


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 notifies whether the Wii Remote for the specified channel was connected or disconnected. If NULL is specified, no notifications are made until reset.

When the Wii Remote is connected, WPAD_ERR_NONE is passed as the result argument that is passed to the callback function; at disconnection, WPAD_ERR_NO_CONTROLLER is passed.

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

See Also

WPAD Functions
WPADInit

Revision History

2006/10/23 Added description for the connection event immediately after the library initialization completion.
2006/09/18 Added mention that the function will be cleared after WPADInit function call.
2006/06/19 Initial version.


CONFIDENTIAL