Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
Valeri edited this page Sep 1, 2019 · 4 revisions

Events

lua-xwiimote use tables to represent various event types. You need to check available keys to get event type.

Following entries provide brief description of event type and values that are stored in table.

Any event

Every single event provide timestamp in two versions:

Key Meaning
timestamp When event was fired. It's fractional number in seconds useful for approximation but not for accurate calculations.
timestamp_full When event was fired. It is table with two integer fields sec for seconds and usec for nanoseconds (not microseconds!) directly mapping source struct timeval. Use it when you need accurate data.

Button

This event is fired when one of buttons on WiiMote change its state.

Key Meaning
key String representing affected button
state 0 = button up, 1 = button down, 2 = auto repeat (never got this one)

Accelerometer

Data from WiiMote built-in accelerometer, describing its (surprise!) acceleration.

My tests show range (-410; 410];

Key Meaning
accel Table with integers x/y/z with corresponding meanings

IR camera

Data from WiiRemote IR camera. Please note that in order to workaround https://github.com/dvdhrm/xwiimote/issues/88 zero values are ignored.

In my experience, ranges are the following:

  • x -- (0; 1016]
  • y -- (0; 760]
Key Meaning
ir Array of tables with found light sources, each with fields x and y

Balance board

Weight data from balance board.

Key Meaning
balance Array of integers of weight-values

Motion plus

Motion-Plus gyroscope data, describing rotational speed of the first.

Range is to be questioned, but I think ±335160 is a good guess.

Key Meaning
mplus Table with integers x/y/z with corresponding meanings

Pro Controller button

This event is fired when one of buttons on Pro Controller change its state.

Key Meaning
pro_key String representing affected button
state 0 = button up, 1 = button down, 2 = auto repeat

Pro Controller joystick

This event carry data of Pro Controller joysticks.

Key Meaning
pro_move Table with two elements: left and right, each containing fields x and y with absolute positions of each joystick

Watch

This event is sent whenever an extension was hotplugged (plugged or unplugged), a device-detection finished or some other static data changed which cannot be monitored separately.

An application should check what changed by examining the device is testing whether all required interfaces are still available. Non-hotplug aware devices may discard this event.

This event is also returned if an interface is closed because the kernel closed our file-descriptor (for whatever reason). This is returned regardless whether you watch for hotplug events or not.

Please note that this event is disabled by default and can be enabled by using iface:watch(true) except for case when device got unplugged (as said in quote above).

Key Meaning
watch Always true as this event have no payload
Clone this wiki locally