summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/macosx/accelerometer.py
blob: ec1fe77116ae0652693e31f5b3e96a5d67a6f42a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()