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

Sensors simplified (or not)

From: Max Froumentin <maxfro@opera.com>
Date: Wed, 10 Feb 2010 17:12:57 +0100
Message-ID: <4B72DB09.8080504@opera.com>
To: "public-device-apis@w3.org" <public-device-apis@w3.org>
Looking at the similarity of all the Sensor APIs (Ambient Noise, 
Temperature, etc.), and thinking about extensibility I thought I'd merge 
all the interfaces into 1. Something like:

[NoInterfaceObject]
interface SensorReading {
     readonly attribute float? value;
     readonly attribute float? min;
     readonly attribute float? max;
     readonly attribute float? normalizedValue;
};

(don't mind the names for now.)

The value is meant to be a physical value with a unit (set by each 
sensor's specification). min and max should also be in that unit. But 
there are many sensors for which the native API doesn't report a 
physical value. For instance, the brightness is sometimes reported as a 
% value (OS X, IIRC). In other cases, the proximity sensor reports 2 
values: near and far (Android). That's why I added normalizedValue, 
which is meant to be a unit-less value from 0.0 to 1.0

- Is that a good model?
- Is there a better alternative?
- If not, are there better names than "SensorReading" and "normalizedValue"?

Max.
Received on Wednesday, 10 February 2010 16:13:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:05 GMT