w3c / sensors

Generic Sensor API
https://www.w3.org/TR/generic-sensor/
Other
127 stars 59 forks source link

'Requested sampling frequency' automation concept is confusing #484

Open rakuco opened 5 months ago

rakuco commented 5 months ago

As it is currently defined, a virtual sensor's requested sampling frequency is a confusing concept because a virtual sensor acts as a device sensor, whereas in this case we are interested in a platform sensor's sampling frequency.

As the current text says, there is a link between the two concepts, but they are not necessarily the same -- if a platform sensor is polling, its sampling frequency would be non-zero, but the requested sampling frequency could even be zero.

Conceptually, it'd make more sense to have a WebDriver endpoint that retrieves the sampling frequency of the current browsing context's platform sensor that corresponds to a given sensor type, but this wouldn't integrate well with the Device Orientation spec, which has no concept of platform sensors to start with.

An alternative is to have https://w3c.github.io/sensors/#set-sensor-settings and the Model section of the Device Orientation spec explicitly invoke some operation that sets the requested sampling frequency to the platform sensor's sampling frequency or, in the Device Orientation case, some implementation-defined value when they are connected to device sensors. The operation would set the requested sampling frequency to the maximum of the current value and the new value (in case it has more than one user, like when a Sensor-based object is used in a page that also uses the Device Orientation API).