Welcome to the Device Link Forum

Forum for the discussion of Device Link

Welcome to the Device Link Forum

Postby EURO_Snoopy on Mon Aug 01, 2005 9:01 am

Well, here it is, the place to gather together material concerning Device Link and its associated software.
I will be using material from this forum in the IL-2 Online Manual so if anybody objects to their material being used please say so.
User avatar
EURO_Snoopy
Site Admin
 
Posts: 597
Joined: Tue Dec 07, 2004 2:12 am
Location: UK

...

Postby WWSensei on Tue Aug 02, 2005 11:15 am

C++ wrapper for Devicelink for those wishing to code an application. In it I abstract away the networking stuff into an Init() call and provide examples of how to use the base methods and functions for constructing easier to use function calls.

http://www.wingwalkers.org/sensei/devicelink.zip

From the README.

Devicelink Wrapper Version 1.1.

In this zip file I included the devicelink.cpp and devicelink.h wrapper class files. You can link these in directly to your project. I also threw in a Visual Studio 6 Project file and Workspace file for building it as a library if you wanted. There is also a sample config.ini file as well.

Most of the functions are commented. I didn't include all the possible devicelink commands in the headers as I tend to create them as I need but there is enough there to use as an example if you add more.

As time goes on I will be updating this from time to time. Mostly adding new functions and will strive to make it backwards compatible.

Now, for the legal stuff.

Use at your own risk. You break something don't blame me. I've provided the raw code so you can examine it yourself. You are allowed to re-use this code in any product private or commercial I only ask that I receive credit if you do. I would also appreciate any feedback on bugs you find.



Example of a simple C++ prog using it to raise and lower the landing gear.

Code: Select all
int main(int argc, char* argv[])
{
   if (argc > 1)  //if filename provided dump messages to it
   {
      output = fopen(argv[1],"a+");
   } else     //else send output to the console
   {
      output = stderr;
   }

        C_DeviceLink my_dl;
        if (my_dl.Init(output) != TRUE)
   {
      fprintf(output,"Device Link failed to initialize!\n");
      return 0; //quit the program
   }

        // example commands already written. Can be used as examples for further commands
        my_dl.SetGearUp();  //raise the gear
        my_dl.SetGearDown();  //lower the gear
        my_dl.ToggleGear();  //toggle the position of the gear
        my_dl.StartEng1();
        my_dl.StartEng2();
        my_dl.ToggleNavLights();
        my_dl.ToggleLandLights();
        my_dl.ToggleCockpitLights();
} //end prog
WWSensei
Flight Sergeant
 
Posts: 88
Joined: Sun Dec 12, 2004 2:53 pm


Return to Device Link

Who is online

Users browsing this forum: No registered users and 2 guests