Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automation support via WebDriver (#124)
This PR integrates with the automation concepts defined in https://w3c.github.io/sensors/#automation to allow providing motion or orientation readings via virtual sensors through the WebDriver extension commands defined there. IMPORTANT: This does not mean that this specification requires implementations to support the Generic Sensor API specification and its derived specifications. Only the Automation section is being referenced, and when necessary some algorithms and definitions are being duplicated here, especially for Device Motion automation. The definitions of the "accelerometer", "linear-acceleration", "gyroscope", "absolute-orientation", and "relative-orientation" virtual sensor types have been moved here from their original specifications. As suggested in #124 and similarly to what has been discussed in PRs #121 and #123, since this specification is further along the Rec track and is implemented by more engines, it makes sense to have the exported definitions here and reference them from the other specs instead. Device Motion: - Readings are controlled via the "accelerometer", "linear-acceleration" and "gyroscope" virtual sensor types. Device Orientation: - The "absolute-orientation" and "relative-orientation" virtual sensor types are defined in this specification, along with a parsing algorithm that reads alpha, beta and gamma doubles. Compared to device motion, however, we have an additional problem in that device orientation data is provided in Euler angles and Orientation Sensor uses quaternions. The idea is to parse readings by reading alpha/beta/gamma keys from the WebDriver extension command and use them in the "fire orientation event" algorithm and skip using quaternions altogether. The Orientation Sensor spec can then augment the "parse orientation data reading" algorithm with the required steps to both 1) accept a "quaternion" key in the WebDriver extension command (and convert it to Euler angles as well) and 2) derive a quaternion from the alpha/beta/gamma Euler angles. Fixes #122.
- Loading branch information