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<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<TITLE>WPADSetExtensionCallback</TITLE>
9</HEAD>
10<BODY>
11
12<H1>WPADSetExtensionCallback</H1>
13
14<H2>Syntax</H2>
15<dl><dd><pre class="construction">
16#include &lt;revolution/wpad.h&gt;
17#include &lt;revolution/wpadGuitar.h&gt;
18#include &lt;revolution/wpadTrain.h&gt;
19
20#define WPAD_CHAN0                    0
21#define WPAD_CHAN1                    1
22#define WPAD_CHAN2                    2
23#define WPAD_CHAN3                    3
24
25#define WPAD_DEV_CORE                 0
26#define WPAD_DEV_FREESTYLE            1
27#define WPAD_DEV_CLASSIC              2
28#define WPAD_DEV_TRAIN               16
29#define WPAD_DEV_GUITAR              17
30#define WPAD_DEV_FUTURE             251
31#define WPAD_DEV_NOT_SUPPORTED      252
32#define WPAD_DEV_NOT_FOUND          253
33#define WPAD_DEV_UNKNOWN            255
34
35typedef void (* WPADExtensionCallback )( s32 chan, s32 result );
36
37WPADExtensionCallback WPADSetExtensionCallback( s32 chan, WPADExtensionCallback callback );
38</pre></dd></dl>
39
40<H2>Arguments</H2>
41<TABLE class="arguments" border="1" >
42  <TBODY>
43    <TR>
44<TH>chan</TH>
45<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
46    </TR>
47    <TR>
48<TH>callback</TH>
49<TD>The callback function that notifies of an event when an External Extension Controller is inserted or removed.</TD>
50    </TR>
51  </TBODY>
52</TABLE>
53
54<H2>Return Values</H2>
55<P>Pointer to the most recently registered callback function.</P>
56
57<H2>Description</H2>
58<p>
59Registers a callback function to be notified when an external extension controller is inserted into or removed from a Wii Remote on the specified channel. If <CODE>NULL</CODE> is specified, no notifications are made until reset. <font color="red"><B>Note:</B> The Wii Balance Board is not a Wii Remote external extension controller, so this function will not report Wii Balance Board events.</font>
60</p>
61<p>
62The device type is passed to the callback function's <SPAN class="argument">result</SPAN> argument.
63</p>
64<p>
65When an external extension controller is inserted, this callback is called twice. This is because it takes some time to recognize the device type of the inserted external extension controller. When an external extension controller is inserted, it is not immediately recognized and <code>WPAD_DEV_UNKNOWN</code> is returned with the callback. Once the device type is known, the callback is called again with the device type. If the controller is disconnected during the recognition process,  then <code>WPAD_DEV_NOT_FOUND</code> gets passed.
66</p>
67<p>
68When the external extension controller is removed, this callback is called once and returned with <code>WPAD_DEV_CORE</code>.
69</p>
70<p>
71Be aware that callback functions registered by using this function will be cleared in the following circumstances.
72</p>
73<ul>
74<li>Controller is connected</li>
75<li>Communication with the controller is lost</li>
76</ul>
77
78<H2>See Also</H2>
79<p>
80None.
81</p>
82
83<H2>Revision History</H2>
84<p>
852008/04/16 Added the Master Controller and Guitar Controller. Added a Note regarding the Wii Balance Board.<br>2006/10/05 Added mention that the buffer is cleared when a controller is connected.<br>2006/09/06 Added a description of the case when <CODE>WPAD_DEV_NOT_FOUND</CODE> is passed.<br>2006/08/15 Removed statement that the callback is cleared when an external extension controller is plugged into or unplugged from the console.<br>2006/06/19 Initial version.<br>
86</p>
87<hr><p>CONFIDENTIAL</p></body>
88</HTML>