Sideband/sbapp/plyer/platforms/ios/barometer.py

32 lines
564 B
Python
Raw Normal View History

2022-09-16 10:07:57 -06:00
'''
iOS Barometer
-------------
'''
2024-06-02 10:31:58 -06:00
from sbapp.plyer.facades import Barometer
2022-09-16 10:07:57 -06:00
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()