1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<title>PMICOpenAsync</title>
9</head>
10
11<body>
12
13<h1>PMICOpenAsync</h1>
14
15<h2>Syntax</h2>
16<dl><dd><pre class="construction">
17#include &lt;revolution/pmic.h&gt;
18
19typedef void (*PMICCallback)(PMIC_ERR result, void* arg);
20
21PMIC_ERR PMICOpenAsync(PMICCallback cb, void* arg);
22</pre></dd></dl>
23
24<h2>Arguments</h2>
25<TABLE class="arguments" border="1" >
26  <tr>
27<th>cb</th>
28<td>Callback function that will send notification of the execution results of this function.</td>
29  </tr>
30  <tr>
31<th>arg</th>
32<td>Passed as the second argument of the callback function above.</td>
33  </tr>
34</TABLE>
35
36<h2>Return Values</h2>
37<p>
38Returns one of the following.
39</p>
40
41<TABLE class="arguments" border="1" >
42  <tr>
43<th><CODE>PMIC_ERR_OK</CODE></th>
44<td>The function has been called normally.</td>
45  </tr>
46  <tr>
47<th><CODE>PMIC_ERR_INVALID_STATE</CODE></th>
48<td>Either the PMIC library is not initialized, or the Wii Speak cable is not inserted in the USB port.</td>
49  </tr>
50  <tr>
51<th><CODE>PMIC_ERR_BUSY</CODE></th>
52<td>The state is in transition. Call the function again.</td>
53  </tr>
54  <tr>
55<th><CODE>PMIC_ERR_USB_ERROR</CODE></th>
56<td>An error occurred in USB communications. Call the function again.</td>
57  </tr>
58  <tr>
59<th><CODE>PMIC_ERR_FATAL</CODE></th>
60<td>A fatal error has occurred.</td>
61  </tr>
62</TABLE>
63
64<H2>Description</H2>
65<p>Opens the Wii Speak asynchronously.</p>
66
67<p>If the Wii Speak is successfully opened, its microphone transitions to the stopped state. You can set operating parameters, start the microphone, and perform various other operations on the Wii Speak while the microphone is stopped.</p>
68
69<p>The library prepares to recognize the Wii Speak by calling the <CODE>PMICProbe</CODE> function first after calling the <CODE>PMICInit</CODE> function. Therefore, after calling the <code>PMICInit</code> function, always call the <code>PMICProbe</code> function once before calling this function.</p>
70
71<p>Also, even if the Wii Speak is connected, if you call this function before the library recognizes the Wii Speak and <code>PMIC_ERR_OK</code> is returned for the <code>PMICProbe</code> function, this function returns <code>PMIC_ERR_INVALID_STATE</code> (in rare cases, <code>PMIC_ERR_BUSY</code>). In such cases, call this function after waiting a while until the <code>PMIC_ERR_OK</code> value is returned for the <code>PMICProbe</code> function.</p>
72
73<p>One of the following is passed to <SPAN class="argument">result</SPAN>, the callback function's first argument.</p>
74
75<TABLE class="arguments" border="1" >
76  <tr>
77<th><CODE>PMIC_ERR_OK</CODE></th>
78<td>The Wii Speak has been opened successfully.</td>
79  </tr>
80  <tr>
81<th><CODE>PMIC_ERR_NO_DEVICE</CODE></th>
82<td>The Wii Speak has been unplugged.</td>
83  </tr>
84  <tr>
85<th><CODE>PMIC_ERR_USB_ERROR</CODE></th>
86<td>An error occurred in USB communications. Call the function again.</td>
87  </tr>
88  <tr>
89<th><CODE>PMIC_ERR_FATAL</CODE></th>
90<td>A fatal error has occurred.</td>
91  </tr>
92</TABLE>
93
94<p>After the Wii Speak is opened, the error notification callback registered by the <code>PMICRegisterErrorCallback</code> function is enabled.</p>
95
96<p><B>Note: Do not quit an application while the Wii Speak is still open. Always call the <code>PMICCloseAsync</code> or <code>PMICClose</code> function to close the Wii Speak before exiting an application.</B></p>
97
98<H2>See Also</H2>
99<p>
100<a href="PMICInit.html"><CODE>PMICInit</CODE></a><BR> <a href="PMICProbe.html"><CODE>PMICProbe</CODE></a><BR> <a href="PMICRegisterErrorCallback.html"><CODE>PMICRegisterErrorCallback</CODE></a><BR> <a href="PMICCloseAsync.html"><CODE>PMICCloseAsync</CODE></a><BR> <a href="PMICClose.html"><CODE>PMICClose</CODE></a>
101</p>
102
103<H2>Revision History</H2>
104<p>
1052009/06/17 Revised description related to calling the <code>PMICProbe</code> function.<br>2009/06/01 Added description related to calling <code>PMICProbe</code>.<br>2008/12/22 Changed the error codes.<BR>2008/11/04 Added <B>Description</B>.<br>2008/10/24 Revised <B>Description</B>.<br>2008/10/23 Revised <B>Description</B>.<br>2008/10/22 Added notes.<br>2008/09/25 Added a callback argument.<br>2008/03/04 Changed the function reference format.<br>2008/01/25 Initial version.
106</p>
107
108<hr><p>CONFIDENTIAL</p></body>
109
110</html>
111