| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.input.report; |
| |
| /// This provides an easy, standardized way to specify units. New units can |
| /// be added as needed. Each UnitType should be named after a specific unit that |
| /// should be fully distinguished by the name (E.g: Use METERS instead of |
| /// DISTANCE). More complicated units that need to be differentiated should |
| /// begin with SI_ (for Internation System of Units) or ENGLISH_ (for English |
| /// System of Units). |
| type UnitType = flexible enum : uint32 { |
| /// The device did not specify units. |
| NONE = 0; |
| |
| /// The device specified units that are not convertible to any of the other units. |
| OTHER = 1; |
| |
| /// A measurement of distance in meters. |
| METERS = 2; |
| |
| /// A measurement of mass in grams. |
| GRAMS = 3; |
| |
| /// A measurement of rotation in degrees. |
| DEGREES = 4; |
| |
| /// A measurement of angular velocity in degrees per second. |
| ENGLISH_ANGULAR_VELOCITY = 5; |
| |
| /// A measurement of linear velocity in meters per second. |
| SI_LINEAR_VELOCITY = 6; |
| |
| /// A measurement of acceleration in meters per second squared. |
| SI_LINEAR_ACCELERATION = 7; |
| |
| /// A measure of magnetic flux in webers. |
| WEBERS = 8; |
| |
| /// A measurement of luminous intensity in candelas. |
| CANDELAS = 9; |
| |
| /// A measurement of pressure in pascals. |
| PASCALS = 10; |
| |
| // A measurement of luminous flux in lumens per meter squared. |
| LUX = 11; |
| |
| // A measurement of seconds. |
| SECONDS = 12; |
| }; |
| |
| /// Describes a given unit by giving the unit and the unit's exponent. |
| /// E.g: Nanometers would have type METERS and exponent -9. |
| type Unit = struct { |
| type UnitType; |
| exponent int32; |
| }; |
| |
| /// Describe a `Range` of values. |
| type Range = struct { |
| min int64; |
| max int64; |
| }; |
| |
| /// An `Axis` is defined as a `range` and a `unit`. |
| type Axis = struct { |
| range Range; |
| unit Unit; |
| }; |