Build your first USI application
A single workflow detects the simulator, establishes the correct provider, reads normalized aircraft data, and disconnects cleanly.
1. Create the SDK
using USI.Core;
using var usi = new USI.Core.USI(new USIOptions
{
Units = UnitPreferences.Aviation
});
2. Detect and connect
var running = usi.DetectAll();
if (running.Count != 1)
throw new InvalidOperationException("Select one running simulator.");
var connection = await usi.TryConnectAsync(running[0].ProviderId);
if (!connection.Success)
throw new InvalidOperationException(connection.DiagnosticMessage);
3. Read the aircraft
var position = usi.Aircraft.Position;
var airspeed = usi.Aircraft.Avionics.GetComponent<Airspeed>("Airspeed");
var latitude = await position.TryGetLatitudeDegreesAsync();
var longitude = await position.TryGetLongitudeDegreesAsync();
var altitude = await position.TryGetAltitudeMslAsync();
var ias = await airspeed!.TryGetIndicatedAirspeedAsync();
Console.WriteLine($"{latitude.Value}, {longitude.Value}");
Console.WriteLine($"{altitude.Value} · {ias.Value}");
4. Handle capability differences
Every provider uses the same object model. A feature that cannot be represented truthfully returns a typed USIResult status such as Unsupported or Unavailable; it never leaks a DataRef, SimVar, or native command into application code.
