Skip to content

Commit

Permalink
Rewrite Automation section after w3c/sensors#470
Browse files Browse the repository at this point in the history
The Automation section in the Generic Sensor API specification was rewritten
and several terms and concepts have changed.

This commit adapts the Ambient Light Sensor spec to the changes:
* Remove references to "mock sensor type", "mock sensor reading values" and
  the "MockSensorType" enum.
* Define an entry in the per-type virtual sensor metadata map whose key is
  what used to be the "ambient-light" entry in MockSensorType and an appropriate
  virtual sensor metadata entry.

This is enough to integrate properly with the Generic Sensor spec and allow
Ambient Light virtual sensors to be created and used.

Fixes w3c#86.
  • Loading branch information
JuhaVainio committed Oct 20, 2023
1 parent adf6c8b commit b51f7fe
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ urlPrefix: https://w3c.github.io/sensors/; spec: GENERIC-SENSOR
text: mitigation strategies; url: mitigation-strategies
text: sampling frequency
text: sensor type
text: automation
text: mock sensor type
text: MockSensorType
text: mock sensor reading values
text: latest reading
urlPrefix: https://tc39.es/ecma262/; spec: ECMA-262
type: abstract-op
Expand Down Expand Up @@ -417,22 +413,15 @@ quantization algorithm=]:

Automation {#automation}
==========
This section extends the [=automation=] section defined in the Generic Sensor API [[GENERIC-SENSOR]]
to provide mocking information about the ambient light levels for the purposes of testing a user agent's
implementation of [=Ambient Light Sensor=].
This section extends [[GENERIC-SENSOR#automation]] by providing [=Ambient Light Sensor=]-specific virtual sensor metadata.

The <dfn export>illuminance reading parsing algorithm</dfn>, given a JSON {{Object}} *parameters*, must invoke [=parse single-value number reading=] with *parameters* and "`illuminance`".

<h3 id="mock-ambient-light-sensor-type">Mock Sensor Type</h3>

The {{AmbientLightSensor}} class has an associated [=mock sensor type=] which is
<a for="MockSensorType" enum-value>"ambient-light"</a>, its [=mock sensor reading values=]
dictionary is defined as follows:

<pre class="idl">
dictionary AmbientLightReadingValues {
required double? illuminance;
};
</pre>
The [=per-type virtual sensor metadata=] [=map=] must have the following [=map/entry=]:
: [=map/key=]
:: "`ambient-light`"
: [=map/value=]
:: A [=virtual sensor metadata=] whose [=virtual sensor metadata/virtual sensor type=] is [=Ambient Light Sensor=] and [=reading parsing algorithm=] is [=illuminance reading parsing algorithm=].

Use Cases and Requirements {#usecases-requirements}
=========
Expand Down

0 comments on commit b51f7fe

Please sign in to comment.