xwiimote 2
|
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... | |
Macros | |
#define | XWII_ABS_NUM 8 |
Number of ABS values in an xwii_event_union. | |
Device event handling.
Devices notify users about any state-changes via events. These events can contain peripheral-data, hotplug-information or more.
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 is only returned if you explicitly watched for hotplug events. See xwii_iface_watch(). 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_CLASSIC_CONTROLLER_KEY | Classic Controller key event. Button events of the classic 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. Payload type is struct xwii_event_key. |
XWII_EVENT_CLASSIC_CONTROLLER_MOVE | Classic 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. The x value of the third array element contains the absolute position of the TL trigger. The y value contains the absolute position for the TR trigger. Note that many classic controllers do not have analog TL/TR triggers, in which case these read 0 or MAX (63). The digital TL/TR buttons are always reported correctly. |
XWII_EVENT_NUNCHUK_KEY | Nunchuk key event. Button events of the nunchuk controller are reported via this interface and not via the core-interface (which only reports core-buttons). Valid buttons include: C, Z Payload type is struct xwii_event_key. |
XWII_EVENT_NUNCHUK_MOVE | Nunchuk movement event. Movement events of the nunchuk controller are reported via this interface. Payload is of type struct xwii_event_abs. The first array element contains the x/y positions of the analog stick. The second array element contains the accelerometer information. |
XWII_EVENT_DRUMS_KEY | Drums key event. Button events for drums controllers. Valid buttons are PLUS and MINUS for the +/- buttons on the center-bar. Payload type is struct xwii_event_key. |
XWII_EVENT_DRUMS_MOVE | Drums movement event. Movement and pressure events for drums controllers. Payload is of type struct xwii_event_abs. The indices are describe as enum xwii_drums_abs and each of them contains the corresponding stick-movement or drum-pressure values. |
XWII_EVENT_GUITAR_KEY | Guitar key event. Button events for guitar controllers. Valid buttons are HOME and PLUS for the StarPower/Home button and the + button. Furthermore, you get FRET_FAR_UP, FRET_UP, FRET_MID, FRET_LOW, FRET_FAR_LOW for fret activity and STRUM_BAR_UP and STRUM_BAR_LOW for the strum bar. Payload type is struct xwii_event_key. |
XWII_EVENT_GUITAR_MOVE | Guitar movement event. Movement information for guitar controllers. Payload is of type struct xwii_event_abs. The first element contains X and Y direction of the analog stick. The second element contains whammy-bar movement information as x-value. The third element contains fret-bar absolute positioning information as x-value. |
XWII_EVENT_GONE | Removal Event. This event is sent whenever the device was removed. No payload is provided. Non-hotplug aware applications may discard this event. This is only returned if you explicitly watched for hotplug events. See xwii_iface_watch(). |
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.
enum xwii_drums_abs |
Absolute Drum-Motion Indices.
A drum-payload can contain a lot of different absolute motion events all in a single object. Depending on the event-type, the array offsets for absolute-motion events are different. This enum describes the indices used for drums.
Note that these mimic the kernel API. If new drums with more tom-toms or cymbals are supported, the corresponding TOM and CYMBAL values will be added. That's also why there is no TOM_MID, but only TOM_FAR_RIGHT so far.