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

Reading attributes at different sensor states #168

Closed
pozdnyakov opened this issue Jan 31, 2017 · 4 comments · Fixed by #230
Closed

Reading attributes at different sensor states #168

pozdnyakov opened this issue Jan 31, 2017 · 4 comments · Fixed by #230
Assignees
Labels
Milestone

Comments

@pozdnyakov
Copy link

The spec says " all latest reading entries is initially set to null", however what shall be returned

  1. by a Sensor instance in "errored" state
  2. by a Sensor instance in "idle" state
  3. by a Sensor instance in any state except "activated" if there is another Sensor instance of the same type in "activated" state (i.e. reading entries are being updated)
@tobie
Copy link
Member

tobie commented Jan 31, 2017

These are great questions. Needs agreement and fixing the spec accordingly.

@pozdnyakov
Copy link
Author

my proposal would be to return reading values only in "activated" state and return null otherwise

@tobie
Copy link
Member

tobie commented Jan 31, 2017

my proposal would be to return reading values only in "activated" state and return null otherwise

That's probably the most sensible thing to do.

I think the easiest solution is for me to add an abstract operation to get a value from the latest reading which takes sensor and key as argument and returns value or null.

Then you can just define your attribute getters roughly as:

Return [=get value from latest reading=] with |this| as |sensor_instance| and |attribute_name| as |key|.

@pozdnyakov
Copy link
Author

pozdnyakov commented Jan 31, 2017

sounds great!

@tobie tobie added this to the Level 1 milestone Feb 20, 2017
@tobie tobie added the ED-ready label Feb 20, 2017
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue May 18, 2017
This patch contains massive refactoring of the abstract operations and internal slots used in the Sensor interface specification.

The refactoring goals are:
 - Recompose abstract operations so that duplication of the algorithms steps is removed.
 - Drop the unused abstract operations and internal slots.

Also the change brings the following behavioral changes:

Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:
 -  appearance of a new Sensor instance with a higher frequency hint does not affect the behavior of the existing Sensor instances of the same type.
 -  consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.

The "Handle Errors" abstract operation deactivates the given Senor object.
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue May 18, 2017
This patch contains massive refactoring of the abstract operations and internal slots used in the Sensor interface specification.

The refactoring goals are:
 - Recompose abstract operations so that duplication of the algorithms steps is removed.
 - Drop the unused abstract operations and internal slots.

Also the change brings the following behavioral changes:

Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:
 -  appearance of a new Sensor instance with a higher frequency hint does not affect the behavior of the existing Sensor instances of the same type.
 -  consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.

The "Handle Errors" abstract operation deactivates the given Senor object.
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue May 23, 2017
…d internal slots used in the Sensor interface specification.

The refactoring goals are:

    Recompose abstract operations so that duplication of the algorithms steps is removed.
    Drop the unused abstract operations and internal slots.

Also the change brings the following behavioral changes:

Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:

    appearance of a new Sensor instance with a higher frequency hint does not affect the behavior of the existing Sensor instances of the same type.
    consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.

Fixes w3c#199
Fixes w3c#200
Fixes w3c#201
Fixes w3c#203
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue May 23, 2017
Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:

- appearance of a new Sensor instance with a higher frequency hint does not affect the
  'onchange' notification of the existing Sensor instances of the same type.
- consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue May 26, 2017
Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:

- appearance of a new Sensor instance with a higher frequency hint does not affect the
  'onchange' notification of the existing Sensor instances of the same type.
- consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.
tobie added a commit to tobie/sensors that referenced this issue May 31, 2017
tobie added a commit that referenced this issue May 31, 2017
pozdnyakov pushed a commit to pozdnyakov/sensors that referenced this issue Jun 28, 2017
…d internal slots used in the Sensor interface specification.

The refactoring goals are:

    Recompose abstract operations so that duplication of the algorithms steps is removed.
    Drop the unused abstract operations and internal slots.

Also the change brings the following behavioral changes:

Fixes w3c#152. Each Sensor instance reads the sensor readings considering its individual
frequency hint, sends 'onchange' and caches the sensor latest reading at this moment.
The Sensor's attributes return values from the cached reading.
Thus we achieve:

    appearance of a new Sensor instance with a higher frequency hint does not affect the behavior of the existing Sensor instances of the same type.
    consistency between the Sensor's 'onchange' notification and its attribute values.

Fixes w3c#168. A Sensor object returns reading values only in "activated" state and returns null otherwise.

Fixes w3c#199
Fixes w3c#200
Fixes w3c#201
Fixes w3c#203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants