-
Notifications
You must be signed in to change notification settings - Fork 59
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
Find a better name for 'unconnected' state #160
Comments
Agree "unconnected" is bad. I guess the question is whether you think of the |
could be also "initial" |
"pending" ? |
"ready"? that is what is used elsewhere |
@kenchris that's the state prior to knowing whether there's an available sensor. So I don't think "ready" is appropriate. |
IMO, "pending" more looks like we've already called smth. and wait for a feedback. |
But you are ready to call start right? and start will determine if there is a sensor? |
Yes. Still, that's awkward. What are the existing examples of this? |
It sounds like a very /uncertain/ state :-) Maybe that states should be changed instead. I guess promises currently solves this issue |
You can't really use promises with an event driven interface, it's weird. We've gone through this conversation already. :) |
What about we use "idle" at first and then "deactivated" after calling |
so idle | activating | active | deactivated ? |
Then why isnt there a deactivating, or an inactive (idle)? inactive | active | deactivated ? |
Because the process of deactivating is actually synchronous. You just flip a bit. |
And that is the case on all systems? inactive | activating | active | deactivated | |
Yes. The system's irrelevant here, really. |
+1 for "activate" semantics |
@pozdnyakov should we also match the method names in that case?
|
@tobie yeah, think it's worth being consistent. |
@rwaldron I know you have better things to do (much <3), but when you have time, thoughts on the above appreciated. |
@tobie can this issue be fixed now (after it was discussed at WG call)? |
Yeah, we can fix the status now and fix the method names later. |
Fixes w3c#160. Brings consistent names for Sensor's states and methods.
Fixes w3c#160. Brings consistent names for Sensor's states and methods.
@rwaldron can you please look at this and share your thoughts? Thanks. |
I don't understand this.
"activating" just means changing from "idle" to "activated".
They do, but since this is by design not observable (so the UA can shut the sensor down or keep it active if others are still relying on it), calling
That's a good question. I'll give you another one: which states do you think the API consumers would like to know, and which state changes do you think they be interested in? |
'I am idle, I am active' vs 'I idled the day away, I activated the washing machine.'
I guess most want to know whether something is running or not running, whether to call start or stop. You know when it is active as you will get your first reading :). I had the same issues before like, when I call start() I don't care if it is already started, I just want to make sure it will start as soon as possible, because I need it. Same with stop, just stop as soon as you can, whether you are running or not. I don't want an API where I am kind of forced to look at states, especially if these states are not 100% trustworthy. |
On the platform, change in state are reflected with an [INFINITIVE] event which changes the object to an [PAST-TENSE] state, e.g. "load" event -> "loaded" state, "activate" event -> "activated" state. That's why we're not using "active" as a state. Maybe "idle" isn't the right state name either, given that context.
Well, you'll also get an "activated" event. That said, in the future, your first reading could be a cached reading, or it could also be a reading from your previous activation if we keep them around rather than replace them by |
Yes, I think it should be "idled". Will there be an onidled event handler as well? Hmm, old cached readings would probably be quite bad though, as many changes can have happened since I used the sensor last and mixing those with new readings will introduce errors. What is the use-case for that? |
Well, "stopped" in that case. But then that's weird as first state. I don't want to bikeshed this into eternity, though.
No, because it's sync.
Saving battery, e.g. for geolocation. Maybe this needs its own API, though. Tracked here: #89 |
Moving this forward, I'd like us to answer the following questions here:
|
That said, I think some of those questions tie into how we plan to expose data for high-frequency sensors (e.g. will data be exposed on attributes? When a sensor has been stopped, can you still query it's last state? etc.). I think we need to make progress there before we can settle on a decision here. |
As far as I remember, initially states were considered at |
as for data in |
This was a requirement for geolocation. Providing pre-activation readings. |
You're right. :-/ I was wondering how that would work once we look at HF sensors, e.g.: sensor.stop();
sensor.getQuaternion(buffer); // or however we'll call that Would that throw? Return the latest reading? Etc. |
for getters like this it's enough to have binary state: if The difference with start()/stop() is that such methods (like |
Could you please give some more details? What are these pre-activation readings and how they are supposed to be used? |
GPS is slow at making a connection, so often last position serves the purpose until a new reading becomes available (after calibrating and getting all satellite connections) |
Yeah, the use case are described with examples in the geolocation spec's intro. I think having specific methods for this is what makes the most sense, so you can disregard my pushback here. Following @pozdnyakov's input here, it seems we can try to give an answer to at least some of the questions above. Here are mine with some rationale to them:
|
@tobie I just want to tick off your list:
|
+1 to #160 (comment) @tobie Did I get it right that we agreed to drop |
Fixes w3c#160. Embarking on a three sensor states set up. States are 'idle', 'activating', 'activated'.
Yes. |
Addresses #160. States are now 'idle', 'activating', 'activated'.
Reopening so we can:
|
The 'unconnected' state is supposed to represent the initial sensor state before the 'start()' method is called for the first time, i.e. before we know if the sensor of the given type is actually present in the device.
The problem is that 'unconnected' looks confusing -- it could be treated as if sensor is physically unconnected from the device (for example a USB sensor hub). So renaming is advisable, possible options could be "unintialized" or "undefined".
The text was updated successfully, but these errors were encountered: