Go to the documentation of this file.
7 #ifndef XWII_XWIIMOTE_H
8 #define XWII_XWIIMOTE_H
31 #define XWII__DEPRECATED __attribute__((__deprecated__))
33 #define XWII__DEPRECATED
310 #define XWII__NAME "Nintendo Wii Remote"
313 #define XWII_NAME_CORE XWII__NAME
315 #define XWII_NAME_ACCEL XWII__NAME " Accelerometer"
317 #define XWII_NAME_IR XWII__NAME " IR"
320 #define XWII_NAME_MOTION_PLUS XWII__NAME " Motion Plus"
322 #define XWII_NAME_NUNCHUK XWII__NAME " Nunchuk"
324 #define XWII_NAME_CLASSIC_CONTROLLER XWII__NAME " Classic Controller"
326 #define XWII_NAME_BALANCE_BOARD XWII__NAME " Balance Board"
328 #define XWII_NAME_PRO_CONTROLLER XWII__NAME " Pro Controller"
583 return abs->x != 1023 ||
abs->y != 1023;
690 #define XWII_LED(num) (XWII_LED1 + (num) - 1)
991 int32_t y, int32_t z, int32_t factor);
1013 int32_t *y, int32_t *z, int32_t *factor);
1038 struct xwii_monitor;
@ XWII_IFACE_NUNCHUK
Nunchuk extension interface.
Definition: xwiimote.h:651
void xwii_iface_close(struct xwii_iface *dev, unsigned int ifaces)
Close interfaces on this device.
int xwii_iface_new(struct xwii_iface **dev, const char *syspath)
Create new device object from syspath path.
Event Payload.
Definition: xwiimote.h:545
@ XWII_EVENT_WATCH
Hotplug Event.
Definition: xwiimote.h:444
XWII__DEPRECATED int xwii_iface_poll(struct xwii_iface *dev, struct xwii_event *ev)
Read incoming event-queue.
@ XWII_KEY_NUM
Number of key identifiers.
Definition: xwiimote.h:513
@ XWII_IFACE_ALL
Special flag ORed with all valid interfaces.
Definition: xwiimote.h:660
@ XWII_EVENT_NUM
Number of available event types.
Definition: xwiimote.h:452
union xwii_event_union v
data payload
Definition: xwiimote.h:570
int xwii_iface_get_extension(struct xwii_iface *dev, char **extension)
Read extension type.
xwii_led
LEDs.
Definition: xwiimote.h:677
@ XWII_EVENT_MOTION_PLUS
Motion-Plus event.
Definition: xwiimote.h:407
xwii_event_keys
Key Event Identifiers.
Definition: xwiimote.h:469
int xwii_iface_watch(struct xwii_iface *dev, bool watch)
Watch device for hotplug events.
@ XWII_IFACE_WRITABLE
Special flag which causes the interfaces to be opened writable.
Definition: xwiimote.h:669
@ XWII_IFACE_MOTION_PLUS
MotionPlus extension interface.
Definition: xwiimote.h:649
@ XWII_IFACE_IR
IR interface.
Definition: xwiimote.h:646
@ XWII_IFACE_CLASSIC_CONTROLLER
ClassicController extension interface.
Definition: xwiimote.h:653
@ XWII_KEY_THUMBL
Left thumb button.
Definition: xwiimote.h:495
int xwii_monitor_get_fd(struct xwii_monitor *monitor, bool blocking)
Return internal fd.
@ XWII_EVENT_KEY
Core-interface key event.
Definition: xwiimote.h:360
@ XWII_IFACE_PRO_CONTROLLER
ProController extension interface.
Definition: xwiimote.h:657
int xwii_iface_get_fd(struct xwii_iface *dev)
Return file-descriptor.
@ XWII_EVENT_PRO_CONTROLLER_MOVE
Pro-Controller movement event.
Definition: xwiimote.h:428
unsigned int code
key identifier defined as enum xwii_event_keys
Definition: xwiimote.h:523
int xwii_iface_set_led(struct xwii_iface *dev, unsigned int led, bool state)
Set LED state.
@ XWII_IFACE_ACCEL
Accelerometer interface.
Definition: xwiimote.h:644
void xwii_monitor_ref(struct xwii_monitor *mon)
Increase monitor ref-count by 1.
struct xwii_monitor * xwii_monitor_new(bool poll, bool direct)
Create a new monitor.
@ XWII_EVENT_IR
IR-Camera event.
Definition: xwiimote.h:385
Key Event Payload.
Definition: xwiimote.h:521
unsigned int xwii_iface_available(struct xwii_iface *dev)
Return bitmask of available interfaces.
int xwii_iface_get_led(struct xwii_iface *dev, unsigned int led, bool *state)
Read LED state.
@ XWII_IFACE_BALANCE_BOARD
BalanceBoard extension interface.
Definition: xwiimote.h:655
void xwii_iface_unref(struct xwii_iface *dev)
Decrease ref-count by 1.
int xwii_iface_get_devtype(struct xwii_iface *dev, char **devtype)
Read device type.
@ XWII_EVENT_ACCEL
Accelerometer event.
Definition: xwiimote.h:371
void xwii_iface_ref(struct xwii_iface *dev)
Increase ref-count by 1.
Absolute Motion Payload.
Definition: xwiimote.h:534
int xwii_iface_open(struct xwii_iface *dev, unsigned int ifaces)
Open interfaces on this device.
struct xwii_event_abs abs[4]
absolute motion event payload
Definition: xwiimote.h:549
xwii_iface_type
Interfaces.
Definition: xwiimote.h:640
unsigned int type
event type ref xwii_event_types
Definition: xwiimote.h:567
Event Object.
Definition: xwiimote.h:563
@ XWII_EVENT_PRO_CONTROLLER_KEY
Pro-Controller key event.
Definition: xwiimote.h:418
int xwii_iface_get_battery(struct xwii_iface *dev, uint8_t *capacity)
Read battery state.
uint8_t reserved[128]
reserved; do not use!
Definition: xwiimote.h:551
@ XWII_EVENT_BALANCE_BOARD
Balance-Board event.
Definition: xwiimote.h:396
char * xwii_monitor_poll(struct xwii_monitor *monitor)
Read incoming events.
unsigned int xwii_iface_opened(struct xwii_iface *dev)
Return bitmask of opened interfaces.
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.
struct timeval time
timestamp when this event was generated (copied from kernel)
Definition: xwiimote.h:565
int xwii_iface_dispatch(struct xwii_iface *dev, struct xwii_event *ev, size_t size)
Read incoming event-queue.
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.
@ XWII_IFACE_CORE
Core interface.
Definition: xwiimote.h:642
int xwii_iface_rumble(struct xwii_iface *dev, bool on)
Toggle rumble motor.
unsigned int state
key state copied from kernel (0: up, 1: down, 2: auto-repeat)
Definition: xwiimote.h:525
@ XWII_KEY_THUMBR
Right thumb button.
Definition: xwiimote.h:504
void xwii_monitor_unref(struct xwii_monitor *mon)
Decrease monitor ref-count by 1.
struct xwii_event_key key
key event payload
Definition: xwiimote.h:547
xwii_event_types
Event Types.
Definition: xwiimote.h:351