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 15<H2>C Specification</H2> 16<DL> 17 <DD> 18<PRE><code>#include <revolution/wpad.h> 19 20#define WPAD_CHAN0 0 21#define WPAD_CHAN1 1 22#define WPAD_CHAN2 2 23#define WPAD_CHAN3 3 24 25 26typedef void (* WPADExtensionCallback )( s32 chan, s32 result ); 27 28WPADExtensionCallback WPADSetExtensionCallback( s32 chan, WPADExtensionCallback callback );</code></PRE> 29</DL> 30<H2>Arguments</H2> 31<TABLE border="1"> 32 <TBODY> 33 <TR> 34<TD><code><b><i>chan</i></b></code></TD> 35<TD>One of <code>WPAD_CHAN<i>n</i></code> values.</TD> 36 </TR> 37 <TR> 38<TD><CODE><b><i>callback</i></b></CODE></TD> 39<TD>The callback function that notifies of an event when an external controller is inserted or removed.</TD> 40 </TR> 41 </TBODY> 42</TABLE> 43<H2>Return Values</H2> 44<P>Pointer to the most recently registered callback function.</P> 45<H2>Description</H2> 46<p> 47Registers the callback function that notifies events when an external extension controller is inserted into or removed from a Wii Remote at the specified channel. If NULL is specified, no notifications are made until reset. 48</p> 49<p> 50The device type is passed to the callback function's <code>result</code> argument. 51</p> 52<p> 53When an external controller is inserted, this callback is called twice. This is because it takes some time to recognize the device type of the inserted external controller. When an external 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. 54</p> 55<p> 56When the external controller is removed, this callback is called once and returned with <code>WPAD_DEV_CORE</code>. 57</p> 58<p> 59Be aware that callback functions registered by using this function will be cleared in the following circumstances. 60<ul> 61<li>Communication with the controller is lost</li> 62</ul> 63</p> 64<p> 65In addition, the callback functions are not cleared when a controller is connected, so they can be registered in advance. 66</p> 67 68<H2>See Also</H2> 69<p> 70<A href="./toc.html" target="contents"><CODE>WPAD Functions</CODE></A><br> 71</p> 72 73<H2>Revision History</H2> 74<p> 7508/15/2006 Removed statement that the callback is cleared when an external controller is plugged into or unplugged from the console.<br>06/19/2006 Initial version. 76</p> 77<hr> 78<P>CONFIDENTIAL</p> 79</BODY> 80</HTML>