XPLM API Ref XPLMNavigation Latest - 4.4.0-d4

Flight Management Computer

Note: the FMS works based on an array of entries. Indices into the array are zero-based. Each entry is a navaid plus an altitude. The FMS tracks the currently displayed entry and the entry that it is flying to.

The FMS must be programmed with contiguous entries, so clearing an entry at the end shortens the effective flight plan. There is a max of 100 waypoints in the flight plan.


XPLMCountFMSEntries

function

This routine returns the number of entries in the FMS.

XPLM_API int XPLMCountFMSEntries(void);

XPLMGetDisplayedFMSEntry

function

This routine returns the index of the entry the pilot is viewing.

XPLM_API int XPLMGetDisplayedFMSEntry(void);

XPLMGetDestinationFMSEntry

function

This routine returns the index of the entry the FMS is flying to.

XPLM_API int XPLMGetDestinationFMSEntry(void);

XPLMSetDisplayedFMSEntry

function

This routine changes which entry the FMS is showing to the index specified.

XPLM_API void XPLMSetDisplayedFMSEntry(
                         int                  inIndex
                    );

XPLMSetDestinationFMSEntry

function

This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.

XPLM_API void XPLMSetDestinationFMSEntry(
                         int                  inIndex
                    );

XPLMGetFMSEntryInfo

function

This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length.

WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.

XPLM_API void XPLMGetFMSEntryInfo(
                         int                  inIndex,
                         XPLMNavType *        outType,    /* Can be NULL */
                         char *               outID,    /* Can be NULL */
                         XPLMNavRef *         outRef,    /* Can be NULL */
                         int *                outAltitude,    /* Can be NULL */
                         float *              outLat,    /* Can be NULL */
                         float *              outLon    /* Can be NULL */
                    );

See associated types:


XPLMSetFMSEntryInfo

function

This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.

XPLM_API void XPLMSetFMSEntryInfo(
                         int                  inIndex,
                         XPLMNavRef           inRef,
                         int                  inAltitudeFt
                    );

See associated types:


XPLMSetFMSEntryLatLon

function

This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.

XPLM_API void XPLMSetFMSEntryLatLon(
                         int                  inIndex,
                         float                inLat,
                         float                inLon,
                         int                  inAltitudeFt
                    );

XPLMClearFMSEntry

function

This routine clears the given entry, potentially shortening the flight plan.

XPLM_API void XPLMClearFMSEntry(
                         int                  inIndex
                    );

XPLMNavFlightPlan

enum XPLM410

These enumerations defines the flightplan you are accesing using the FMSFlightPlan functions. An airplane can have up to two navigation devices (GPS or FMS) and each device can have two flightplans. A GPS has an enroute and an approach flightplan. An FMS has an active and a temporary flightplan. If you are trying to access a flightplan that doesn't exist in your aircraft, e.g. asking a GPS for a temp flightplan, FMSFlighPlan functions have no effect and will return no information.

Name Value Description
xplm_Fpl_Pilot_Primary 0
xplm_Fpl_CoPilot_Primary 1
xplm_Fpl_Pilot_Approach 2
xplm_Fpl_CoPilot_Approach 3
xplm_Fpl_Pilot_Temporary 4
xplm_Fpl_CoPilot_Temporary 5

Used by:


XPLMCountFMSFlightPlanEntries

function XPLM410

This routine returns the number of entries in the FMS.

XPLM_API int XPLMCountFMSFlightPlanEntries(
                         XPLMNavFlightPlan    inFlightPlan
                    );

See associated types:


XPLMGetDisplayedFMSFlightPlanEntry

function XPLM410

This routine returns the index of the entry the pilot is viewing.

XPLM_API int XPLMGetDisplayedFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan
                    );

See associated types:


XPLMGetDestinationFMSFlightPlanEntry

function XPLM410

This routine returns the index of the entry the FMS is flying to.

