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

MSFS20 Trying to get aircraft registration via SimConnect

Messages
12
Country
germany
Hello guys,

I am trying to get the current aircraft registration (f.e D-AICA). I tried it with ATC ID, but I only get strange symbols and non sense output.

So, here are my questions:
1. Is there any SimVar I can use to get the aircraft registration?
2. How to do it and avoid getting incorrect data?

Thanks very much!
 
ATC ID should be correct. If you're seeing nonsense/garbage output then perhaps you're reading/displaying the string values incorrectly in code?

Code-wise, string types need to be treated differently from numerics in a couple places of the subscription/reading procedures. Exactly what/how depends on the programming language you're using.

HTH,
-Max
 
ATC ID should be correct. If you're seeing nonsense/garbage output then perhaps you're reading/displaying the string values incorrectly in code?

Code-wise, string types need to be treated differently from numerics in a couple places of the subscription/reading procedures. Exactly what/how depends on the programming language you're using.

HTH,
-Max
Hey Max,

thanks for your answer. Here are the code snippets:

struct AircraftDataStruct {
bool isEngineRunning;
bool isOnGround;
PositionStruct position;
bool engineCombustion[2];
double engineITT[2];
double engineN2RPM[2];
std::string atcID;
};

AircraftDataStruct g_aircraftDataCurrent = {
false,
false,
{0.0, 0.0, 0.0},
{false, false},
{0.0, 0.0},
{0.0, 0.0}
};

AircraftDataStruct g_aircraftDataPrevious = {
false,
false,
{0.0, 0.0, 0.0},
{false, false},
{0.0, 0.0},
{0.0, 0.0}
};
SIMCONNECT_RECV_SIMOBJECT_DATA* pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;
if (pObjData->dwRequestID == DATA_REQUEST_ID)
{
if (pObjData->dwDefineID == DATA_REQUEST_ID)
{
std::lock_guard<std::mutex> lock(dataMutex);

char* dataPtr = (char*)&pObjData->dwData;

g_aircraftDataCurrent.isOnGround = *(DWORD*)dataPtr;
dataPtr += sizeof(DWORD);

g_aircraftDataCurrent.position.latitude = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.position.longitude = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.position.altitude = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.engineCombustion[0] = *(DWORD*)dataPtr;
dataPtr += sizeof(DWORD);

g_aircraftDataCurrent.engineCombustion[1] = *(DWORD*)dataPtr;
dataPtr += sizeof(DWORD);

g_aircraftDataCurrent.engineITT[0] = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.engineITT[1] = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.engineN2RPM[0] = *(double*)dataPtr;
dataPtr += sizeof(double);

g_aircraftDataCurrent.engineN2RPM[1] = *(double*)dataPtr;

g_aircraftDataCurrent.atcID = std::string(dataPtr);
dataPtr += 32;

double itt1Celsius = rankineToCelsius(g_aircraftDataCurrent.engineITT[0]);
double itt2Celsius = rankineToCelsius(g_aircraftDataCurrent.engineITT[1]);

bool engine1Running = g_aircraftDataCurrent.engineCombustion[0] && itt1Celsius > 100.0 && g_aircraftDataCurrent.engineN2RPM[0] > 1.0;
bool engine2Running = g_aircraftDataCurrent.engineCombustion[1] && itt2Celsius > 100.0 && g_aircraftDataCurrent.engineN2RPM[1] > 1.0;

g_aircraftDataCurrent.isEngineRunning = engine1Running && engine2Running;

g_dataUpdated = true;
}
}
break;
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "SIM ON GROUND", "Bool", SIMCONNECT_DATATYPE_INT32);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "PLANE LATITUDE", "Degrees", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "PLANE LONGITUDE", "Degrees", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "PLANE ALTITUDE", "Feet", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "GENERAL ENG COMBUSTION:1", "Bool", SIMCONNECT_DATATYPE_INT32);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "GENERAL ENG COMBUSTION:2", "Bool", SIMCONNECT_DATATYPE_INT32);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "TURB ENG ITT:1", "Rankine", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "TURB ENG ITT:2", "Rankine", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "ENG N2 RPM:1", "RPM", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "ENG N2 RPM:2", "RPM", SIMCONNECT_DATATYPE_FLOAT64);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "ATC ID", NULL, SIMCONNECT_DATATYPE_STRING32);
hr = SimConnect_RequestDataOnSimObject(hSimConnect, DATA_REQUEST_ID, DATA_REQUEST_ID, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SIM_FRAME);

