Skip to content

TMSFMXNativeCMAltimeter

Usage

Use the TMSFMXNativeCMAltimeter component to detect changes of altitude-related data to your app. (iOS 8 or later)

Methods

Methods name Description
Altimeter Returns a reference to native the CMAltimeter class.
RelativeAltitudeAvailable Verify whether your device is capable of monitoring changes in relative altitude.
StartRelativeAltitudeUpdates Starts monitoring changes in relative altitude.
StopRelativeAltitudeUpdates Stops monitoring changes in relative altitude.

Events

Events name Description
OnRelativeAltitudeChanged Event called when the relative altitude changes.
OnRelativeAltitudeError Event called when an error occurred during relative altitude data changes.

Sample obtaining relative altitude updates

Through an anonymous method

if TMSFMXNativeCMAltimeter1.RelativeAltitudeAvailable then
begin
  TMSFMXNativeCMAltimeter1.StartRelativeAltitudeUpdates(
  procedure (AData: TTMSFMXNativeCMAltitudeData)
  begin
    Label1.Text := 'Relative altitude is ' +  floattostr(AData.RelativeAltitude);
    Label2.Text := 'Pressure is ' +  floattostr(AData.Pressure);
  end
  )
end;

Through an event

if TMSFMXNativeCMAltimeter1.RelativeAltitudeAvailable then
  TMSFMXNativeCMAltimeter1.StartRelativeAltitudeUpdates;

procedure TForm107.TMSFMXNativeCMAltimeter1RelativeAltitudeChanged(
  Sender: TObject; AData: TTMSFMXNativeCMAltitudeData);
begin
  Label1.Text := 'Relative altitude is ' +  floattostr(AData.RelativeAltitude);
  Label2.Text := 'Pressure is ' +  floattostr(AData.Pressure);
end;