blob: e8b93cf4a6acdbd8d175d5ccf8c89140c1fe5b10 (
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
26
27
28
29
30
31
|
'''
iOS Gyroscope
---------------------
'''
from plyer.facades import Gyroscope
from pyobjus import autoclass
class IosGyroscope(Gyroscope):
def __init__(self):
super(IosGyroscope, self).__init__()
self.bridge = autoclass('bridge').alloc().init()
self.bridge.motionManager.setGyroscopeUpdateInterval_(0.1)
def _enable(self):
self.bridge.startGyroscope()
def _disable(self):
self.bridge.stopGyroscope()
def _get_orientation(self):
return (
self.bridge.gy_x,
self.bridge.gy_y,
self.bridge.gy_z)
def instance():
return IosGyroscope()
|