src/io_nix.c File Reference

Handles device I/O for *nix. More...

#include
#include
#include
#include
#include
#include
#include
#include "definitions.h"
#include "wiiuse_internal.h"
#include "io.h"

Include dependency graph for io_nix.c:


Functions

static int  wiiuse_connect_single (struct wiimote_t *wm, char *address)
  Connect to a wiimote with a known address.
int  wiiuse_find (struct wiimote_t **wm, int max_wiimotes, int timeout)
  Find a wiimote or wiimotes.
int  wiiuse_connect (struct wiimote_t **wm, int wiimotes)
  Connect to a wiimote or wiimotes once an address is known.
void  wiiuse_disconnect (struct wiimote_t *wm)
  Disconnect a wiimote.
int  wiiuse_io_read (struct wiimote_t *wm)
int  wiiuse_io_write (struct wiimote_t *wm, byte *buf, int len)

Detailed Description

Handles device I/O for *nix.


Function Documentation

int wiiuse_connect ( struct wiimote_t **  wm,
int  wiimotes  
)

Connect to a wiimote or wiimotes once an address is known.

Parameters:
wm  An array of wiimote_t structures.
wiimotes  The number of wiimote structures in wm.
Returns:
The number of wiimotes that successfully connected.
See also:
wiiuse_find()

wiiuse_connect_single()

wiiuse_disconnect()

Connect to a number of wiimotes when the address is already set in the wiimote_t structures. These addresses are normally set by the wiiuse_find() function, but can also be set manually.

static int wiiuse_connect_single ( struct wiimote_t wm,
char *  address  
) [static]

Connect to a wiimote with a known address.

Parameters:
wm  Pointer to a wiimote_t structure.
address  The address of the device to connect to. If NULL, use the address in the struct set by wiiuse_find().
Returns:
1 on success, 0 on failure

void wiiuse_disconnect ( struct wiimote_t wm  ) 

Disconnect a wiimote.

Parameters:
wm  Pointer to a wiimote_t structure.
See also:
wiiuse_connect()
Note that this will not free the wiimote structure.

int wiiuse_find ( struct wiimote_t **  wm,
int  max_wiimotes,
int  timeout  
)

Find a wiimote or wiimotes.

Parameters:
wm  An array of wiimote_t structures.
max_wiimotes  The number of wiimote structures in wm.
timeout  The number of seconds before the search times out.
Returns:
The number of wiimotes found.
See also:
wiimote_connect()
This function will only look for wiimote devices.
When a device is found the address in the structures will be set.
You can then call wiimote_connect() to connect to the found
devices.


Generated on Wed Apr 2 19:30:09 2008 for wiiuse by  doxygen 1.5.4