1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=utf-8">
5<META http-equiv="Content-Style-Type" content="text/css">
6<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
7<TITLE>WPADGetInfoAsync</TITLE>
8</HEAD>
9<BODY>
10
11<H1>WPADGetInfoAsync</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/wpad.h&gt;
16
17#define WPAD_CHAN0               0
18#define WPAD_CHAN1               1
19#define WPAD_CHAN2               2
20#define WPAD_CHAN3               3
21
22#define WPAD_BATTERY_LEVEL_CRITICAL   0
23#define WPAD_BATTERY_LEVEL_LOW        1
24#define WPAD_BATTERY_LEVEL_MEDIUM     2
25#define WPAD_BATTERY_LEVEL_HIGH       3
26#define WPAD_BATTERY_LEVEL_MAX        4
27
28#define WPAD_LED_CHAN_1             0x1
29#define WPAD_LED_CHAN_2             0x2
30#define WPAD_LED_CHAN_3             0x4
31#define WPAD_LED_CHAN_4             0x8
32
33
34typedef struct WPADInfo
35{
36    BOOL dpd;
37    BOOL speaker;
38    BOOL attach;
39    BOOL lowBat;
40    BOOL nearempty;
41    u8 battery;
42    u8 led;
43    u8 protocol;
44    u8 firmware;
45}
46
47typedef void (*WPADCallback) ( s32 chan, s32 result );
48
49s32 WPADGetInfoAsync( s32 chan, WPADInfo *info, WPADCallback callback );
50</pre></dd></dl>
51
52<H2>Arguments</H2>
53<TABLE class="arguments" border="1" >
54  <TBODY>
55    <TR>
56<TH>chan</TH>
57<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
58    </TR>
59    <TR>
60<TH>info</TH>
61<TD>A pointer to <code>WPADInfo</code> that copies the obtained information.</TD>
62    </TR>
63    <TR>
64<TH>info</TH>
65<TD>Callback function to report on the result.</TD>
66    </TR>
67  </TBODY>
68</TABLE>
69
70<H2>Return Values</H2>
71<p>
72Returns one of the following codes:
73</p>
74<p>
75<code>WPAD_ERR_NONE</code><br> <code>WPAD_ERR_NO_CONTROLLER</code><br> <code>WPAD_ERR_BUSY</code><br>
76</P>
77
78<H2>Description</H2>
79<p>
80Gets 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.
81</p>
82<p>
83<font color="red">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.</font>
84</p>
85<p>
86Can get the following status types.
87</p>
88<TABLE class="arguments" border="1" >
89<tr><th>dpd</th><td>The Pointer's operational status.</td>
90<tr><th>speaker</th><td>The speaker's operational status.</td>
91<tr><th>attach</th><td>External extension controller connection status.</td>
92<tr><th>lowBat</th><td>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 <code>WPAD_BATTERY_LEVEL_LOW</code>, but the brightness will not be restored immediately even if the battery level changes to <code>WPAD_BATTERY_LEVEL_MEDIUM</code> afterwards.</td>
93<tr><th>nearempty</th><td>Whether there is a small amount of audio data left in the sound buffer.</td>
94<tr><th>battery</th><td>The battery level, indicated on a scale of five (<code>WPAD_BATTERY_LEVEL_*</code>). Indicates how much battery charge currently remains.</td>
95<tr><th>led</th><td>The illumination status (<code>WPAD_LED_CHAN_*</code>) of the four Player Indicators.</td>
96<tr><th>protocol</th><td>Not used.</td>
97<tr><th>firmware</th><td>Not used.</td>
98</table>
99<p>
100The return values have the following meanings:
101</p>
102<TABLE class="arguments" border="1" >
103<tr><th>WPAD_ERR_NONE</th><td>The WPAD library received a command.</td>
104<tr><th>WPAD_ERR_BUSY</th><td>The WPAD library was unable to receive a command.</td>
105<tr><th>WPAD_ERR_NO_CONTROLLER</th><td>The connection was broken.</td>
106</table>
107<p>
108When a callback function has been set, the callback function is called together with the processing result. When the return value is <code>WPAD_ERR_NONE</code>, 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.
109</p>
110<TABLE class="arguments" border="1" >
111<tr><th>WPAD_ERR_NONE</th><td>Status was retrieved normally.</td></tr>
112<tr><th>WPAD_ERR_BUSY</th><td>The WPAD library was unable to receive a command. Call it again later.</td></tr>
113<tr><th>WPAD_ERR_TRANSFER</th><td>A communications error prevented normal processing of the command.</td></tr>
114<tr><th>WPAD_ERR_NO_CONTROLLER</th><td>The connection was broken.</td></tr>
115</table>
116
117<H2>See Also</H2>
118<p class="reference">
119<!-- <A href="./toc.html" target="contents">WPAD関数</A>, --> <A href="./WPADGetInfo.html">WPADGetInfo</A><BR><A href="./WPADInfo.html">WPADInfo</A>
120</p>
121
122<H2>Revision History</H2>
123<p>
1242009/11/27 Added precaution regarding use while HOME menu is displaying.<br>2009/09/24 Explained the timing of the call to the callback function.<br>2008/07/08 Added explanations related to <span class="argument">lowBat</span> and <span class="argument">battery</span>.<br>2007/09/18 Added <SPAN class="argument">nearempty</SPAN> to <CODE>WPADInfo</CODE>.<br>2006/11/29 Added <CODE>WPAD_ERR_BUSY</CODE>, which had been left out of the error codes passed by the callback.<br>2006/09/06 Added <CODE>WPAD_BATTERY_LEVEL_CRITICAL</CODE>.<br>2006/08/15 Added <CODE>WPADInfo</CODE> to <B>See Also</B>.<br>2006/06/19 Initial version.<br>
125</p>
126<hr><p>CONFIDENTIAL</p></body>
127</HTML>