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

A Sensor instance sends 'onchange' considering its frequency hint #195

Closed
wants to merge 1 commit into from

Conversation

pozdnyakov
Copy link

@pozdnyakov pozdnyakov commented May 10, 2017

Fixes #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:

  1. 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.
  2. consistency between the Sensor's 'onchange' notification and its attribute values.

Preview | Diff

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:
1) 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.
2) consistency between the Sensor's 'onchange' notification and its attribute values.
@pozdnyakov pozdnyakov requested a review from tobie May 10, 2017 13:00
Copy link
Member

@tobie tobie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there's one "latest reading" map per sensor type, so if you want to make those per instance, then you'll need to revamp the whole thing.

@pozdnyakov
Copy link
Author

@tobie yeah, I am recomposing the dedicated algorithms. I'll update this PR accordingly.

@pozdnyakov
Copy link
Author

This is now part of #197

@pozdnyakov pozdnyakov closed this May 18, 2017
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

Successfully merging this pull request may close these issues.

Call 'onchange' on a Senor instance considering its own frequency hint
2 participants