ExSrpPhat.Native (ex_srp_phat v0.1.0)

Copy Markdown View Source

NIF entry points, loaded via RustlerPrecompiled.

Do not call this module directly — use ExSrpPhat.localize/3, which validates inputs and packs PCM + geometry into binaries before crossing the NIF boundary.

Precompiled binaries are downloaded from GitHub release assets; set EX_SRP_PHAT_BUILD=1 to force a source build (requires a Rust toolchain). The :dev and :test environments of this library always build from source.

Summary

Functions

WGS-84 ECEF meters → geodetic {lat_deg, lon_deg, alt_m}.

WGS-84 geodetic (deg, deg, m HAE) → ECEF {x, y, z} meters.

Functions

ecef_to_latlon_nif(x, y, z)

WGS-84 ECEF meters → geodetic {lat_deg, lon_deg, alt_m}.

latlon_to_ecef_nif(lat_deg, lon_deg, alt_m)

WGS-84 geodetic (deg, deg, m HAE) → ECEF {x, y, z} meters.

localize_nif(frames_bin, geometry_bin, opts_bin)

Run a single SRP-PHAT solve.

All three arguments are little-endian packed binaries (see ExSrpPhat.Codec):

  • frames_bin — header + row-major f64 PCM, one row per emplacement
  • geometry_bin — sample rate + f64 ECEF triples, aligned to frames_bin
  • opts_bin — packed grid bounds / resolution / max_sources

Returns {:ok, results_bin} or {:error, atom}. The NIF is overridden at load time; this stub only runs if the native library failed to load.