xbmc
|
Example using the wiiuse API. More...
Macros | |
#define | MAX_WIIMOTES 4 |
Functions | |
void | handle_event (struct wiimote_t *wm) |
Callback that handles an event. More... | |
void | handle_read (struct wiimote_t *wm, byte *data, unsigned short len) |
Callback that handles a read event. More... | |
void | handle_ctrl_status (struct wiimote_t *wm) |
Callback that handles a controller status event. More... | |
void | handle_disconnect (wiimote *wm) |
Callback that handles a disconnection event. More... | |
void | test (struct wiimote_t *wm, byte *data, unsigned short len) |
int | main (int argc, char **argv) |
main() More... | |
Example using the wiiuse API.
This file is an example of how to use the wiiuse library.
void handle_ctrl_status | ( | struct wiimote_t * | wm | ) |
Callback that handles a controller status event.
wm | Pointer to a wiimote_t structure. |
attachment | Is there an attachment? (1 for yes, 0 for no) |
speaker | Is the speaker enabled? (1 for yes, 0 for no) |
ir | Is the IR support enabled? (1 for yes, 0 for no) |
led | What LEDs are lit. |
battery_level | Battery level, between 0.0 (0%) and 1.0 (100%). |
This occurs when either the controller status changed or the controller status was requested explicitly by wiiuse_status().
One reason the status can change is if the nunchuk was inserted or removed from the expansion port.
void handle_disconnect | ( | wiimote * | wm | ) |
void handle_event | ( | struct wiimote_t * | wm | ) |
void handle_read | ( | struct wiimote_t * | wm, |
byte * | data, | ||
unsigned short | len | ||
) |
Callback that handles a read event.
wm | Pointer to a wiimote_t structure. |
data | Pointer to the filled data block. |
len | Length in bytes of the data block. |
This function is called automatically by the wiiuse library when the wiimote has returned the full data requested by a previous call to wiiuse_read_data().
You can read data on the wiimote, such as Mii data, if you know the offset address and the length.
The data pointer was specified on the call to wiiuse_read_data(). At the time of this function being called, it is not safe to deallocate this buffer.
int main | ( | int | argc, |
char ** | argv | ||
) |
Connect to up to two wiimotes and print any events that occur on either device.