-
Notifications
You must be signed in to change notification settings - Fork 0
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.
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. |
- C constant:
XWII_EVENT_KEY
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) |
- C constant:
XWII_EVENT_ACCEL
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 |
- C constant:
XWII_EVENT_IR
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
|
- C constant:
XWII_EVENT_BALANCE_BOARD
Weight data from balance board.
Key | Meaning |
---|---|
balance |
Array of integers of weight-values |
- C constant:
XWII_EVENT_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 |
- C constant:
XWII_EVENT_PRO_CONTROLLER_KEY
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 |
- C constant:
XWII_EVENT_PRO_CONTROLLER_MOVE
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 |
- C constant:
XWII_EVENT_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 |