sensor-data.js (1114B)
1 'use strict'; 2 3 const kAbsoluteOrientationSensorData = { 4 sensorName: 'AbsoluteOrientationSensor', 5 permissionName: 'accelerometer', 6 testDriverName: 'absolute-orientation', 7 featurePolicyNames: ['accelerometer', 'gyroscope', 'magnetometer'] 8 }; 9 10 const kRelativeOrientationSensorData = { 11 sensorName: 'RelativeOrientationSensor', 12 permissionName: 'accelerometer', 13 testDriverName: 'relative-orientation', 14 featurePolicyNames: ['accelerometer', 'gyroscope'] 15 }; 16 17 const kOrientationReadings = { 18 // WebDriver input data must be given in Euler angles according to 19 // https://w3c.github.io/deviceorientation/#parse-orientation-data-reading-algorithm 20 // and converted to quaternions via 21 // https://w3c.github.io/orientation-sensor/#create-a-quaternion-from-euler-angles. 22 readings: [{alpha: 0, beta: -180, gamma: 0}], 23 expectedReadings: [{quaternion: [-1, 0, 0, 0]}], 24 expectedRemappedReadings: [{quaternion: [0.70710678, -0.70710678, 0, 0]}] 25 }; 26 27 const kRotationMatrix = [1, 0, 0, 0, 28 0, -1, 0, 0, 29 0, 0, -1, 0, 30 0, 0, 0, 1];