Re: Sensors simplified (or not)

On 11/02/2010 17:23, Nilsson, Claes1 wrote:

> However, don't we still need some method to discover which sensors
> this actual device supports? I am considering something similar to
> Android getSensorList,
> http://developer.android.com/reference/android/hardware/SensorManager.html#getSensorList(int)

I think you're right. Right now I'd considered that you would be able to 
write:

get("AmbientAtmosphericPressure",error,success);

function error(e) {
   if (e.type==INFORMATION_UNAVAILABLE) {
     // there's no pressure sensor, so do something else
   }
}

function success(p) {
   // we have a pressure value, proceed
   watch("AmbientAtmosphericPressure", error2, success2);
}

but perhaps it's indeed better if we could write:

if (navigator.device.sysinfo.supports("AmbientAtmosphericPressure"))
   // we have a pressure value, proceed
   watch("AmbientAtmosphericPressure", error, success);
else
   // no pressure sensor, do something else

Something like that?

Max.

Received on Friday, 12 February 2010 09:27:27 UTC