| 1 |
class Light: |
| 2 |
'''Light facade. |
| 3 |
|
| 4 |
Light sensor measures the ambient light level(illumination) in lx. |
| 5 |
Common uses include controlling screen brightness. |
| 6 |
|
| 7 |
With method `enable` you can turn on the sensor and |
| 8 |
`disable` method stops the sensor. |
| 9 |
|
| 10 |
Use property `illumination` to get current illumination in lx. |
| 11 |
|
| 12 |
.. versionadded:: 1.2.5 |
| 13 |
|
| 14 |
Supported Platforms:: Android |
| 15 |
''' |
| 16 |
|
| 17 |
@property |
| 18 |
def illumination(self): |
| 19 |
'''Current illumination in lx.''' |
| 20 |
return self._get_illumination() |
| 21 |
|
| 22 |
def enable(self): |
| 23 |
'''Enable light sensor.''' |
| 24 |
self._enable() |
| 25 |
|
| 26 |
def disable(self): |
| 27 |
'''Disable light sensor.''' |
| 28 |
self._disable() |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
def _get_illumination(self, **kwargs): |
| 33 |
raise NotImplementedError() |
| 34 |
|
| 35 |
def _enable(self, **kwargs): |
| 36 |
raise NotImplementedError() |
| 37 |
|
| 38 |
def _disable(self, **kwargs): |
| 39 |
raise NotImplementedError() |