@Umberto67 Thank you for the explanation, this one is fine and well understood by me, I’ve no problem with.
My post was related to the OP method:
msfs-wasm-lvar-access/src/lvar-access.cpp at main · markrielaart/msfs-wasm-lvar-access · GitHub
// Define the SimConnect custom eventHandler.
static void FSAPI EventHandler(ID32 event, UINT32 evdata, PVOID userdata) {
// Any event number from 0x11000 through 0x1FFFF is available, but might collide with other mods.
switch (event) {
case 0x11000: {
// Press MCDU button DIR
execute_calculator_code(MCDU_BUTTONS[evdata], nullptr, nullptr, nullptr);
break;
}
case 0x11001: {
// EFIS Panel modes
UINT8 LVAR_INDEX = (evdata & 0xFF);
ID idA320 = check_named_variable(LVAR_EFIS_PANEL[LVAR_INDEX]);
// Set a value
FLOAT64 LVAR_VALUE = (evdata & 0xFF00) >> 8;
set_named_variable_value(idA320, LVAR_VALUE);
break;
}
}
}
These are the one I’m saying can’t be used reliably because any other gauge could be using the same ID:
// Any event number from 0x11000 through 0x1FFFF is available, but might collide with other mods.
There is one difference between the EventHandler callback and the SimConnect callback is the former was guaranteed to be called synchronously with the event (from FS9 to P3D5), the latter is not and depends on Simconnect (it may, but I can’t find the documentation explicitly confirming this).
Otherwise for the rest, I agree with you and it is no different than X-Plane. Both are making possible using named variables and named events (datarefs and commands in X-Plane):
But there is a twist which is important to me, but maybe only me:
Here are a few of these differences pertaining to “events” (this topic):
-
X-Plane is also offering the SDK/API to intercept and filter commands. You can intercept any command, yours or otherwise, and filter them out, or let them passing through.
-
X-Plane SDK is also implicitly (by example) and explicitly (by documentation) enticing 3rd party to use a standardized naming convention in order to avoid similarly named datarefs and commands, and in order to help categorizing these by the virtue of a path-like prefix. This helps a lot preventing clashes and this also helps a lot customers finding out what command is which (see below).
-
X-Plane is also data driven in the sense any 3rd party runtime created named command can be use in the GUI exactly like its own internal named commands. This makes it very easy for 3rd party vendors to publish their own set of commands and have them bindable in the Joystick config UI for example.