blob: 3f9a74c29028c32526a7f4dfa6848064c96789d1 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="gaming_input_unstable_v2">
<copyright>
Copyright 2016 The Chromium Authors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zcr_gaming_input_v2" version="2">
<description summary="extends wl_seat with gaming input devices">
A global interface to provide gaming input devices for a given seat.
Currently only gamepad devices are supported.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible changes
may be added together with the corresponding uinterface version bump.
Backward incompatible changes are done by bumping the version number in
the protocol and uinterface names and resetting the interface version.
Once the protocol is to be declared stable, the 'z' prefix and the
version number in the protocol and interface names are removed and the
interface version number is reset.
</description>
<request name="get_gaming_seat">
<description summary="get a gaming seat">
Get a gaming seat object for a given seat. Gaming seat provides access
to gaming devices
</description>
<arg name="gaming_seat" type="new_id" interface="zcr_gaming_seat_v2"/>
<arg name="seat" type="object" interface="wl_seat"/>
</request>
<request name="destroy" type="destructor">
<description summary="release the memory for the gaming input object">
Destroy gaming_input object. Objects created from this object are
unaffected and should be destroyed separately.
</description>
</request>
</interface>
<interface name="zcr_gaming_seat_v2" version="1">
<description summary="controller object for all gaming devices of a seat">
An object that provides access to all the gaming devices of a seat.
When a gamepad is connected, the compositor will send gamepad_added event.
</description>
<request name="destroy" type="destructor">
<description summary="release the memory for the gaming seat object">
Destroy gaming_seat object. Objects created from this object are
unaffected and should be destroyed separately.
</description>
</request>
<event name="gamepad_added">
<description summary="gamepad added event">
Notification that there is gamepad connected at this seat.
</description>
<arg name="gamepad" type="new_id" interface="zcr_gamepad_v2" summary="new connected gamepad"/>
</event>
<enum name="bus_type">
<description summary="gamepad device bus type">
Device connection type e.g. Bluetooth
</description>
<entry name="usb" value="0" summary="Universal Serial Bus" />
<entry name="bluetooth" value="1" summary="Bluetooth" />
</enum>
<event name="gamepad_added_with_device_info">
<description summary="gamepad added event">
Notification that there is gamepad connected at this seat.
</description>
<arg name="gamepad" type="new_id" interface="zcr_gamepad_v2" summary="new connected gamepad"/>
<arg name="name" type="string" summary="name of the gamepad device" />
<arg name="bus" type="uint" enum="bus_type" summary="type of the device connection e.g. Bluetooth" />
<arg name="vendor_id" type="uint" summary="vendor ID of the gamepad device" />
<arg name="product_id" type="uint" summary="product ID of the gamepad device" />
<arg name="version" type="uint" summary="product version of the gamepad device" />
</event>
</interface>
<interface name="zcr_gamepad_v2" version="2">
<description summary="gamepad input device">
The zcr_gamepad_v2 interface represents one or more gamepad input devices,
which are reported as a normalized 'Standard Gamepad' as it is specified
by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping
</description>
<request name="destroy" type="destructor">
<description summary="destroy gamepad">
Destroy gamepad. Instances created from this gamepad are unaffected
and should be destroyed separately.
</description>
</request>
<event name="removed">
<description summary="gamepad removed">
Removed event is send when the gamepad is disconnected. The client should
expect no more event and call destroy.
This event cannot be used as destructor as requests (e.g. vibration) might
be added to this interface.
</description>
</event>
<event name="axis">
<description summary="axis change event">
Notification of axis change.
The axis id specifies which axis has changed as defined by the W3C
'Standard Gamepad'.
The value is calibrated and normalized to the -1 to 1 range.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="axis" type="uint" summary="axis that produced this event"/>
<arg name="value" type="fixed" summary="new value of axis"/>
</event>
<enum name="button_state">
<description summary="physical button state">
Describes the physical state of a button that produced the button
event.
</description>
<entry name="released" value="0" summary="the button is not pressed"/>
<entry name="pressed" value="1" summary="the button is pressed"/>
</enum>
<event name="button">
<description summary="Gamepad button changed">
Notification of button change.
The button id specifies which button has changed as defined by the W3C
'Standard Gamepad'.
A button can have a digital and an analog value. The analog value is
normalized to a 0 to 1 range.
If a button does not provide an analog value, it will be derived from
the digital state.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="button" type="uint" summary="id of button"/>
<arg name="state" type="uint" enum="button_state" summary="digital state of the button"/>
<arg name="analog" type="fixed" summary="analog value of the button"/>
</event>
<event name="frame">
<description summary="Notifies end of a series of gamepad changes.">
Indicates the end of a set of events that logically belong together.
A client is expected to accumulate the data in all events within the
frame before proceeding.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
</event>
<event name="axis_added">
<description summary="an axis is added">
Adds an axis to the gamepad. Only called when the gamepad was created by
gamepad_added_with_device_info. The values are compatible with
input_absinfo.
</description>
<arg name="index" type="uint" summary="An index of the axis" />
<arg name="min_value" type="int" summary="minimum value of the axis" />
<arg name="max_value" type="int" summary="maximum value of the axis" />
<arg name="flat" type="int" summary="input within this value are ignored" />
<arg name="fuzz" type="int" summary="used to filter noise" />
<arg name="resolution" type="int" summary="resolution of input in units per millimeter, or units per radian for rotational axes." />
</event>
<event name="activated">
<description summary="Gamepad activated">
Activates the gamepad i.e. the gamepad will be visible to applications
after this event is fired. All axis_added events should be sent before
this event. Only called when the gamepad was created by
gamepad_added_with_device_info.
</description>
</event>
<!-- added since v2 -->
<event name="vibrator_added" since="2">
<description summary="a vibrator is added">
Adds a vibrator to the gamepad. Only called if server has verified
that gamepad has a vibrator. The vibrator(s) for a gamepad are expected
to be added before the "activated" event is called.
</description>
<arg name="vibrator" type="new_id" interface="zcr_gamepad_vibrator_v2" summary="the gamepad vibrator"/>
</event>
</interface>
<interface name="zcr_gamepad_vibrator_v2" version="2">
<description summary="vibrator interface for a gamepad">
An interface that provides access to the vibrator of a gamepad. Requests can be
sent to make the gamepad vibrate and to stop an ongoing vibration.
</description>
<request name="vibrate" since="2">
<description summary="triggers the vibration event">
Triggers the vibration event on the gamepad vibrator. The gamepad is only allowed to
vibrate while the window is in focus. The values in the timings array are 64-bit integers
and the values in the amplitudes array are unsigned 8-bit integers.
The timings array and the amplitudes array are of the same length.
For each timing/amplitude pair, the amplitude determines the strength of
the vibration and the timing determines the length of the vibration in milliseconds.
Amplitude values must be between 0 and 255. An amplitude of 0 implies no vibration
and any timing/amplitude pair with a timing value of 0 is ignored.
The repeat argument determines the index at which the vibration pattern to repeat begins.
A repeat value of -1 disables repetition. If repetition is enabled, the vibration
pattern will repeat indefinitely until stopped, or when focus is lost.
</description>
<arg name="timings" type="array" summary="array of timing values" />
<arg name="amplitudes" type="array" summary="array of amplitude values" />
<arg name="repeat" type="int" summary="index into the timings array at which to repeat" />
</request>
<request name="cancel_vibration" since="2">
<description summary="cancels the existing vibration event">
Cancels the currently ongoing vibration event on the gamepad vibrator.
</description>
</request>
<request name="destroy" type="destructor" since="2">
<description summary="destroy gamepad vibrator"/>
</request>
</interface>
</protocol>