-
Notifications
You must be signed in to change notification settings - Fork 13
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
Behavior of distance
attribute when sensor cannot provide distance measurements?
#44
Comments
I believe the intent is that the I should note that no browser has shipped an implementation of the |
@andycarle, thanks for raising this issue. As @reillyeon noted, feedback on your preferred approach would help us tighten normative language around this attribute's behavior. The introduction section is informative and as such does not impose implementation requirements. We'd need to craft additional normative text to address your issue, which I propose we try to do if there's a significant population of proximity sensors that can only report boolean presence. I believe we should augment the following normative statement for
I think it is probably more aligned with the platform conventions to have that attribute around and specify a special value to indicate this case. Some ideas: We could return null for both "outside the sensing range" and "implementation is unable to provide" cases:
If we'd want to differentiate between the two cases change the attribute's type to e.g.
The tradeoff here is we'd loose the symmetrical behavior between Luckily there's flexibility for us to adjust the API behavior given the API hasn't yet shipped. Please let us know your thoughts and we'll clarify the spec. It is exciting to see the TC53 work unfold :-) |
@andycarle, curious which way you'd prefer to take the design for the TC53 Proximity class? Let us know and we'll figure out the W3C spec bits. |
@reillyeon @anssiko, thank you both for the informative responses; I really appreciate it. It's encouraging to hear that there's some room to work together here and align our Proximity specs. We've been impressed with the work of the W3C Devices and Sensors group and we're glad to be promoting a more coherent ecosystem for working with sensors in JavaScript. We have our next TC53 meeting next Wednesday. The couple of people who are likely to have strong opinions on this will be on that call. So, I propose that I raise this issue at that meeting for discussion and then report back here. |
Greetings! As it turned out, this topic launched a lengthy discussion on the TC53 mailing list and at our March meeting. I'll attempt to summarize that discussion here, though I'll also welcome my colleagues from TC53 to chime in. The high-level conclusion that we reached was that we prefer using The rationale basically came down to these points:
We're also exploring parallel ways of signaling the condition where a sensor is generally capable of measuring exact distances but currently cannot for some reason. For that type of situation, we have an additional mechanism for sensor drivers to use to signal faults. But we are holding off on refining that notion for individual sensor types until a future revision. So, that's where we landed. I'd be happy to make the connections between committees if further discussion between the groups would be helpful! |
Thanks @andycarle! This issue will be discussed in our upcoming meeting in the "Sensors" session: https://www.w3.org/groups/wg/das/calendar |
@domenic, wondering if maybe you could provide us with some guidance here? Is there precedence for returning |
What is the disadvantage of setting |
In discussion of this issue at our F2F meeting on April 8th a concern was raised that developers may ignore the |
Web developers with devices capable of measuring |
@larsgk maybe an observer pattern would work better then. Give the conditions and get notified if they occur |
No, there's no such precedent. Web platform APIs should use null, not undefined, for this. (Or a similar sentinel value such as positive infinity.) |
Greetings!
I am a member of Ecma TC53, working on the draft specification of ECMAScript Modules for Embedded Systems.
As part of our work on Sensor Class Patterns, we are specifying APIs for common sensor types. Where possible, we are making these APIs compatible with the related W3C Sensor specifications. For example, this is the definition in our current draft for the Proximity class.
With that as background, I had a quick question on the intended implementation of the
distance
attribute of the ProximitySensor Interface.I understand that
distance
is the sensed distance between the device and the closest sensed object and thatdistance
should benull
if no object is detected. But, the Introduction notes:What is the intended behavior of
distance
in this situation, where the sensor is only capable of a Boolean determination of object presence? Shoulddistance
be absent from the sensor instance? Or should it return a Boolean value (presumably the same value returned bynear
)? Or something else?Thank you!
- Andy
The text was updated successfully, but these errors were encountered: