Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Meta] Proof-read and modernize spec #463

Open
rakuco opened this issue Jul 21, 2023 · 0 comments
Open

[Meta] Proof-read and modernize spec #463

rakuco opened this issue Jul 21, 2023 · 0 comments
Assignees

Comments

@rakuco
Copy link
Member

rakuco commented Jul 21, 2023

This has been discussed in passing at TPAC in the last couple of years, so I'm finally filing an issue to keep track of this task.

Most of the spec text was written some 6-7 years ago, and since then new best practices have come up (for example, the Privacy Considerations and Security Considerations sections are expected to be separate these days). I also think the spec is not great at defining some terms and concepts, and some algorithms are a bit hand-wavy.

Doing an internal spec review and addressing these items would also show that this WG is committed to following the latest best practices and that this spec is well-maintained, in addition to helping us if we ever need to ask for a TAG review again.

@rakuco rakuco self-assigned this Jul 21, 2023
rakuco added a commit to rakuco/sensors that referenced this issue Jul 24, 2023
Instead of having several paragraphs mixing what a sensor type must or may
and algorithms, the "Sensor Type" section now only has two paragraphs and
two groups containing what must be defined and what may be defined to make
it easier to follow.

This also has consequences for the "Extensibility" section, as its
"Definition Requirements" subsection used to duplicate some of the contents
in "Sensor Type". It now just refers to the latter and provides more details
about how some of a sensor type's associated data must be defined in
extension specifications.

Some data that used to be associated with a sensor type has been removed:
- "Associated sensors" were never properly defined and it was not clear that
  they meant "associated _platform_ sensors". They were only used in the
  generic sensor permission revocation algorithm, which has been rewritten.
- "Permission request algorithm" is a term that has been moved from the
  Permissions spec to the Requesting Permissions permission in WICG. None of
  the extension specifications ever defined it.

The generic sensor permission revocation algorithm was moved to the
"Abstract Operations" section. It has also been merged with the revoke
sensor permission algorithm since it was its only caller. There should not
be any user-visible effects though: the language was just made more formal
by iterating over all Sensor instances belonging to the current realm (like
the Web Bluetooth spec does) instead of hand-wavingly gathering all
platform sensors (which technically are per-navigable) with the same sensor
type.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 24, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 24, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 24, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
Instead of having several paragraphs mixing what a sensor type must or may
and algorithms, the "Sensor Type" section now only has two paragraphs and
two groups containing what must be defined and what may be defined to make
it easier to follow.

This also has consequences for the "Extensibility" section, as its
"Definition Requirements" subsection used to duplicate some of the contents
in "Sensor Type". It now just refers to the latter and provides more details
about how some of a sensor type's associated data must be defined in
extension specifications.

Some data that used to be associated with a sensor type has been removed:
- "Associated sensors" were never properly defined and it was not clear that
  they meant "associated _platform_ sensors". They were only used in the
  generic sensor permission revocation algorithm, which has been rewritten.
- "Permission request algorithm" is a term that has been moved from the
  Permissions spec to the Requesting Permissions permission in WICG. None of
  the extension specifications ever defined it.

The generic sensor permission revocation algorithm was moved to the
"Abstract Operations" section. It has also been merged with the revoke
sensor permission algorithm since it was its only caller. There should not
be any user-visible effects though: the language was just made more formal
by iterating over all Sensor instances belonging to the current realm (like
the Web Bluetooth spec does) instead of hand-wavingly gathering all
platform sensors (which technically are per-navigable) with the same sensor
type.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
Instead of having several paragraphs mixing what a sensor type must or may
and algorithms, the "Sensor Type" section now only has two paragraphs and
two groups containing what must be defined and what may be defined to make
it easier to follow.

This also has consequences for the "Extensibility" section, as its
"Definition Requirements" subsection used to duplicate some of the contents
in "Sensor Type". It now just refers to the latter and provides more details
about how some of a sensor type's associated data must be defined in
extension specifications.

Some data that used to be associated with a sensor type has been removed:
- "Associated sensors" were never properly defined and it was not clear that
  they meant "associated _platform_ sensors". They were only used in the
  generic sensor permission revocation algorithm, which has been rewritten.
- "Permission request algorithm" is a term that has been moved from the
  Permissions spec to the Requesting Permissions permission in WICG. None of
  the extension specifications ever defined it.

The generic sensor permission revocation algorithm was moved to the
"Abstract Operations" section. It has also been merged with the revoke
sensor permission algorithm since it was its only caller. There should not
be any user-visible effects though: the language was just made more formal
by iterating over all Sensor instances belonging to the current realm (like
the Web Bluetooth spec does) instead of hand-wavingly gathering all
platform sensors (which technically are per-navigable) with the same sensor
type.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Jul 27, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 1, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 1, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 1, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit that referenced this issue Aug 1, 2023
#466)

Instead of having several paragraphs mixing what a sensor type must or may
and algorithms, the "Sensor Type" section now only has two paragraphs and
two groups containing what must be defined and what may be defined to make
it easier to follow.

This also has consequences for the "Extensibility" section, as its
"Definition Requirements" subsection used to duplicate some of the contents
in "Sensor Type". It now just refers to the latter and provides more details
about how some of a sensor type's associated data must be defined in
extension specifications.

Some data that used to be associated with a sensor type has been removed:
- "Associated sensors" were never properly defined and it was not clear that
  they meant "associated _platform_ sensors". They were only used in the
  generic sensor permission revocation algorithm, which has been rewritten.