I am then returning the collected information via a localhost http server in json format.
I am getting valid information, but it is not the right data (f.e when using the fenix320 with an Austrian livery, aircraft.cfg = "atc_id = "OE-LBX"")
curling my http server gives me this: "atc":{"id":"-�̰���?D-EFCS"}}

Thanks for the help!
 
One bug I see is that you don't increment the dataPtr after the line:

g_aircraftDataCurrent.engineN2RPM[1] = *(double*)dataPtr;

(needs dataPtr += sizeof(double); added afterwards)

So that would account for the extra garbage chars before the ID string.

The ID may not match the aircraft config file since it can be changed multiple ways.... like in the sim's settings or remotely by a SimConnect client, or similar. The current ID should be displayed on the label in the virtual cockpit (though I've also seen that just be blank sometimes, some bug...).

Since you know the max. length of the string, I'd probably use the std:str(*char, len) constructor to extract the string, just in case.

BTW if you want the temperatures in Celsius, you can just specify that in the AddToDataDefinition calls, eg:

hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "TURB ENG ITT:2", "celsius", SIMCONNECT_DATATYPE_FLOAT64);

HTH,
-Max
 
One bug I see is that you don't increment the dataPtr after the line:

g_aircraftDataCurrent.engineN2RPM[1] = *(double*)dataPtr;

(needs dataPtr += sizeof(double); added afterwards)

So that would account for the extra garbage chars before the ID string.

The ID may not match the aircraft config file since it can be changed multiple ways.... like in the sim's settings or remotely by a SimConnect client, or similar. The current ID should be displayed on the label in the virtual cockpit (though I've also seen that just be blank sometimes, some bug...).

Since you know the max. length of the string, I'd probably use the std:str(*char, len) constructor to extract the string, just in case.

BTW if you want the temperatures in Celsius, you can just specify that in the AddToDataDefinition calls, eg:

hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "TURB ENG ITT:2", "celsius", SIMCONNECT_DATATYPE_FLOAT64);

HTH,
-Max
Thanks, tested your improvements and they are really helpful!

Anyway, as you said the ATC ID doesn´t seem to be very reliable. In main menu I got at least the right id from the last flight, but as soon as I load into a flight the id changes to D-EFCS again.
Do you know another way to get the current aircraft registration?

Thanks!
 
I've found the "default" behavior of the IDs unpredictable, though I've never been much concerned with it. Once set via a SimConnect client, it seems to stick through aircraft changes (tail number and in ATC calls), but not always shown in the cockpit.

