• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Getting Data from Flight Sim

Messages
11
I am able to write data to Flight Sim now, but I am having trouble getting the data from it. If I want to get altitude, for example, is there a function I can call that returns the value immediately?

The way I have my DLL set up, I want to have variables for each parameter and a get function for each parameter. To update the variables, I want to call a single function. Is it possible? Does anyone have source code covering this besides the request data sample?

//////////////
//Pseudocode//
//////////////

// App calling DLL
SimConnectApp_GetUpdatedDataFromFlightSim();
double newAltitude = SimConnectApp_GetAltitude();

--------------------

// DLL
double Altitude;

SimConnectApp_GetUpdatedDataFromFlightSim(){
Altitude = getAltitudeFromFlightSim();
}

SimConnectApp_GetAltitude(){
return Altitude;
}
 
Hi,

Don't have any code, but look at the "tagged data" example.

You could add a global static "atl" variable to your DLL.
Have your DLL request the altitude every 1 sec or 4 sec and store it in alt.
Then have your app call the DLL and look up the "alt" global value and do what ever.

You have to weight the performance of requesting altitude every 1 second/4 seconds to just having your app request data from the DLL and wait in a loop till the DLL returns with the event request.
 
I am able to write data to Flight Sim now, but I am having trouble getting the data from it. If I want to get altitude, for example, is there a function I can call that returns the value immediately?

Not with SimConnect -- that is called "polling" and is the way the FSUIPC interface works.

SimConnect uses a server/client model, where you notify it of the data you want and how often you want it (e.g. only when it changes, the most useful method), and it notifies you one or more times later, when it provides you those data updates. It does this via "call back" procedure, in the same way as Windows messages tell you when the user interacts with your program. In fact one way of using SimConnect is to get it to send you a message when it has something for you.

Regards

Pete
 
I was able to use the tabbed data sample as an example and it works great. It is very fast, even though it isn't directly accessing the variables, and works just fine. :D
 
Back
Top