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

Clarify terminology #78

Closed
tobie opened this issue Jan 19, 2016 · 8 comments
Closed

Clarify terminology #78

tobie opened this issue Jan 19, 2016 · 8 comments
Milestone

Comments

@tobie
Copy link
Member

tobie commented Jan 19, 2016

Event name

So there's going to be only one event name and this event is going to be fired either whenever the UA feels like it or at specific intervals depending on the reporting mode. What should we call it?

  • onchange
  • ondata
  • onupdate
  • onreading
  • onsensorreading

Sensor states

A Sensor instance can be in one of three states. It can be sitting around doing nothing. It can have manifested its intention to get data from its underlying sensor. Or it can be actively be listening to that sensor's output.

What do we call those?

  • "idle"|"activating"|"active"
  • "inactive"|"activating"|"active"
  • "idle"|"registering"|"registered"
  • "idle"|"starting"|"started"
  • "idle"|"starting"|"running"

Start/Stop

Similarly, Sensor instances can walk through these states by calling one of two methods. The first method moves a sensor object from loitering to actually getting data (starting up the underlying sensor in the process if that one wasn't running already). The second method just signals that the sensor object is no longer interested in hearing about the underlying sensor's data output and that the latter is now free to shut down if there isn't someone else interested in its data.

Of course, this ties in with sensor state names.

Proposals:

  • start|stop
  • activate|deactivate
  • register|deregister
  • setup|teardown
  • provision|release
  • initialize|release
  • etc.
@tobie tobie added this to the Level 1 milestone Jan 19, 2016
@tobie tobie changed the title Calrify terminology Clarify terminology Jan 19, 2016
@tobie tobie closed this as completed Jan 28, 2016
@tobie tobie reopened this Jan 28, 2016
@tobie tobie closed this as completed in c201737 Feb 26, 2016
@tobie tobie reopened this Mar 14, 2016
@anssiko
Copy link
Member

anssiko commented Mar 14, 2016

My knee-jerk response would be:
onchange
"idle"|"starting"|"started"
start|stop

@tobie
Copy link
Member Author

tobie commented Mar 22, 2016

Went for:

onchange
"idle"|"activating"|"active"|"errored"
start|stop

Still open to change but closing this as fixed.

@tobie tobie closed this as completed Mar 22, 2016
@tobie tobie reopened this May 9, 2016
@tobie
Copy link
Member Author

tobie commented May 9, 2016

@timvolodine had alternate suggestions here.

@mwichmann
Copy link

Seems to me the most comfortable name for the third sensor state is the one used in the text introducing that section: "listening". I'd go along with Anssi's choices with that change, so:

onchange
"idle"|"starting"|"listening"
start|stop

@timvolodine
Copy link

Regarding the 'onchange' event, generally I am inclined towards something with 'update' in it, e.g. 'onupdate', 'ondataupdate' etc.. That's because 'onchange' is a bit imprecise since a sensor can produce same readings for sequential timestamps.

The state names all make sense. But apart from the naming however I am wondering how this would look like in case there is no sensor available. So upon construction the state would always be "idle" independent of whether the sensor can be activated? Once errored would it remain errored if we call stop()?

// e.g. in normal case
"idle"
| start()
"activating"
|
"active"
| stop()
"idle"

// in no-sensor case
"idle"
| start()
"activating"
|
"errored"
| stop()
?

@tobie
Copy link
Member Author

tobie commented May 16, 2016

Calling .stop() with a state of "errored" will throw an InvalidStateError exception (see spec).

This will be turned into promise rejections pending #94.

@tobie
Copy link
Member Author

tobie commented May 16, 2016

My understanding is onchange is commonly used across the platform to refer to a change in the object itself (here the reading attribute), not the underlying sensor. Given there will be a new reading object, even if the underlying values stay the same, this doesn't seem that inappropriate. That said, onupdate or even onread would work for me too.

@tobie
Copy link
Member Author

tobie commented Oct 28, 2016

Settled in #104 (comment).

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

4 participants