Isn't "D-EFCS" the sim's default or something? (I haven't booted it up in a while.) Does that show in the sim's settings, or do you have that blank/empty? I'm not sure how to force it to the aircraft config's default... if even possible.

I don't know of any other way to get the current registration, no. FWIW, from my past observations, what SimConnect returns always seems to agree with what the sim shows/uses. The ATC ID value should update if/when the registration changes on the sim side. If they're not matching, that could be some new bug, of course.

Do you need the actual registration code or do you want it for some other purpose (like, eg. detecting aircraft type).

Cheers,
-Max
 
I've found the "default" behavior of the IDs unpredictable, though I've never been much concerned with it. Once set via a SimConnect client, it seems to stick through aircraft changes (tail number and in ATC calls), but not always shown in the cockpit.

Isn't "D-EFCS" the sim's default or something? (I haven't booted it up in a while.) Does that show in the sim's settings, or do you have that blank/empty? I'm not sure how to force it to the aircraft config's default... if even possible.

I don't know of any other way to get the current registration, no. FWIW, from my past observations, what SimConnect returns always seems to agree with what the sim shows/uses. The ATC ID value should update if/when the registration changes on the sim side. If they're not matching, that could be some new bug, of course.

Do you need the actual registration code or do you want it for some other purpose (like, eg. detecting aircraft type).

Cheers,
-Max
Hey Max,

unfortunately I need the current registration to print it out on an UI. But I think I need to find another way or exclude this, as SimConnect isn´t able of handling this.
Now, I got a similiar issue.

double fuelQuantityGallons;
g_aircraftDataCurrent.fuelQuantityGallons = *(double*)dataPtr;
dataPtr += sizeof(double);
hr = SimConnect_AddToDataDefinition(hSimConnect, DATA_REQUEST_ID, "FUEL TOTAL QUANTITY", "Gallons", SIMCONNECT_DATATYPE_FLOAT64);
res["fuelQuantityGallons"]["fuel:"] = g_aircraftDataPrevious.fuelQuantityGallons;

Returns: ""fuel:":4.7610881823757142e-167"

I don´t know why, but I am massively struggling with this. Nearly every SimVar I try to read give me such values (e-randomNumber).

Thanks for all your help!
 
Change SIMCONNECT_DATATYPE_FLOAT64 to SIMCONNECT_DATATYPE_FLOAT32 and see if that matters.
 
It will definately help when returning 'aircraft on ground'. It was you that put me on to that resolution when I was having a similar problem a looong time ago. I admit though I read the OP's original code in some bemusement because it shouldn't be necessary to use a mutex and I can't help wondering if that may have something to do with the problem. I'm also struggling to understand why the OP is incrementing a pointer when it's just as easy to dump the incoming data straight into the struct.
 
Change SIMCONNECT_DATATYPE_FLOAT64 to SIMCONNECT_DATATYPE_FLOAT32 and see if that matters.
Using FLOAT32 does the same: {"fuelQuantityGallons":{"fuel:":1.4633545005490317e-22}

It will definately help when returning 'aircraft on ground'. It was you that put me on to that resolution when I was having a similar problem a looong time ago. I admit though I read the OP's original code in some bemusement because it shouldn't be necessary to use a mutex and I can't help wondering if that may have something to do with the problem. I'm also struggling to understand why the OP is incrementing a pointer when it's just as easy to dump the incoming data straight into the struct.
Removing mutex gives me the same problem.
 
Cut from my SimConnect setup. Hope this helps.
Code:
// ********************************************************************
// String variables

char SC_AIRCRAFT_TITLE[128] = "";
char SC_AIRCRAFT_REG[10] = "";

// ********************************************************************

// -----------------
// Receiving structs
// -----------------

struct STRING_DATA
{
    char title[128];
    char reg[10];
};
STRING_DATA pStrings;

struct AIRCRAFT_DATA
{
    bool acftOnGnd;
};
AIRCRAFT_DATA pAD;

struct FUEL_DATA
{
    double leftAuxTank;
    double rightAuxTank;
    double centreTank;
    double centreTank2;
    double centreTank3;
    double externalTank1;
    double externalTank2;
    double rightTipTank;
    double leftTipTank;
    double leftMainTank;
    double rightMainTank;
};
FUEL_DATA pFLD = {0};        // Levels
FUEL_DATA pFLC = {0};        // Capacity

// ********************************************************************

enum DATA
{
// ----------------------------
// Data requests
// ----------------------------
    REQUEST_NONE = 0,
    REQUEST_AIRCRAFT_DATA,
    REQUEST_FUEL_LEVEL,
    REQUEST_FUEL_CAPACITY,
    REQUEST_STRINGS,
 
// -----------------------------
// Defines for read
// ----------------------------
    DEFINE_AIRCRAFT_DATA,
    DEFINE_TANK_FUEL_LEVELS,
    DEFINE_TANK_FUEL_CAPACITY,
    DEFINE_STRINGS
};

// ********************************************************************

// --------------------
// AddToDataDefinitions
// --------------------
    // String data
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_STRINGS, "Title", "", SIMCONNECT_DATATYPE_STRING128);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_STRINGS, "ATC ID", "", SIMCONNECT_DATATYPE_STRING32);
 
    // On ground
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_AIRCRAFT_DATA, "Sim On Ground", "bool", SIMCONNECT_DATATYPE_INT32); 
 
    // Assign all tanks *capacity* to one definition for read
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK LEFT AUX CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK RIGHT AUX CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK CENTER CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK CENTER2 CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK CENTER3 CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK EXTERNAL1 CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK EXTERNAL2 CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK RIGHT TIP CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK LEFT TIP CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK LEFT MAIN CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_CAPACITY, "FUEL TANK RIGHT MAIN CAPACITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);

    // Assign all tanks **levels** to one definition for read
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK LEFT AUX QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK RIGHT AUX QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK CENTER QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK CENTER2 QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK CENTER3 QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK EXTERNAL1 QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK EXTERNAL2 QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK RIGHT TIP QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK LEFT TIP QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK LEFT MAIN QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
    hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_TANK_FUEL_LEVELS, "FUEL TANK RIGHT MAIN QUANTITY", "GALLONS", SIMCONNECT_DATATYPE_FLOAT64);
 
