| 1 |
class Gravity: |
| 2 |
'''Gravity facade. |
| 3 |
|
| 4 |
.. versionadded:: 1.2.5 |
| 5 |
|
| 6 |
Supported Platforms:: Android |
| 7 |
|
| 8 |
''' |
| 9 |
|
| 10 |
@property |
| 11 |
def gravity(self): |
| 12 |
'''Property that returns values of the current gravity force |
| 13 |
as a (x, y, z) tuple. Returns (None, None, None) |
| 14 |
if no data is currently available. |
| 15 |
''' |
| 16 |
return self._get_gravity() |
| 17 |
|
| 18 |
def enable(self): |
| 19 |
'''Activate the gravity sensor. Throws an error if the |
| 20 |
hardware is not available or not implemented on. |
| 21 |
''' |
| 22 |
self._enable() |
| 23 |
|
| 24 |
def disable(self): |
| 25 |
'''Disable the gravity sensor. |
| 26 |
''' |
| 27 |
self._disable() |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
def _enable(self): |
| 32 |
raise NotImplementedError() |
| 33 |
|
| 34 |
def _disable(self): |
| 35 |
raise NotImplementedError() |
| 36 |
|
| 37 |
def _get_gravity(self): |
| 38 |
raise NotImplementedError() |