summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/macosx/accelerometer.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/plyer/platforms/macosx/accelerometer.py')
-rw-r--r--external/plyer/platforms/macosx/accelerometer.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/external/plyer/platforms/macosx/accelerometer.py b/external/plyer/platforms/macosx/accelerometer.py
new file mode 100644
index 0000000..ec1fe77
--- /dev/null
+++ b/external/plyer/platforms/macosx/accelerometer.py
@@ -0,0 +1,25 @@
+'''
+MacOSX accelerometer
+---------------------
+'''
+
+from plyer.facades import Accelerometer
+from plyer.platforms.macosx.libs import osx_motion_sensor
+
+
+class OSXAccelerometer(Accelerometer):
+ def _enable(self):
+ try:
+ osx_motion_sensor.get_coord()
+ except:
+ raise Exception('Could not enable motion sensor on this macbook!')
+
+ def _disable(self):
+ pass
+
+ def _get_acceleration(self):
+ return osx_motion_sensor.get_coord()
+
+
+def instance():
+ return OSXAccelerometer()