#include <revolution/wpad.h>
#define WPAD_CHAN0 0
#define WPAD_CHAN1 1
#define WPAD_CHAN2 2
#define WPAD_CHAN3 3
#define WPAD_BATTERY_LEVEL_CRITICAL 0
#define WPAD_BATTERY_LEVEL_LOW 1
#define WPAD_BATTERY_LEVEL_MEDIUM 2
#define WPAD_BATTERY_LEVEL_HIGH 3
#define WPAD_BATTERY_LEVEL_MAX 4
#define WPAD_LED_CHAN_1 0x1
#define WPAD_LED_CHAN_2 0x2
#define WPAD_LED_CHAN_3 0x4
#define WPAD_LED_CHAN_4 0x8
typedef struct WPADInfo
{
BOOL dpd;
BOOL speaker;
BOOL attach;
BOOL lowBat;
BOOL nearempty;
u8 battery;
u8 led;
u8 protocol;
u8 firmware;
}
typedef void (*WPADCallback) ( s32 chan, s32 result );
s32 WPADGetInfoAsync( s32 chan, WPADInfo *info, WPADCallback callback );
| chan | One of the WPAD_CHANn values. |
|---|---|
| info | A pointer to WPADInfo that copies the obtained information. |
| info | Callback function to report on the result. |
Returns one of the following codes:
WPAD_ERR_NONE
WPAD_ERR_NO_CONTROLLER
WPAD_ERR_BUSY
Gets the status of the Wii Remote for the specified channel. This function registers the status-getting command in the WPAD library. The WPAD library processes registered commands when other commands are not running.
Problems may arise if this function is called too frequently. For example, sound may not play from the Wii remote speaker. This function is also used by the HOME Menu library, so be particularly careful about calling this function when the HOME Menu is displayed.
Can get the following status types.
| dpd | The Pointer's operational status. |
|---|---|
| speaker | The speaker's operational status. |
| attach | External extension controller connection status. |
| lowBat | Whether the indicator brightness is dropping. Voltages that change the indicator brightness exhibit hysteresis. Note that the brightness will drop when the battery level reaches WPAD_BATTERY_LEVEL_LOW, but the brightness will not be restored immediately even if the battery level changes to WPAD_BATTERY_LEVEL_MEDIUM afterwards. |
| nearempty | Whether there is a small amount of audio data left in the sound buffer. |
| battery | The battery level, indicated on a scale of five (WPAD_BATTERY_LEVEL_*). Indicates how much battery charge currently remains. |
| led | The illumination status (WPAD_LED_CHAN_*) of the four Player Indicators. |
| protocol | Not used. |
| firmware | Not used. |
The return values have the following meanings:
| WPAD_ERR_NONE | The WPAD library received a command. |
|---|---|
| WPAD_ERR_BUSY | The WPAD library was unable to receive a command. |
| WPAD_ERR_NO_CONTROLLER | The connection was broken. |
When a callback function has been set, the callback function is called together with the processing result. When the return value is WPAD_ERR_NONE, the callback function is called when the process is completed. Otherwise, it is called before the function escapes. The following error codes are passed to the callback function.
| WPAD_ERR_NONE | Status was retrieved normally. |
|---|---|
| WPAD_ERR_BUSY | The WPAD library was unable to receive a command. Call it again later. |
| WPAD_ERR_TRANSFER | A communications error prevented normal processing of the command. |
| WPAD_ERR_NO_CONTROLLER | The connection was broken. |
2009/11/27 Added precaution regarding use while HOME menu is displaying.
2009/09/24 Explained the timing of the call to the callback function.
2008/07/08 Added explanations related to lowBat and battery.
2007/09/18 Added nearempty to WPADInfo.
2006/11/29 Added WPAD_ERR_BUSY, which had been left out of the error codes passed by the callback.
2006/09/06 Added WPAD_BATTERY_LEVEL_CRITICAL.
2006/08/15 Added WPADInfo to See Also.
2006/06/19 Initial version.
CONFIDENTIAL