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