XPLM_API int XPLMGetDestinationFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan
                    );

See associated types:


XPLMSetDisplayedFMSFlightPlanEntry

function XPLM410

This routine changes which entry the FMS is showing to the index specified.

XPLM_API void XPLMSetDisplayedFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex
                    );

See associated types:


XPLMSetDestinationFMSFlightPlanEntry

function XPLM410

This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.

XPLM_API void XPLMSetDestinationFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex
                    );

See associated types:


XPLMSetDirectToFMSFlightPlanEntry

function XPLM410

This routine changes which entry the FMS is flying the aircraft toward. The track is from the current position of the aircraft directly to the n'th point, ignoring the point before it.

XPLM_API void XPLMSetDirectToFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex
                    );

See associated types:


XPLMGetFMSFlightPlanEntryInfo

function XPLM410

This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length.

WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.

XPLM_API void XPLMGetFMSFlightPlanEntryInfo(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex,
                         XPLMNavType *        outType,    /* Can be NULL */
                         char *               outID,    /* Can be NULL */
                         XPLMNavRef *         outRef,    /* Can be NULL */
                         int *                outAltitude,    /* Can be NULL */
                         float *              outLat,    /* Can be NULL */
                         float *              outLon    /* Can be NULL */
                    );

See associated types:


XPLMSetFMSFlightPlanEntryInfo

function XPLM410

This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs, NDBs and TACANs. Use the routines below to clear or fly to a lat/lon.

XPLM_API void XPLMSetFMSFlightPlanEntryInfo(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex,
                         XPLMNavRef           inRef,
                         int                  inAltitudeFt
                    );

See associated types:


XPLMSetFMSFlightPlanEntryLatLon

function XPLM410

This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.

XPLM_API void XPLMSetFMSFlightPlanEntryLatLon(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex,
                         float                inLat,
                         float                inLon,
                         int                  inAltitudeFt
                    );

See associated types:


XPLMSetFMSFlightPlanEntryLatLonWithId

function XPLM410

This routine changes the entry in the FMS to a lat/lon entry with the given coordinates. You can specify the display ID of the waypoint.

XPLM_API void XPLMSetFMSFlightPlanEntryLatLonWithId(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex,
                         float                inLat,
                         float                inLon,
                         int                  inAltitudeFt,
                         const char*          inId,
                         unsigned int         inIdLength
                    );

See associated types:


XPLMClearFMSFlightPlanEntry

function XPLM410

This routine clears the given entry, potentially shortening the flight plan.

XPLM_API void XPLMClearFMSFlightPlanEntry(
                         XPLMNavFlightPlan    inFlightPlan,
                         int                  inIndex
                    );

See associated types:


XPLMLoadFMSFlightPlan

function XPLM410

Loads an X-Plane 11 and later formatted flightplan from the buffer into the FMS or GPS, including instrument procedures. Use device index 0 for the pilot-side and device index 1 for the co-pilot side unit.

XPLM_API void XPLMLoadFMSFlightPlan(
                         int                  inDevice,
                         const char *         inBuffer,
                         unsigned int         inBufferLen
                    );

XPLMSaveFMSFlightPlan

function XPLM410

Saves an X-Plane 11 formatted flightplan from the FMS or GPS into a char buffer that you provide. Use device index 0 for the pilot-side and device index 1 for the co-pilot side unit. Provide the length of the buffer you allocated. X-Plane will write a null-terminated string if the full flight plan fits into the buffer. If your buffer is too small, X-Plane will write inBufferLen characters, and the resulting buffer is not null-terminated. The return value is the number of characters (including null terminator) that X-Plane needed to write the flightplan. If this number is larger than the buffer you provided, the flightplan in the buffer will be incomplete and the buffer not null-terminated.

XPLM_API unsigned int XPLMSaveFMSFlightPlan(
                         int                  inDevice,
                         char *               inBuffer,
                         unsigned int         inBufferLen
                    );