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=windows-1252">
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
14<H2>C Specification</H2>
15<DL>
16  <DD>
17  <PRE><code>#include &lt;revolution/wpad.h&gt;
18
19#define WPAD_CHAN0                    0
20#define WPAD_CHAN1                    1
21#define WPAD_CHAN2                    2
22#define WPAD_CHAN3                    3
23
24#define WPAD_BATTERY_LEVEL_CRITICAL   0
25#define WPAD_BATTERY_LEVEL_LOW        1
26#define WPAD_BATTERY_LEVEL_MEDIUM     2
27#define WPAD_BATTERY_LEVEL_HIGH       3
28#define WPAD_BATTERY_LEVEL_MAX        4
29
30#define WPAD_LED_CHAN_1             0x1
31#define WPAD_LED_CHAN_2             0x2
32#define WPAD_LED_CHAN_3             0x4
33#define WPAD_LED_CHAN_4             0x8
34
35
36typedef struct WPADInfo
37{
38<table>
39    <tr><td width="75"><code>BOOL</code></td><td><code> dpd;</code></td></tr>
40    <tr><td width="75"><code>BOOL</code></td><td><code> speaker;</code></td></tr>
41    <tr><td width="75"><code>BOOL</code></td><td><code> attach;</code></td></tr>
42    <tr><td width="75"><code>BOOL</code></td><td><code> lowBat;</code></td></tr>
43    <tr><td width="75"><code>u8</code></td><td><code>   battery;</code></td></tr>
44    <tr><td width="75"><code>u8</code></td><td><code>   led;</code></td></tr>
45    <tr><td width="75"><code>u8</code></td><td><code>   protocol;</code></td></tr>
46    <tr><td width="75"><code>u8</code></td><td><code>   firmware;</code></td></tr>
47</table>
48}
49
50typedef void (*WPADCallback) ( s32 chan, s32 result );
51
52s32 WPADGetInfoAsync( s32 chan, WPADInfo *info, WPADCallback callback );
53</code></PRE>
54</DL>
55<H2>Arguments</H2>
56<TABLE border="1">
57  <TBODY>
58    <TR>
59<TD width="120" bgcolor="#ffffe8"><code><b><i>chan</i></b></code></TD>
60<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
61    </TR>
62    <TR>
63<TD width="120" bgcolor="#ffffe8"><code><b><i>info</i></b></code></TD>
64<TD>A pointer to <code>WPADInfo</code> that copies the obtained information.</TD>
65    </TR>
66    <TR>
67<TD width="120" bgcolor="#ffffe8"><code><b><i>info</i></b></code></TD>
68<TD>Callback function to report on the result.</TD>
69    </TR>
70  </TBODY>
71</TABLE>
72<H2>Return Values</H2>
73<p>
74Returns one of the following codes:
75</p>
76<p>
77<code>WPAD_ERR_NONE</code><br> <code>WPAD_ERR_NO_CONTROLLER</code><br> <code>WPAD_ERR_BUSY</code><br>
78</P>
79<H2>Description</H2>
80<p>
81Gets 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.
82</p>
83<p>
84Can get the following status types.
85</p>
86<table border="1">
87<tr><td><code>dpd</code></td><td>The pointer's operational status.</td>
88<tr><td><code>speaker</code></td><td>The speaker's operational status.</td>
89<tr><td><code>attach</code></td><td>External extension controller connection status.</td>
90<tr><td><code>lowBat</code></td><td>This indicates whether the battery charge has dropped below a certain level and the indicator has dimmed.</td>
91<tr><td><code>battery</code></td><td>The battery level, indicated on a scale of five  (<code>WPAD_BATTERY_LEVEL_*</code>).</td>
92<tr><td><code>led</code></td><td>The illumination status (<code>WPAD_LED_CHAN_*</code>) of the four player indicators.</td>
93<tr><td><code>protocol</code></td><td>Not used.</td>
94<tr><td><code>firmware</code></td><td>Not used.</td>
95</table>
96<p>
97The return values have the following meanings:
98</p>
99<table border="1">
100<tr><td><code>WPAD_ERR_NONE</code></td><td>The WPAD library received a command.</td>
101<tr><td><code>WPAD_ERR_BUSY</code></td><td>The WPAD library was unable to receive a command.</td>
102<tr><td><code>WPAD_ERR_NO_CONTROLLER</code></td><td>The connection was broken.</td>
103</table>
104<p>
105In addition, if a callback function is set, the callback function returns the following error codes when the processing is complete. Their meanings are as follows:
106</p>
107<table border="1">
108<tr><td><code>WPAD_ERR_NONE</code></td><td>Status was retrieved normally.</td></tr>
109<tr><td><code>WPAD_ERR_BUSY</code></td><td>The WPAD library was unable to receive a command. Call it again later.</td></tr>
110<tr><td><code>WPAD_ERR_TRANSFER</code></td><td>A communications error prevented normal processing of the command.</td></tr>
111<tr><td><code>WPAD_ERR_NO_CONTROLLER</code></td><td>The connection was broken.</td></tr>
112</table>
113
114<H2>See Also</H2>
115<p>
116<A href="./toc.html" target="contents">WPAD Functions</A><br> <A href="./WPADGetInfo.html"><CODE>WPADGetInfo</CODE></A>, <A href="./WPADInfo.html"><CODE>WPADInfo</CODE></A><br>
117</p>
118
119<H2>Revision History</H2>
120<p>
1212006/11/29 Added <CODE>WPAD_ERR_BUSY</CODE>, which had been left out from the list, to 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 the See Also section.<br>2006/06/19 Initial version.<br>
122</p>
123<hr>
124<P>CONFIDENTIAL</p>
125</BODY>
126</HTML>