xwiimote  1
xwiimote.h File Reference

Main libxwiimote API. More...

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  xwii_event_key
 Key Event Payload. More...
 
struct  xwii_event_abs
 Absolute Motion Payload. More...
 
union  xwii_event_union
 Event Payload. More...
 
struct  xwii_event
 Event Object. More...
 

Macros

#define XWII__DEPRECATED
 
#define XWII__NAME   "Nintendo Wii Remote"
 
#define XWII_NAME_CORE   XWII__NAME
 Name of the core input device.
 
#define XWII_NAME_ACCEL   XWII__NAME " Accelerometer"
 Name of the accelerometer input device.
 
#define XWII_NAME_IR   XWII__NAME " IR"
 Name of the IR input device.
 
#define XWII_NAME_MOTION_PLUS   XWII__NAME " Motion Plus"
 Name of the motion-plus input device.
 
#define XWII_NAME_NUNCHUK   XWII__NAME " Nunchuk"
 Name of the nunchuk input device.
 
#define XWII_NAME_CLASSIC_CONTROLLER   XWII__NAME " Classic Controller"
 Name of the classic-controller input device.
 
#define XWII_NAME_BALANCE_BOARD   XWII__NAME " Balance Board"
 Name of the balance-board input device.
 
#define XWII_NAME_PRO_CONTROLLER   XWII__NAME " Pro Controller"
 Name of the pro-controller input device.
 
#define XWII_LED(num)   (XWII_LED1 + (num) - 1)
 Create enum xwii_led constants during runtime. More...
 

Enumerations

enum  xwii_event_types {
  XWII_EVENT_KEY,
  XWII_EVENT_ACCEL,
  XWII_EVENT_IR,
  XWII_EVENT_BALANCE_BOARD,
  XWII_EVENT_MOTION_PLUS,
  XWII_EVENT_PRO_CONTROLLER_KEY,
  XWII_EVENT_PRO_CONTROLLER_MOVE,
  XWII_EVENT_WATCH,
  XWII_EVENT_NUM
}
 Event Types. More...
 
enum  xwii_event_keys {
  XWII_KEY_LEFT,
  XWII_KEY_RIGHT,
  XWII_KEY_UP,
  XWII_KEY_DOWN,
  XWII_KEY_A,
  XWII_KEY_B,
  XWII_KEY_PLUS,
  XWII_KEY_MINUS,
  XWII_KEY_HOME,
  XWII_KEY_ONE,
  XWII_KEY_TWO,
  XWII_KEY_X,
  XWII_KEY_Y,
  XWII_KEY_TL,
  XWII_KEY_TR,
  XWII_KEY_ZL,
  XWII_KEY_ZR,
  XWII_KEY_THUMBL,
  XWII_KEY_THUMBR,
  XWII_KEY_NUM
}
 Key Event Identifiers. More...
 
enum  xwii_iface_type {
  XWII_IFACE_CORE = 0x000001,
  XWII_IFACE_ACCEL = 0x000002,
  XWII_IFACE_IR = 0x000004,
  XWII_IFACE_MOTION_PLUS = 0x000100,
  XWII_IFACE_NUNCHUK = 0x000200,
  XWII_IFACE_CLASSIC_CONTROLLER = 0x000400,
  XWII_IFACE_BALANCE_BOARD = 0x000800,
  XWII_IFACE_PRO_CONTROLLER = 0x001000,
  XWII_IFACE_ALL,
  XWII_IFACE_WRITABLE = 0x010000
}
 Interfaces. More...
 
enum  xwii_led {
  XWII_LED1 = 1,
  XWII_LED2 = 2,
  XWII_LED3 = 3,
  XWII_LED4 = 4
}
 LEDs. More...
 

Functions

int xwii_iface_new (struct xwii_iface **dev, const char *syspath)
 Create new device object from syspath path. More...
 
void xwii_iface_ref (struct xwii_iface *dev)
 Increase ref-count by 1. More...
 
void xwii_iface_unref (struct xwii_iface *dev)
 Decrease ref-count by 1. More...
 
int xwii_iface_get_fd (struct xwii_iface *dev)
 Return file-descriptor. More...
 
int xwii_iface_watch (struct xwii_iface *dev, bool watch)
 Watch device for hotplug events. More...
 
int xwii_iface_open (struct xwii_iface *dev, unsigned int ifaces)
 Open interfaces on this device. More...
 
void xwii_iface_close (struct xwii_iface *dev, unsigned int ifaces)
 Close interfaces on this device. More...
 
unsigned int xwii_iface_opened (struct xwii_iface *dev)
 Return bitmask of opened interfaces. More...
 
unsigned int xwii_iface_available (struct xwii_iface *dev)
 Return bitmask of available interfaces. More...
 
XWII__DEPRECATED int xwii_iface_poll (struct xwii_iface *dev, struct xwii_event *ev)
 Read incoming event-queue. More...
 
int xwii_iface_dispatch (struct xwii_iface *dev, struct xwii_event *ev, size_t size)
 Read incoming event-queue. More...
 
int xwii_iface_rumble (struct xwii_iface *dev, bool on)
 Toggle rumble motor. More...
 
int xwii_iface_get_led (struct xwii_iface *dev, unsigned int led, bool *state)
 Read LED state. More...
 
int xwii_iface_set_led (struct xwii_iface *dev, unsigned int led, bool state)
 Set LED state. More...
 
int xwii_iface_get_battery (struct xwii_iface *dev, uint8_t *capacity)
 Read battery state. More...
 
int xwii_iface_get_devtype (struct xwii_iface *dev, char **devtype)
 Read device type. More...
 
int xwii_iface_get_extension (struct xwii_iface *dev, char **extension)
 Read extension type. More...
 
void xwii_iface_set_mp_normalization (struct xwii_iface *dev, int32_t x, int32_t y, int32_t z, int32_t factor)
 Set MP normalization and calibration. More...
 
void xwii_iface_get_mp_normalization (struct xwii_iface *dev, int32_t *x, int32_t *y, int32_t *z, int32_t *factor)
 Read MP normalization and calibration. More...
 
struct xwii_monitor * xwii_monitor_new (bool poll, bool direct)
 Create a new monitor. More...
 
void xwii_monitor_ref (struct xwii_monitor *mon)
 Increase monitor ref-count by 1. More...
 
void xwii_monitor_unref (struct xwii_monitor *mon)
 Decrease monitor ref-count by 1. More...
 
int xwii_monitor_get_fd (struct xwii_monitor *monitor, bool blocking)
 Return internal fd. More...
 
char * xwii_monitor_poll (struct xwii_monitor *monitor)
 Read incoming events. More...
 

Detailed Description

Main libxwiimote API.

This file defines the public libxwiimote API and ABI. All identifiers are prefixed either with XWII_ or xwii_. Note that all identifiers prefixed with a double-underscore (XWII__ or xwii__) are not part of the stable ABI and may change at any time.