Data Export
The aircraft exports the currently displayed text for all three MCDUs via a SimConnect ClientDataArea. The format for each MCDU is four bool
values indicating the status of the DSPY, FAIL, MSG, and OFST light (in that order). Following that is a 2-dimensional array of MCDUCHAR
objects with the bounds of 14 by 24 (14 rows, 24 characters per row).
The MCDUCHAR
structure is as follows:
#pragma pack(push, 1)
struct MCDUCHAR
{
char16_t value;
bool large = false;
};
#pragma pack(pop)
The exact export format of the MCDU data is as follows:
#define MCDU_ROWS 14
#define MCDU_COLS 24
#define MCDU_CHARS MCDU_ROWS * MCDU_COLS
#pragma pack(push, 1)
struct MCDUEXPORTDATA
{
bool dspy = false;
bool fail = false;
bool msg = false;
bool ofst = false;
MCDUCHAR text[MCDU_ROWS][MCDU_COLS];
};
#pragma pack(pop)
Take care to include the pack
preprocessor instructions and not to change the field types to ensure uniformity across architectures.
The name of the ClientDataArea registration is MD11MCDU
and the exact size of a single MCDU export defined as follows:
size_t MCDU_DATA_SIZE = sizeof(MCDUCHAR) * MCDU_CHARS + (sizeof(bool) * 4);
Example
For reference, the following code maps the IDs and associates the individual define IDs with each MCDU.
const char* const STR_CLIENT_DATA_AREA_MCDU = "MD11MCDU";
enum CLIENT_DATA_ID
{
CLIENT_DATA_ID_MCDU,
};
enum CLIENT_DATA_DEFINE_ID
{
CLIENT_DATA_DEFINE_ID_LMCDU,
CLIENT_DATA_DEFINE_ID_CMCDU,
CLIENT_DATA_DEFINE_ID_RMCDU
};
SimConnect_MapClientDataNameToID(hSimConn, STR_CLIENT_DATA_AREA_MCDU, CLIENT_DATA_ID_MCDU);
size_t MCDU_DATA_SIZE = sizeof(MCDUCHAR) * MCDU_CHARS + (sizeof(bool) * 4);
SimConnect_AddToClientDataDefinition(hSimConn, CLIENT_DATA_DEFINE_ID_LMCDU, 0, MCDU_DATA_SIZE);
SimConnect_AddToClientDataDefinition(hSimConn, CLIENT_DATA_DEFINE_ID_CMCDU, MCDU_DATA_SIZE, MCDU_DATA_SIZE);
SimConnect_AddToClientDataDefinition(hSimConn, CLIENT_DATA_DEFINE_ID_RMCDU, MCDU_DATA_SIZE * 2, MCDU_DATA_SIZE);
You can then request any, or all, of the MCDU data using SimConnect_RequestClientData
. To interact with the MCDU, you must send the relevant event ID(s) back to the simulator using SimConnect or some other system that can send custom key events.