Software Development Kit (SDK)

The Level-D 767-300 is shipped with a Software Development Kit (SDK). It is the first and only add-on aircraft for Microsoft FlightSimulator that offers this feature.

The SDK makes states and controls of the Level-D panel available to external programs, which is great for home cockpit builders.

On this page I will show you how to use the SDK, and how to connect your cockpit hardware to the SDK data, via Opencockpits SIOC variables or with FSUIPC offsets.

The SDK contains a header file LVLD_SDK.h with functions and data definitions in the C-language. It's a rather large file, I will show you just a few examples.

Here are the definitions of the information elements in the Level-D database (representing states in the Level-D cockpit) for the Master Lights:

 // Master lights -------------------
 int master_warning_light; // BOOL
 int master_caution_light; // BOOL

and a C-program snippet that shows how to use such an information element:

 #include "LVLD_SDK.h" // import all data definitions
 LVLDDATA Lvld; // the level-d database variable
 LVLDSession(OPEN, SDK_VERSION); // open a session
 ReadLVLDData(&Lvld); // read the level-d database
 int warning = Lvld.master_warning_light; // get master warning light
 // ... and do something with it!
 LVLDSession(CLOSE, SDK_VERSION); // close the session

Compile and link this program with LVLDSDK.lib. Put the LVLDSDK.dll in the same directory as this program. Run the program and you will have accessed the actual Master Warning Light state.

The following example is about controls (for setting switches in the Level-D cockpit). There are lots of them available, but here just the definitions for the autopilot switches of the MCP:

 // MCP Commands
 #define LVLD_AP_LEFT 1 // Left A/P CMD switch toggle
 #define LVLD_AP_CENTER 2 // Center A/P CMD switch toggle
 #define LVLD_AP_RIGHT 3 // Right A/P CMD switch toggle

and a program snippet how to use it (note I have left out opening and closing of a session, that is the same as in the example above):

 SendLVLDCommand(LVLD_AP_LEFT); // toggles left CMD switch

A working Microsoft Visual Studio 2010 Express C++ project that demonstrates reading the MCP heading value can be downloaded by clicking at the Zip file logo. Note that this example is about a separate program named 'SDKDemo.exe', a console application, that communicates with the Level-D 767 in MS Flight simulator. A slightly different aproach is to communicate from a .dll library or from a gauge. How to do that is indicated in the commentary part of the LVLD_SDK.h file.

SDKDemo.zip

Jump to top of this page


How to connect your cockpit hardware?

The examples given in the previous section look promising, but what to do next? We have the Master Warning Light "in our hands" in our C- or C++ program. How to use that information to control a led in our home cockpit? And the other way round, we are able to toggle the Left AP CMD switch of the Level-D from a C-program, but how to "connect" a physical push button as input to our C-program?

Well that is where my lekseecon program comes in. Lekseecon is a C++ program and it makes direct connections between the Level-D SDK and the Opencockpits SIOC Server. It writes the warning state in a Level-D SIOC variable in your SIOC program. Lekseecon also provides for the other way around. Pre-defined SIOC variables act as controls for switches, buttons, and so on.

There is no need for you to program in C or C++. You can work with SIOC variable 739 containing the Master Lights information and SIOC variable 275 that controls the Left AP CMD Switch.

For those of you that do not use Opencockpits IOCards and SIOC but want to interface based on FSUIPC offsets you can run lekseecon_f.exe. Offset 0x92e3 (1 byte) contains the Master Lights information and offset 0x9113 (1 byte) controls the Left AP CMD Switch.

Question

Jump to top of this page