- "Permission request algorithm" is a term that has been moved from the
  Permissions spec to the Requesting Permissions permission in WICG. None of
  the extension specifications ever defined it.

The generic sensor permission revocation algorithm was moved to the
"Abstract Operations" section. It has also been merged with the revoke
sensor permission algorithm since it was its only caller. There should not
be any user-visible effects though: the language was just made more formal
by iterating over all Sensor instances belonging to the current realm (like
the Web Bluetooth spec does) instead of hand-wavingly gathering all
platform sensors (which technically are per-navigable) with the same sensor
type.

Related to #463.

Co-authored-by: Reilly Grant <reillyeon@users.noreply.github.com>
rakuco added a commit that referenced this issue Aug 1, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to #463.
rakuco added a commit that referenced this issue Aug 1, 2023
The association was implicit so far: in some abstract operations we
retrieved a Sensor instance's "associated sensor type" without ever
specifying what it actually meant.

Doing this also simplifies algorithms that retrieved a sensor type via a
Sensor instance's platform sensor.

Related to #463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 2, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 2, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 2, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  . How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  . As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 3, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit to rakuco/sensors that referenced this issue Aug 8, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit that referenced this issue Aug 8, 2023
This commit addresses a few issues with the way frequency management was
handled in the specification:
1. "Sampling frequency" was interchangeably used as a number as well as an
   interval ("sampling frequency bounds"), and the latter was not even
   properly defined.
2. The actual bounds were not properly defined, and neither was the clamping
   process that used them.
3. There were too many frequency-related terms in use.

Let us start with the changes in the concepts and definitions:
- A platform sensor has a sampling frequency, a positive number or null.
  It represents the frequency at which the platform sensor attempts to
  retrieve data from the device sensor and it is calculated in an
  implementation-defined manner based on the `[[frequency]]` of the
  associated Sensor objects. It is therefore a mixture of the previous
  "sampling frequency" and "requested sampling frequency" definitions.
  - How the sampling process works is implementation-defined: it could be
    polling, or requesting updates at this interval, or something else
    entirely.
- A device sensor has a sampling frequency. It is similar to the above, but
  operating system or hardware dependent and opaque to this specification.
  - As such, the device sensor may choose a sampling frequency that differs
    from the platform sensor's sampling frequency and we have no control
    over it.
- A device sensor MAY report lower and/or upper sampling frequency bounds.

With the above, the actual sampling bounds are defined and checked:
- A sensor type MUST have lower and upper sampling frequency bounds. The
  lower bound is "max(implementation-defined value, optional spec-defined
  value)", and the upper bound is "min(implementation-defined value,
  optional spec-defined value)".
- A new algorithm returns a platform sensor's lower and upper sampling
  bounds as a tuple "(max(optional device sensor lower bound, sensor type
  lower bound), min(optional device sensor upper bound, sensor type upper
  bound))".
- A Sensor's `[[frequency]]` is always set to a value within a platform
  sensor's sampling bounds in "Connect to a sensor" (before that it might
  not have an associated platform sensor and should be in the "activated"
  state).
- "Set sensor settings" requires that the platform sensor sampling value
  calculated based on its associated sensors' `[[frequency]]` values lies
  within its sampling bounds.

The "optimal sampling frequency" and "requested sampling frequency" <dfn>s
have been removed, and so has the "Find the reporting frequency of a sensor
object" algorithm, which addresses point (3).

The "Automation" section has only received enough changes to avoid Bikeshed
errors and warnings, as the entire section is being rewritten.

Related to #463.

Co-authored-by: Reilly Grant <reillyeon@users.noreply.github.com>
rakuco added a commit to rakuco/sensors that referenced this issue Aug 8, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to w3c#463.
rakuco added a commit that referenced this issue Aug 10, 2023
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to #463.
rakuco added a commit that referenced this issue Aug 10, 2023
…ons (#469)

latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to #463.
rakuco added a commit that referenced this issue Feb 16, 2024
The "sensor permission names" definition is associated with a sensor type,
not a platform sensor.

Related to: #463.
rakuco added a commit that referenced this issue Feb 16, 2024
Add an algorithm that operates on specific concepts such as navigables, and
use the "origin" definition from an environment settings object, which,
according to the HTML spec, is "an origin used in security checks".

Related to: #444 (gets rid of some "browsing context" references)
Related to: #463
rakuco added a commit that referenced this issue Feb 17, 2024
The "sensor permission names" definition is associated with a sensor type,
not a platform sensor.

Related to: #463.
rakuco added a commit that referenced this issue Feb 17, 2024
Add an algorithm that operates on specific concepts such as navigables, and
use the "origin" definition from an environment settings object, which,
according to the HTML spec, is "an origin used in security checks".

Related to: #444 (gets rid of some "browsing context" references)
Related to: #463
rakuco added a commit that referenced this issue Mar 12, 2024
…sor"

Sensor's description mentions that "A Sensor object has an associated
platform sensor", but the association was never made explicitly anywhere.

Related to #463.
rakuco added a commit that referenced this issue Mar 12, 2024
Previously, part of the data associated with a platform sensor was listed in
the "Concepts" section and the rest was listed in the "Model" section, which
made it confusing to follow.

Keep the definitions listed in the "Concepts" section there, but also
reference them in "Model" so that the latter contains all data associated
with a platform sensor.

This commit is marked as editorial because it only reorganizes existing
definitions.

Related to #463.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant