PMICOpenAsync

Syntax

#include <revolution/pmic.h>

typedef void (*PMICCallback)(PMIC_ERR result, void* arg);

PMIC_ERR PMICOpenAsync(PMICCallback cb, void* arg);

Arguments

cb Callback function that will send notification of the execution results of this function.
arg Passed as the second argument of the callback function above.

Return Values

Returns one of the following.

PMIC_ERR_OK The function has been called normally.
PMIC_ERR_INVALID_STATE Either the PMIC library is not initialized, or the Wii Speak cable is not inserted in the USB port.
PMIC_ERR_BUSY The state is in transition. Call the function again.
PMIC_ERR_USB_ERROR An error occurred in USB communications. Call the function again.
PMIC_ERR_FATAL A fatal error has occurred.

Description

Opens the Wii Speak asynchronously.

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.

The library prepares to recognize the Wii Speak by calling the PMICProbe function first after calling the PMICInit function. Therefore, after calling the PMICInit function, always call the PMICProbe function once before calling this function.

Also, even if the Wii Speak is connected, if you call this function before the library recognizes the Wii Speak and PMIC_ERR_OK is returned for the PMICProbe function, this function returns PMIC_ERR_INVALID_STATE (in rare cases, PMIC_ERR_BUSY). In such cases, call this function after waiting a while until the PMIC_ERR_OK value is returned for the PMICProbe function.

One of the following is passed to result, the callback function's first argument.

PMIC_ERR_OK The Wii Speak has been opened successfully.
PMIC_ERR_NO_DEVICE The Wii Speak has been unplugged.
PMIC_ERR_USB_ERROR An error occurred in USB communications. Call the function again.
PMIC_ERR_FATAL A fatal error has occurred.

After the Wii Speak is opened, the error notification callback registered by the PMICRegisterErrorCallback function is enabled.

Note: Do not quit an application while the Wii Speak is still open. Always call the PMICCloseAsync or PMICClose function to close the Wii Speak before exiting an application.

See Also

PMICInit
PMICProbe
PMICRegisterErrorCallback
PMICCloseAsync
PMICClose

Revision History

2009/06/17 Revised description related to calling the PMICProbe function.
2009/06/01 Added description related to calling PMICProbe.
2008/12/22 Changed the error codes.
2008/11/04 Added Description.
2008/10/24 Revised Description.
2008/10/23 Revised Description.
2008/10/22 Added notes.
2008/09/25 Added a callback argument.
2008/03/04 Changed the function reference format.
2008/01/25 Initial version.


CONFIDENTIAL