Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to Read AI Aircraft List of Waypoints with Simconnect?

Featured Replies

Hello everyone,
I want to read the list of waypoints that an AI aircraft is currently following. The "AI WAYPOINT LIST" seems to be what I want but I don't understand how to extract information from it using managed C#.
I have a definition with a bunch of other variable that work, only this is giving me trouble. Some of the code im using to request the data:

simConnect.AddToDataDefinition(DEFINITIONS.DATA_DEFINITION, "AI WAYPOINT LIST", "", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);

simConnect.RegisterDataDefineStruct<Data_Definition>(DEFINITIONS.DATA_DEFINITION);

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct Data_Definition
{
<other data variables>
public SIMCONNECT_DATA_WAYPOINT waypoint;
};

Thank you in advance,
Daniel

  • Commercial Member

Hi, 

You don't need a data structure for this, but a callback instead

  1. Create a definition enum value and a data request enum only for the waypoint list 
  2. Create the callback method to receive the waypoint list data (simconnect.OnRecvWaypointList += new SimConnect.RecvWaypointListEventHandler(simconnect_OnRecvWaypointList);)
  3. drop in the AddToDataDefinition - a single one for the waypoint list (simconnect.AddToDataDefinition(DEFINITIONS.AIWAYPOINTS, "AI WAYPOINT LIST", "number", SIMCONNECT_DATATYPE.WAYPOINT, 0.0f, SimConnect.SIMCONNECT_UNUSED);)
  4. Now just request the data (simconnect.RequestDataOnSimObject(DATA_REQUESTS.AI_WAYPOINTS, DEFINITIONS.AIWAYPOINTS, ObjectID, SIMCONNECT_PERIOD.ONCE, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0);)
    The result will be transmitted to you in repeated callbacks to your simconnect_OnRecvWaypointList method.

This principle is applicable to all data requests that result in something "special", most importantly lists of any kind. First thing to do is check for an OnRecv… callback pertaining to your data request.

(not sure where I got the "number" part as DatumName from. It works for setting the waypoint list, but you may want to change it to an empty string or null).

Best regards

 

Edited by Lorby_SI

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.