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>WPADSetConnectCallback</TITLE>
9</HEAD>
10<BODY>
11
12<H1>WPADSetConnectCallback</H1>
13
14
15<H2>C Specification</H2>
16<DL>
17  <DD>
18  <PRE><code>#include &lt;revolution/wpad.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_ERR_NONE              0
26#define WPAD_ERR_NO_CONTROLLER    -1
27#define WPAD_ERR_BUSY             -2
28#define WPAD_ERR_TRANSFER         -3
29
30
31typedef void (* WPADConnectCallback )( s32 chan, s32 reason );
32
33WPADConnectCallback WPADSetConnectCallback( s32 chan, WPADConnectCallback callback );</code></PRE>
34</DL>
35<H2>Arguments</H2>
36<TABLE border="1">
37  <TBODY>
38    <TR>
39<TD width="120" bgcolor="#ffffe8"><code><b><i>chan</i></b></code></TD>
40<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
41    </TR>
42    <TR>
43<TD width="120" bgcolor="#ffffe8"><CODE><b><i>callback</i></b></CODE></TD>
44<TD>The callback function that notifies whether the Wii Remote for the specified channel was connected or disconnected.</TD>
45    </TR>
46  </TBODY>
47</TABLE>
48<H2>Return Values</H2>
49<P>Pointer to the most recently registered callback function.</P>
50<H2>Description</H2>
51<p>
52Registers 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.
53</p>
54<p>
55When the Wii Remote is connected, <code>WPAD_ERR_NONE</code> is passed as the <code>result</code> argument that is passed to the callback function; at disconnection, <code>WPAD_ERR_NO_CONTROLLER</code> is passed.
56</p>
57<p>
58The callback function registered through this function will be cleared by <a href="./WPADInit.html"><code>WPADInit</code></a>. 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 <a href="./WPADInit.html"><code>WPADInit</code></a> function call, the <a href="./WPADGetStatus.html"><code>WPADGetStatus</code></a> function can be called to <code>WPAD_STATE_SETUP</code>. To obtain the connection immediately after the library initialization with a callback, register a callback function at this time.
59</p>
60<H2>See Also</H2>
61<p>
62<A href="./toc.html" target="contents">WPAD Functions</A><br> <a href="./WPADInit.html"><code>WPADInit</code></a>
63</p>
64
65<H2>Revision History</H2>
66<p>
672006/10/23 Added description for the connection event immediately after the library initialization completion.<br>2006/09/18 Added mention that the function will be cleared after <a href="./WPADInit.html"><code>WPADInit</code></a> function call.<br>2006/06/19 Initial version.<br>
68</p>
69<hr>
70<P>CONFIDENTIAL</p>
71</BODY>
72</HTML>