Re: Sensor API feedback: watch function

Responses inline

El 02/03/12 13:19, "Jonas Sicking" <jonas@sicking.cc> escribió:

>Hi All,
>
>I have a couple of questions regarding the watch function.
>
>First off, what's interaction between the 'interval' and 'threshold'
>parameters? I.e. what happens if you set both parameters? Is the
>intent that the onsensordata function should fire whenever the
>threshold is cross, but at least every x milliseconds? Or is the
>intent that the interval specifies how often the implementation is
>supposed to sample the sensor, but only fire the onsensordata event if
>the threshold has been crossed? Or are you simply not allowed to
>specify threshold and interval at the same time?
>
>I think my preference would be that if both parameters are specified,
>the threshold argument is the one that controls when onsensordata is
>fired, and the interval is a hint which tells the implementation how
>often it should check the sensor.

Make sense.

>
>Also, the spec says that the threshold only applies on sensors which
>have a numeric reading which makes sense (and is also a good place to
>start). But it doesn't define what happens if the page specifies a
>threshold for a sensor which is not numeric. Should the argument be
>ignored? Should we throw an exception?
>
>My preference would be for an exception.

>
>Also, the spec currently says that we should fire an event whenever a
>sensor reading goes below the threshold. Shouldn't we also fire it
>when the reading goes back up above the threshold? I.e. if a page
>specifies .watch({threshold: 10}) on a temperature sensor, I would
>expect to get an event both when the temperature changes from above 10
>deg C to below 10 deg C, as well as when it changes from below 10 deg
>C to above 10 deg C.

Yes. Otherwise We would need to complicate the API with Ranges and the like

>
>/ Jonas
>


Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at
http://www.tid.es/ES/PAGINAS/disclaimer.aspx

Received on Friday, 9 March 2012 16:33:11 UTC