CMAltimeter¶
Inherits: RefCounted < Object
Reports relative and (iOS 15+) absolute altitude from the device barometer.
Description¶
Wraps Apple’s CMAltimeter. Use start_relative_altitude_updates() for change-from-start readings and start_absolute_altitude_updates() for sea-level-referenced readings (iOS 15+).
Requires the ``NSMotionUsageDescription`` Info.plist key.
Platform availability: Real implementation on iOS. On other platforms is_*_available returns false and calls to start updates emit altimeter_failed.
See Apple’s CMAltimeter reference.
Tutorials¶
Methods¶
authorization_status() static |
|
is_absolute_altitude_available() static |
|
is_relative_altitude_available() static |
|
void |
|
void |
|
void |
|
void |
Signals¶
absolute_altitude_updated(altitude: CMAbsoluteAltitudeData) 🔗
Emitted on the main thread when a new absolute altitude sample is available.
altimeter_failed(message: String) 🔗
Emitted when CoreMotion reports an error or when the API is unavailable on the current platform.
relative_altitude_updated(altitude: CMAltitudeData) 🔗
Emitted on the main thread when a new relative altitude sample is available.
Method Descriptions¶
int authorization_status() static 🔗
Returns Apple’s CMAuthorizationStatus integer for altimeter access (0 = notDetermined, 1 = restricted, 2 = denied, 3 = authorized).
bool is_absolute_altitude_available() static 🔗
Returns true when the device can report absolute (sea-level) altitude. Requires iOS 15 or later.
bool is_relative_altitude_available() static 🔗
Returns true when the device has a barometer capable of reporting relative altitude.
void start_absolute_altitude_updates() 🔗
Begins absolute altitude updates delivered via absolute_altitude_updated. iOS 15+; emits altimeter_failed on earlier iOS versions or other platforms.
void start_relative_altitude_updates() 🔗
Begins relative altitude updates delivered via relative_altitude_updated.
void stop_absolute_altitude_updates() 🔗
Stops absolute altitude updates.
void stop_relative_altitude_updates() 🔗
Stops relative altitude updates.