xwiimote 2

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Enumerations
Device Events

Device event handling. More...

## 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...

## 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...

## Detailed Description

Device event handling.

Devices notify users about any state-changes via events. These events can contain peripheral-data, hotplug-information or more.

## Enumeration Type Documentation

enum xwii_event_types

Event Types.

Each event can be identified by the type field. New types might be added at any time so unknown event-types must be ignored by applications. The given payload of an event is described for each type. Unused payload-space is zeroed by the library. However, the payload may be extended in new revisions so applications must not depend on it being 0 or untouched.

Enumerator
XWII_EVENT_KEY | Core-interface key event. The payload of such events is struct xwii_event_key. Valid key-events include all the events reported by the core-interface, which is normally only LEFT, RIGHT, UP, DOWN, A, B, PLUS, MINUS, HOME, ONE, TWO.
XWII_EVENT_ACCEL | Accelerometer event. Provides accelerometer data. Payload is struct xwii_event_abs and only the first element in the abs-array is used. The x, y and z fields contain the accelerometer data. Note that the accelerometer reports acceleration data, not speed data!
XWII_EVENT_IR | IR-Camera event. Provides IR-camera events. The camera can track up two four IR sources. As long as a single source is tracked, it stays at it's pre-allocated slot. The four available slots are reported as struct xwii_event_abs payload. The x and y fields contain the position of each slot. Use xwii_event_ir_is_valid() to see whether a specific slot is currently valid or whether it currently doesn't track any IR source.
XWII_EVENT_BALANCE_BOARD | Balance-Board event. Provides balance-board weight data. Four sensors report weight-data for each of the four edges of the board. The data is available as struct xwii_event_abs payload. The x fields of the first four array-entries contain the weight-value.
XWII_EVENT_MOTION_PLUS | Motion-Plus event. Motion-Plus gyroscope events. These describe rotational speed, not acceleration, of the motion-plus extension. The payload is available as struct xwii_event_abs and the x, y and z field of the first array-element describes the motion-events in the 3 dimensions.
XWII_EVENT_PRO_CONTROLLER_KEY | Pro-Controller key event. Button events of the pro-controller are reported via this interface and not via the core-interface (which only reports core-buttons). Valid buttons include: LEFT, RIGHT, UP, DOWN, PLUS, MINUS, HOME, X, Y, A, B, TR, TL, ZR, ZL, THUMBL, THUMBR. Payload type is struct xwii_event_key.
XWII_EVENT_PRO_CONTROLLER_MOVE | Pro-Controller movement event. Movement of analog sticks are reported via this event. The payload is a struct xwii_event_abs and the first two array elements contain the absolute x and y position of both analog sticks.
XWII_EVENT_WATCH | Hotplug Event. 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. No payload is provided. 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.
XWII_EVENT_NUM | Number of available event types. The value of this constant may increase on each new library revision. It is not guaranteed to stay constant. However, it may never shrink.

enum xwii_event_keys

Key Event Identifiers.

For each key found on a supported device, a separate key identifier is defined. Note that a device may have a specific key (for instance: HOME) on the main device and on an extension device. An application can detect which key was pressed examining the event-type field. Some devices report common keys as both, extension and core events. In this case the kernel is required to filter these and you should report it as a bug. A single physical key-press should never be reported twice, even on two different interfaces.

Most of the key-names should be self-explanatory.

Enumerator
XWII_KEY_THUMBL | Left thumb button. This is reported if the left analog stick is pressed. Not all analog sticks support this. The Wii-U Pro Controller is one of few devices that report this event.
XWII_KEY_THUMBR | Right thumb button. This is reported if the right analog stick is pressed. Not all analog sticks support this. The Wii-U Pro Controller is one of few devices that report this event.
XWII_KEY_NUM | Number of key identifiers. This defines the number of available key-identifiers. It is not guaranteed to stay constant and may change when new identifiers are added. However, it will never shrink.