mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
32 lines
558 B
Python
32 lines
558 B
Python
|
'''
|
||
|
iOS Barometer
|
||
|
-------------
|
||
|
'''
|
||
|
|
||
|
from plyer.facades import Barometer
|
||
|
from pyobjus import autoclass
|
||
|
|
||
|
|
||
|
class iOSBarometer(Barometer):
|
||
|
|
||
|
def __init__(self):
|
||
|
super().__init__()
|
||
|
self.bridge = autoclass('bridge').alloc().init()
|
||
|
|
||
|
def _enable(self):
|
||
|
self.bridge.startRelativeAltitude()
|
||
|
|
||
|
def _disable(self):
|
||
|
self.bridge.stopRelativeAltitude()
|
||
|
|
||
|
def _get_pressure(self):
|
||
|
'''
|
||
|
1 kPa = 10 hPa
|
||
|
'''
|
||
|
return (
|
||
|
self.bridge.pressure * 10)
|
||
|
|
||
|
|
||
|
def instance():
|
||
|
return iOSBarometer()
|