OLD | NEW |
1 # Sensors | 1 # Sensors |
2 | 2 |
3 `device/generic_sensor` contains the platform-specific parts of the Sensor APIs | 3 `device/generic_sensor` contains the platform-specific parts of the Sensor APIs |
4 implementation. | 4 implementation. |
5 | 5 |
6 Sensors Mojo interfaces are defined in the `public/interfaces` subdirectory. | 6 Sensors Mojo interfaces are defined in the `public/interfaces` subdirectory. |
7 | 7 |
8 The JS bindings are implemented in `third_party/WebKit/Source/modules/sensor`. | 8 The JS bindings are implemented in `third_party/WebKit/Source/modules/sensor`. |
9 | 9 |
10 | 10 |
| 11 ## Platform Support |
| 12 |
| 13 Support for the SensorTypes defined by the Mojo interface is summarized in this |
| 14 table. An empty cell indicates that the sensor type is not supported on that |
| 15 platform. |
| 16 |
| 17 | SensorType | Android | Linux | macOS
| Windows | |
| 18 | -------------------- | ------------------------- | -------------- | ----------
-------- | ----------------------------------------- | |
| 19 | AMBIENT_LIGHT | TYPE_LIGHT | in_illuminance | AppleLMUCo
ntroller | SENSOR_TYPE_AMBIENT_LIGHT | |
| 20 | PROXIMITY | | |
| | |
| 21 | ACCELEROMETER | TYPE_ACCELEROMETER | in_accel |
| SENSOR_TYPE_ACCELEROMETER_3D | |
| 22 | LINEAR_ACCELEROMETER | TYPE_LINEAR_ACCELEROMETER | |
| | |
| 23 | GYROSCOPE | TYPE_GYROSCOPE | in_anglvel |
| SENSOR_TYPE_GYROMETER_3D | |
| 24 | MAGNETOMETER | TYPE_MAGNETIC_FIELD | in_magn |
| SENSOR_TYPE_COMPASS_3D | |
| 25 | PRESSURE | | |
| | |
| 26 | ABSOLUTE_ORIENTATION | TYPE_ROTATION_VECTOR | |
| SENSOR_TYPE_AGGREGATED_DEVICE_ORIENTATION | |
| 27 |
| 28 ### Android |
| 29 |
| 30 Sensors are implemented by passing through values provided by the |
| 31 [Sensor](https://developer.android.com/reference/android/hardware/Sensor.html) |
| 32 class. The values in the "Android" column of the table above correspond to the |
| 33 integer constants from the android.hardware.Sensor used to provide data for a |
| 34 SensorType. |
| 35 |
| 36 ### Linux (and Chrome OS) |
| 37 |
| 38 Sensors are implemented by reading values from the IIO subsystem. The values in |
| 39 the "Linux" column of the table above are the prefix of the sysfs files Chrome |
| 40 searches for to provide data for a SensorType. |
| 41 |
| 42 ### macOS |
| 43 |
| 44 On this platform there is limited support for sensors. The AMBIENT_LIGHT sensor |
| 45 type is provided by interpreting the value that can be read from the LMU. |
| 46 |
| 47 ### Windows |
| 48 |
| 49 Sensors are implemented by passing through values provided by the |
| 50 [Sensor API](https://msdn.microsoft.com/en-us/library/windows/desktop/dd318953(v
=vs.85).aspx). |
| 51 The values in the "Windows" column of the table above correspond to the names of |
| 52 the sensor type GUIDs used to provide data for a SensorType. |
| 53 |
11 ## Testing | 54 ## Testing |
12 | 55 |
13 Sensors platform unit tests are located in the current directory and its | 56 Sensors platform unit tests are located in the current directory and its |
14 subdirectories. | 57 subdirectories. |
15 | 58 |
16 The sensors unit tests file for Android is | 59 The sensors unit tests file for Android is |
17 `android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.jav
a`. | 60 `android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.jav
a`. |
18 | 61 |
19 Sensors browser tests are located in `content/test/data/generic_sensor`. | 62 Sensors browser tests are located in `content/test/data/generic_sensor`. |
20 | 63 |
21 | 64 |
22 ## Design Documents | 65 ## Design Documents |
23 | 66 |
24 Please refer to the [design documentation](https://docs.google.com/document/d/1M
l65ZdW5AgIsZTszk4mD_ohr40pcrdVFOIf0ZtWxDv0) | 67 Please refer to the [design documentation](https://docs.google.com/document/d/1M
l65ZdW5AgIsZTszk4mD_ohr40pcrdVFOIf0ZtWxDv0) |
25 for more details. | 68 for more details. |
OLD | NEW |