Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: device/gamepad/public/interfaces/gamepad.mojom

Issue 2492183002: Add struct_traits and typemap for blink::WebGamepad (Closed)
Patch Set: use nullable feature Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/gamepad/public/interfaces/gamepad.mojom
diff --git a/device/gamepad/public/interfaces/gamepad.mojom b/device/gamepad/public/interfaces/gamepad.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..ff3cd12c538eb0627cd91f1fc66a74a6b7c1c595
--- /dev/null
+++ b/device/gamepad/public/interfaces/gamepad.mojom
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module device.mojom;
+
+struct GamepadQuaternion {
+ float x;
+ float y;
+ float z;
+ float w;
+};
+
+struct GamepadVector {
+ float x;
+ float y;
+ float z;
+};
+
+struct GamepadButton {
+ bool pressed;
+ bool touched;
+ double value;
+};
+
+struct GamepadPose {
+ GamepadQuaternion? orientation;
+ GamepadVector? position;
+ GamepadVector? angular_velocity;
+ GamepadVector? linear_velocity;
+ GamepadVector? angular_acceleration;
+ GamepadVector? linear_acceleration;
+};
+
+enum GamepadHand {
+ GamepadHandNone = 0,
+ GamepadHandLeft = 1,
+ GamepadHandRight = 2
+};
+
+struct Gamepad {
+ bool connected;
+ array<uint16, 128> id; //blink::WebGamepad::idLengthCap = 128
+ uint64 timestamp;
+ uint32 axes_length;
yzshen1 2016/11/15 19:17:33 If axes length is variable, how about making |axes
ke.he 2016/11/16 09:51:40 Yes, to avoid passing unnecessary bytes, |axes_len
+ array<double, 16> axes; //blink::WebGamepad::axesLengthCap = 16
+ uint32 buttons_length;
+ array<GamepadButton, 32> buttons; //blink::WebGamepad::buttonLengthCap = 32
+ array<uint16, 16> mapping; //blink::WebGamepad::mappingLengthCap = 16
+ GamepadPose? pose;
+ GamepadHand hand;
+ uint32 display_id;
+};

Powered by Google App Engine
This is Rietveld 408576698