W3C home > Mailing lists > Public > public-device-apis@w3.org > February 2010

RE: Sensors simplified (or not)

From: Nilsson, Claes1 <Claes1.Nilsson@sonyericsson.com>
Date: Fri, 12 Feb 2010 15:31:19 +0100
To: 'Max Froumentin' <maxfro@opera.com>
CC: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <6DFA1B20D858A14488A66D6EEDF26AA3232A1FB29A@seldmbx03.corpusers.net>
Android getSensorList returns a list of sensor objects, from which you can retrieve information on each sensor, e.g. max range, power consumption, vendor etc. 

However, what you propose is a simple and convenient method for developers. Our goal is to keep this simple so I guess that what you propose would be sufficient.

Regards
  Claes

> -----Original Message-----
> From: Max Froumentin [mailto:maxfro@opera.com]
> Sent: fredag den 12 februari 2010 10:27
> To: Nilsson, Claes1
> Cc: public-device-apis@w3.org
> Subject: 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.h

> tml#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 14:31:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:32:17 UTC