| OLD | NEW |
| (Empty) |
| 1 # Sensors | |
| 2 | |
| 3 `services/device/generic_sensor` contains the platform-specific parts of the Sen
sor APIs | |
| 4 implementation. | |
| 5 | |
| 6 Sensors Mojo interfaces are defined in the `services/public/interfaces` subdirec
tory. | |
| 7 | |
| 8 The JS bindings are implemented in `third_party/WebKit/Source/modules/sensor`. | |
| 9 | |
| 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 | SMCMotionS
ensor | 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 | RELATIVE_ORIENTATION | TYPE_GAME_ROTATION_VECTOR | |
| | | |
| 28 | |
| 29 ### Android | |
| 30 | |
| 31 Sensors are implemented by passing through values provided by the | |
| 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 | |
| 34 integer constants from the android.hardware.Sensor used to provide data for a | |
| 35 SensorType. | |
| 36 | |
| 37 ### Linux (and Chrome OS) | |
| 38 | |
| 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 | |
| 41 searches for to provide data for a SensorType. | |
| 42 | |
| 43 ### macOS | |
| 44 | |
| 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 | |
| 47 ACCELEROMETER sensor type is provided by interpreting the value that can be read | |
| 48 from the SMCMotionSensor. | |
| 49 | |
| 50 ### Windows | |
| 51 | |
| 52 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 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 | |
| 57 ## Testing | |
| 58 | |
| 59 Sensors platform unit tests are located in the current directory and its | |
| 60 subdirectories. | |
| 61 | |
| 62 The sensors unit tests file for Android is | |
| 63 `android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.jav
a`. | |
| 64 | |
| 65 Sensors browser tests are located in `content/test/data/generic_sensor`. | |
| 66 | |
| 67 | |
| 68 ## Design Documents | |
| 69 | |
| 70 Please refer to the [design documentation](https://docs.google.com/document/d/1M
l65ZdW5AgIsZTszk4mD_ohr40pcrdVFOIf0ZtWxDv0) | |
| 71 for more details. | |
| OLD | NEW |