- From: Anssi Kostiainen via GitHub <sysbot+gh@w3.org>
- Date: Thu, 27 Apr 2017 12:25:19 +0000
- To: public-device-apis-log@w3.org
Couple of options. I'm hearing preference toward option 2. What is your preference?
(The names are just placeholders, no need to bikeshed.)
**1) Add `lightLevel` to the existing `AmbientLightSensor`.**
Low-resolution mode:
* Grant access by default.
* Cap the polling frequency so that it mitigates the known attacks satisfactorily.
* Set `illuminance` to some fixed default value (`null`?), or round it very aggressively, again, to mitigate the known attacks. Default value or rounding? Use cases?
High-resolution mode:
* Require more explicit user permission.
* Do not cap the polling frequency as aggressively.
* Report also the `illuminance` readings with higher granularity.
```
enum LightLevel = { "dim", "normal", "washed" }; // [1]
[Constructor(optional SensorOptions sensorOptions)]
interface AmbientLightSensor : Sensor {
  readonly attribute unrestricted double? illuminance; // high-resolution mode, null? otherwise
  readonly attribute LightLevel lightLevel;
};
```
**2) Dedicated constructors: `AmbientLightSensor` for `illuminance` and `LightLevelSensor` for `lightLevel`.**
Low-resolution mode:
* As above, but with its own constructor: 
```
enum LightLevel = { "dim", "normal", "washed" };
[Constructor(optional SensorOptions sensorOptions)]
interface LightLevelSensor : Sensor {
  readonly attribute LightLevel lightLevel;
};
```
High-resolution mode:
* As above, but with its own constructor: 
```
[Constructor(optional SensorOptions sensorOptions)]
interface AmbientLightSensor : Sensor {
  readonly attribute unrestricted double illuminance;
};
```
**3. Something else.**
[1] `LightLevel ` enum values lifted from now obsoleted https://www.w3.org/TR/2016/WD-mediaqueries-4-20160126/#descdef-media-light-level
-- 
GitHub Notification of comment by anssiko
Please view or discuss this issue at https://github.com/w3c/sensors/issues/183#issuecomment-297698603 using your GitHub account
Received on Thursday, 27 April 2017 12:25:26 UTC