summaryrefslogtreecommitdiff
path: root/external/plyer/facades/accelerometer.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/plyer/facades/accelerometer.py')
-rw-r--r--external/plyer/facades/accelerometer.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/external/plyer/facades/accelerometer.py b/external/plyer/facades/accelerometer.py
new file mode 100644
index 0000000..e8146bf
--- /dev/null
+++ b/external/plyer/facades/accelerometer.py
@@ -0,0 +1,36 @@
+class Accelerometer(object):
+ '''Accelerometer facade.
+ '''
+
+ @property
+ def acceleration(self):
+ '''Property that returns values of the current acceleration
+ sensors, as a (x, y, z) tuple. Returns (None, None, None)
+ if no data is currently available.
+ '''
+ return self.get_acceleration()
+
+ def enable(self):
+ '''Activate the accelerometer sensor. Throws an error if the
+ hardware is not available or not implemented on.
+ '''
+ self._enable()
+
+ def disable(self):
+ '''Disable the accelerometer sensor.
+ '''
+ self._disable()
+
+ def get_acceleration(self):
+ return self._get_acceleration()
+
+ # private
+
+ def _enable(self):
+ raise NotImplementedError()
+
+ def _disable(self):
+ raise NotImplementedError()
+
+ def _get_acceleration(self):
+ raise NotImplementedError()