• 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.

Just need NAV frequencies to finish

Messages
125
Country
unitedstates
I have a freeware app (C# MSFS) almost ready to release .. I just need to read and set NAV frequencies and IFR etc.

public void GetNavRadioStates()
{
if (!bRequestNav)
{
//NAV FREQUENCY
simconnect.AddToDataDefinition(DEFINITIONS.NavRadio, "NAV ACTIVE FREQUENCY:1", "MHz", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
simconnect.AddToDataDefinition(DEFINITIONS.NavRadio, "NAV STANDBY FREQUENCY:1", "MHz", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
simconnect.AddToDataDefinition(DEFINITIONS.NavRadio, "NAV ACTIVE FREQUENCY:2", "MHz", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
simconnect.AddToDataDefinition(DEFINITIONS.NavRadio, "NAV STANDBY FREQUENCY:2", "MHz", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
//NAV HAS GLIDE SLOPE
}
simconnect.RegisterDataDefineStruct<NavRadioStruct>(DEFINITIONS.NavRadio);
simconnect.RequestDataOnSimObject(DATA_REQUESTS.NavRadioRequest, DEFINITIONS.NavRadio, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);
}

[StructLayout(LayoutKind.Sequential, Pack = 1)] //Radio
public struct NavRadioStruct
{
public double Nav1;
public double Nav1Stnby;
public double Nav2;
public double Nav2Stnby;
}

This only returns 0 (zero)
I have tried the other data types in the Data Definition ... can someone point me to a solution in C# ... or C++ (i'll try to translate)
thanks!!
!!

EDITED FLOAT64
 
Last edited:
Messages
2,077
Country
us-ohio
Have you tried "MHz"? Just plain "MHz"? That's the unit that would be typically useful. Also, this would definitely be a float value, not an integer.
 
Messages
125
Country
unitedstates
thanks, using the Watcher doesn't receive anything with any format, but now in my program I am getting data .. it looks like 1.7837484758 needs to be converted (if the data is correct) I used float64 and stored it in a double
 
Last edited:
Messages
2,077
Country
us-ohio
You're telling it to update only when the value has changed, you're declaring it as an integer, when I doubt that it actually is, and you're telling it to store the integers in variables of type double. You're crisscrossing everything with the different declarations. Unless something is explicitly an integer value, you should use doubles. You should always request the value in the proper unit for your use. This will also require the use of a callback function to process any data returns.
 
Messages
125
Country
unitedstates
yes, I only want it to send updates to my callback

This is what works for COM frequencies

simconnect.AddToDataDefinition(DEFINITIONS.Radio, "COM ACTIVE FREQUENCY:1", "MHz", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);

returned to double

my attempt using UINT was from a very old post I found here

update: Now I have it mostly working with the FLOAT64 and double , still looking for ILS
thanks
 
Last edited:
Messages
2,077
Country
us-ohio
The variable NAV HAS GLIDE SLOPE:index would provide whether there is ILS or not. It is a bool value.
 
Top