Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ppapi / api / ppb_gamepad.idl
blob1552fd67d7101881800ae992b129e086b1aaa6e6
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
6 /**
7 * This file defines the <code>PPB_Gamepad</code> interface, which
8 * provides access to gamepad devices.
9 */
11 [generate_thunk]
13 label Chrome {
14 M19 = 1.0
17 /**
18 * The data for one gamepad device.
20 [assert_size(472)]
21 struct PP_GamepadSampleData {
22 /**
23 * Number of valid elements in the |axes| array.
25 uint32_t axes_length;
27 /**
28 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis
29 * values range from -1..1, and are in order of "importance".
31 float_t[16] axes;
33 /**
34 * Number of valid elements in the |buttons| array.
36 uint32_t buttons_length;
38 /**
39 * Normalized values for the buttons, indices valid up to |buttons_length|
40 * - 1. Button values range from 0..1, and are in order of importance.
42 float_t[32] buttons;
44 /**
45 * Monotonically increasing value that is incremented when the data have
46 * been updated.
48 double_t timestamp;
50 /**
51 * Identifier for the type of device/manufacturer.
53 uint16_t[128] id;
55 /**
56 * Is there a gamepad connected at this index? If this is false, no other
57 * data in this structure is valid.
59 PP_Bool connected;
61 /* Padding to make the struct the same size between 64 and 32. */
62 char[4] unused_pad_;
65 /**
66 * The data for all gamepads connected to the system.
68 [assert_size(1896)]
69 struct PP_GamepadsSampleData {
70 /**
71 * Number of valid elements in the |items| array.
73 uint32_t length;
75 /* Padding to make the struct the same size between 64 and 32. */
76 char[4] unused_pad_;
78 /**
79 * Data for an individual gamepad device connected to the system.
81 PP_GamepadSampleData[4] items;
84 /**
85 * The <code>PPB_Gamepad</code> interface allows retrieving data from
86 * gamepad/joystick devices that are connected to the system.
88 [version=1.0, macro="PPB_GAMEPAD_INTERFACE", singleton]
89 interface PPB_Gamepad {
90 /**
91 * Samples the current state of the available gamepads.
93 [always_set_output_parameters]
94 void Sample(
95 [in] PP_Instance instance,
96 [out] PP_GamepadsSampleData data);