- From: Jonas Sicking <jonas@sicking.cc>
- Date: Fri, 2 Mar 2012 13:19:51 +0100
- To: public-device-apis@w3.org
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. 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. / Jonas
Received on Friday, 2 March 2012 12:20:53 UTC