Example c++ programme using the devicelink wrapper

Forum for the discussion of Device Link

Example c++ programme using the devicelink wrapper

Postby OMK_Jacko on Mon Feb 13, 2006 12:13 am

A long time ago I learnt C/C++ I would like to use the wrapper to try out a few things but would appreciate if someone can give me a head start with some source code doing a few things. I could foloew the logic and adapt it after.

Cheers if you can help
Air Cadet Level 2
Posts: 7
Joined: Mon Feb 13, 2006 12:07 am


Postby WWSensei on Tue Feb 14, 2006 5:57 am

Well, assumming you have all the config files set correctly all you need to do is extantiate an object of the devicelink class and then use the methods accordingly...

in your main you could declare something like:

C_DeviceLink my_dl;
my_dl.Init(); // this creates the devicelink object and initializes the primary UDP client connection

my_dl.SetGearUp(); //raises the gear if down
my_dl.SetGearDown(); //lowers the gear if up
my_dl.ToggleNavLights(); //what else? toggles nav lights
my_dl.ToggleCockpitLights(); //ditto
float left,right,nose;

left = my_dl.GetGearPos(DL_GET_LEFT_GEAR_POS);
right= my_dl.GetGearPos(DL_GET_RIGHT_GEAR_POS);
nose = my_dl.GetGearPos(DL_GET_CENTER_GEAR_POS);

my_dl.StartEng1(); //starts engine one
my_dl.StartEng2(); //starts engine 2
my_dl.SelectEng1(); //selects Engine 1

//To get the engine cycliner temp do the following:
my_dl.Set_Temp_Cyl(1); //queries server for Engine 1 cylinder temp
float eng1_temp = my_dl.Get_Temp_Cyl(1); //retrieves cylinder temp for engine one from private var and assigns to new variable. Thread safe.

char ac_id[64]; //allocate 64 byte string buffer

my_dl.GetAircraftID(ac_id); //returns aircraft ID and assigns to buffer ac_id.

Hope this helps.
Flight Sergeant
Posts: 88
Joined: Sun Dec 12, 2004 2:53 pm

Postby OMK_Jacko on Tue Feb 14, 2006 12:29 pm

Thanks WWSensei,

I will try out a simple application, I am quite rusty on programming but luv the challenge of problem solving. Soooo something else for my wife to be understanding about :)

Air Cadet Level 2
Posts: 7
Joined: Mon Feb 13, 2006 12:07 am

Return to Device Link

Who is online

Users browsing this forum: No registered users and 1 guest