// --------------------------------------------------------------------------------------------------------------------------------------------------
// Register requests with SimConnect
// --------------------------------------------------------------------------------------------------------------------------------------------------
    hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_AIRCRAFT_DATA, DEFINE_AIRCRAFT_DATA, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND, NULL, NULL, NULL, NULL);
    hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_STRINGS, DEFINE_STRINGS, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND, NULL, NULL, NULL, NULL);
    hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_FUEL_CAPACITY, DEFINE_TANK_FUEL_CAPACITY, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_ONCE, NULL, NULL, NULL, NULL);
    hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_FUEL_LEVEL, DEFINE_TANK_FUEL_LEVELS, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND, NULL, NULL, NULL, NULL);
 
// ********************************************************************

// -------------------------
// On receive SimObjectData 
// -------------------------

    //-----------------------------------------------------
    // String data
    //-----------------------------------------------------
    if (pObjData->dwRequestID == REQUEST_STRINGS)
    {
        string_data* pStringData = (string_data*)&pObjData->dwData;
        pStrings = *pStringData;
    }

// The aircraft title and registration is now available in pStringData e.g.
//
//        memset(SC_AIRCRAFT_TITLE, 0, 128);
//        strncpy(SC_AIRCRAFT_TITLE, pStrings.title, strlen(pStrings.title) + 1);
//
//        memset(SC_AIRCRAFT_REG, 0, 10);
//        strncpy(SC_AIRCRAFT_REG, pStrings.reg, strlen(pStrings.reg) + 1);
//
// Note the use of strlen() and not sizeof(). sizeof() barfs on any spaces

    //-----------------------------------------------------
    // Aircraft data
    //-----------------------------------------------------
    if (pObjData->dwRequestID == REQUEST_AIRCRAFT_DATA)
    {
        aircraft_data* pAircraftData = (aircraft_data*)&pObjData->dwData;
        pAD = *pAircraftData;
     
// aircraft on ground is now available in pAD.acftOnGnd as a boolean
    } 
 
    //-----------------------------------------------------
    // Fuel
    //-----------------------------------------------------
    // Fuel capacity
    if (pObjData->dwDefineID == DEFINE_TANK_FUEL_CAPACITY)
    {
        FUEL_CAPACITY_DATA* pFuelCapacity = (FUEL_CAPACITY_DATA*)&pObjData->dwData;
        pFLC = *pFuelCapacity;
    } 
 
  // Fuel levels
    if (pObjData->dwDefineID == DEFINE_TANK_FUEL_LEVELS)
    {
        FUEL_LEVEL_DATA *pFuelLevelData = (FUEL_LEVEL_DATA*)&pObjData->dwData;
        pFLD = *pFuelLevelData;
    }

// Fuel levels and fuel capacity are now available in the pFLD and pFLC structs.
 
Last edited:
I need the current registration to print it out on an UI. But I think I need to find another way or exclude this, as SimConnect isn´t able of handling this.

I don't understand what you mean... Is the request for ATC ID returning the wrong ID for you? Or you still have extra characters in the result?


Returns: ""fuel:":4.7610881823757142e-167"

I don´t know why, but I am massively struggling with this. Nearly every SimVar I try to read give me such values (e-randomNumber).
It's hard to diagnose code/results from snippets and partial details... sorry.

In theory this could be a "valid" result (eg. close to zero fuel), though seems unlikely, especially if you're seeing other unlikely values.
Are you comparing the values you're seeing to some other source of the data (like Developer view or something like simvar watcher, etc)?

Personally I'd break up the requests so each piece of data (SimVar) gets its own REQUEST_ID. Then process them individually as the data comes in.
One advantage is that you don't have to process the whole struct of values every time any one of them changes (eg. "sim on ground" will change a lot less often than airplane positions).​
Another is that any async errors, for example from AddToDataDefinition calls, will not affect the overall delivered data struct. And may in general be easier to debug by breaking stuff up.​

Make sure to monitor for SimConnect EXCEPTION type messages and print/log them for debug. It may be trying to tell you something.

I'd recommend to debug the C++ results as directly as possible so as to narrow down the source of the issue (you mentioned JSON/http layer earlier, which may complicate things... not sure which debug info you're looking at).

Cheers,
-Max
 
Back
Top