Which DeviceLink Variables Online.

Forum for the discussion of Device Link

Which DeviceLink Variables Online.

Postby 3./JG51_Specter on Mon May 22, 2006 1:45 am

I'm in the beginning stages of constructing my own simpit. I was concerned when I kept reading that devicelink was useless online. I wanted to avoid constructing multiple interfaces for off and online. So not being satisfied with word of mouth I endeavered to find out how useless it truely is. I wrote a quick and dirty c program to query the (4) and (6) parameters.

This is from an online dogfight mission, I'm in an he-111 sitting on the ramp with the engines running. Some of the variables may say they are inaccessible, i.e. supercharger prev, but its at the 1st stage. So some common sense needs to be taken into account when looking at the output.

The verdict, not to bad actually. It seems the only functionality you loose is the instrumentation. Thought others might be interested so here's some the output.

The numbers and names follow the devicelink.txt file in the root dir.
odd - set, even - get

Code: Select all
Version(2) - True
Accessible Get(4) - True
Accessible Set(6) - True
Camera Turn Angles(11) - True
Time of Day(20) - True
Aircraft Model(22) - True
Cockpit Quantity(24) - True
Current Cockpit(26) - True
Engine Quantity(28) - False

Airspeed Indicator(30) - False
Variometer(32) - False
Slip(34) - False
Turn(36) - False
Angular Speed(38) - False
Altimeter(40) - False
Azimuth(42) - False
Beacon Azimuth(44) - False
Roll(46) - False
Pitch(48) - False
Fuel(50) - False
G Load(52) - False
Shake Level(54) - False
Left Gear Position(56) - False
Right Gear Position(58) - False
Center Gear Position(60) - False
Magneto(62) - False
Tachometer(64) - False
Manifold Pressure(66) - False
Intake Oil Temperature(68) - False
Outlet Oil Temperature(70) - False
Water Temperature(72) - False
Cylinder Temperature(74) - False

Throttle(80) - True
Throttle(81) - True
Flaps(82) - True
Flaps(83) - True
Aileron(84) - True
Aileron(85) - True
Elevator(86) - True
Elevator(87) - True
Rudder(88) - True
Rudder(89) - True
Brakes(90) - True
Brakes(91) - True
Prop Pitch(92) - True
Prop Pitch(93) - True
Aileron Trim(94) - True
Aileron Trim(95) - True
Elevator Trim(96) - True
Elevator Trim(97) - True
Rudder Trim(98) - True
Rudder Trim(99) - True
Stabilizer(100) - True
Stabilizer(101) - True

Ignition(103) - True
Boost (WEP)(104) - True
Boost (WEP)(105) - False
Magneto Next(106) - True
Magneto Next(107) - True
Magneto Prev(108) - True
Magneto Prev(109) - True
Supercharger Next(110) - True
Supercharger Next(111) - True
Supercharger Prev(112) - True
Supercharger Prev(113) - True
Select All Engines(115) - True
Unselect All Engines(117) - True
Select Left Engines(119) - True
Select Right Engines(121) - True
Select Engine #1(123) - True
Select Engine #2(125) - True
Select Engine #3(127) - True
Select Engine #4(129) - True
Select Engine #5(131) - True
Select Engine #6(133) - True
Select Engine #7(135) - True
Select Engine #8(137) - True
Toggle All Engines(139) - True
Toggle Left Engines(141) - True
Toggle Right Engines(143) - True
Toggle Engine #1(145) - True
Toggle Engine #2(147) - True
Toggle Engine #3(149) - True
Toggle Engine #4(151) - True
Toggle Engine #5(153) - True
Toggle Engine #6(155) - True
Toggle Engine #7(157) - True
Toggle Engine #8(159) - True
Fire Extinguisher(161) - False
Feather Prop(162) - True
Feather Prop(163) - True
Gear Position(164) - True
Toggle Gear(165) - False
Raise Gear Manually(167) - False
Lower Gear Manually(169) - False
Cowl/Armor Flaps(171) - True
Airbrake(172) - True
Airbrake(173) - False
Lock Tail Wheel(174) - True
Lock Tail Wheel(175) - True
Jettison Drop Tanks(177) - True
Attach/Detach Aircraft(179) - False
Weapon 1(180) - True
Weapon 2(181) - True
Weapon 2(182) - True
Weapon 2(183) - True
Weapon 3(184) - True
Weapon 3(185) - True
Weapon 4(186) - True
Weapon 4(187) - True
Weapon 1+2(188) - True
Weapon 1+2(189) - True
Toggle Gun Pods(190) - True
Toggle Gun Pods(191) - False
Toggle Sight Mode(193) - True
Increase Sight Distance(195) - True
Decrease Sight Distance(197) - True
Adjust Sight Right(199) - True
Adjust Sight Left(201) - True
Increase Sight Altitude(203) - True
Decrease Sight Altitude(205) - True
Increase Sight Velocity(207) - True
Decrease Sight Velocity(209) - True
Canopy(212) - True
Canopy(213) - False
Arrestor Hook(214) - True
Arrestor Hook(215) - False
Chocks(216) - True
Chocks(217) - False
Gunner Fire(220) - True
Gunner Fire(221) - False
Gunner Move(223) - False
Gunner Position(301) - True
Jump to Cockpit #1 (Pilot)(303) - True
Jump to Cockpit #2(305) - True
Jump to Cockpit #3(307) - True
Jump to Cockpit #4(309) - True
Jump to Cockpit #5(311) - True
Jump to Cockpit #6(313) - True
Jump to Cockpit #7(315) - True
Jump to Cockpit #8(317) - True
Jump to Cockpit #9(319) - True
Jump to Cockpit #10(321) - True
FOV 90(323) - True
FOV 85(325) - True
FOV 80(327) - True
FOV 75(329) - True
FOV 70(331) - True
FOV 65(333) - True
FOV 60(335) - True
FOV 55(337) - True
FOV 45(341) - True
FOV 40(343) - True
FOV 35(345) - True
FOV 30(347) - True
Toggle FOV(348) - True
Toggle FOV(349) - True
Increase FOV(351) - True
Decrease FOV(353) - True
Cockpit View(355) - True
No Cockpit View(357) - True
External View(359) - True
Next Friendly View(361) - True
Next Enemy View(363) - True
Fly-by View(365) - True
Padlock Enemy(367) - True
Padlock Friendly(369) - True
Padlock Enemy Ground(371) - True
Padlock Friendly Ground(373) - True
Padlock Next(375) - True
Padlock Prev(377) - True
Instant View Forward w/ Padlock(379) - True
Padlock Enemy (ext)(381) - True
Padlock Friendly (ext)(383) - True
Padlock Closest Enemy (ext)(385) - True
Padlock Enemy Ground (ext)(387) - True
Padlock Friendly Ground (ext)(389) - True
Padlock Closest Enemy Ground (ext)(391) - True
Chase View(393) - True
Friendly Chase View(395) - True
Enemy Chase View(397) - True
Toggle Gunsight(399) - True
Autopilot(401) - True
Level Autopilot(403) - True
Bailout(405) - True
Gunsight Dimmer(407) - True
Cockpit Lights(409) - True
Nav Lights(411) - True
Landing Lights(413) - True
Wingtip Smoke(415) - True
Map(417) - True
Chat(419) - True
Online Rating(421) - True
Speed Bar(423) - True
Icon Types(425) - True
Mirrors(427) - True
Quick Start/Save Track(429) - True
Radio Mute(431) - True
Radio Channel Switch(433) - True
Time Acceleration(435) - False
Normal Time(437) - False
Time Deceleration(439) - False
Pause(441) - False
Next Ratings Page(443) - True
Seat Position(447) - True
Time Skip(449) - False
Image
User avatar
3./JG51_Specter
Lance Air Corporal
 
Posts: 24
Joined: Sun May 21, 2006 4:09 am
Location: USA

Postby BaLrOg on Mon May 22, 2006 7:10 pm

Cheers for that spectre. Sure will come in handy As would a peek at your code too :D

Just to see how you achieved your output and results.

As far as I can tell Madtoc and WWSensei are the only ones that have actually coded anything for device link in C++ and I believe all of the funtions on Madtoc's virtal cockpit can be used online?

regards

Balrog
User avatar
BaLrOg
Corporal
 
Posts: 26
Joined: Thu May 11, 2006 5:51 pm
Location: Wiltshire, UK

Postby 3./JG51_Specter on Mon May 22, 2006 11:20 pm

BaLrOg wrote:Cheers for that spectre. Sure will come in handy As would a As far as I can tell Madtoc and WWSensei are the only ones that have actually coded anything for device link in C++ and I believe all of the funtions on Madtoc's virtal cockpit can be used online?


All of the inputs will work, but the instrumentation (i.e. Altimeter, Variometer, Artificial Horizon, etc ...) will only work in single player mode. It says this in the devicelink.txt, but I wasn't sure if it meant devicelink doesn't work online or just the instrumentation part of it.

Here's the source code, it was more of a proof of concept for a bigger project so don't expect anything to grand. You'll need a gnu C compiler to build it and need to change the address and port in the source.

No real need for a makefile, this is the only command you need.
gcc -o dl dl.c

dl.c
Code: Select all
/*
* File: dl.c
* Purpose:   This is a small c application that polls the 1C/Maddox Il-2 series device link interface
*      for the current state of the access parameters.  Prints all results to stdout.
*
* Req'd:   utilizes gnu libraries any unix-like OS should compile fine or port (i.e. cygwin)
*      
* Version:   1.0
* Author:   Chris Guthrie (3./JG51_Specter)
*
* Legal Stuff:
*      I submit this source code under the BLA (Beer License Agreement).  You are free to
*      use this code in anyway you like.  I only request that I receive credit where do.  Also,
*      if we happen to find ourselves in a pub somewhere, share how you found this
*      useful over a round or two.
*
*      Use at your own risk, I'm not responsible for any damages or problems that might
*      be directly or indirectly caused by this source code.  This includes bashing your head
*      on the keyboard out of frustration.
*/      
#include <sys/socket.h>
#include <netinet/in.h>

#include "il2code.h"

//change these to point to your il-2 game computer and port set in conf.ini
#define DL_ADDRESS "10.0.0.100"
#define DL_PORT   27500

void parseOutput (char * str) {
   //converts Devicelink answers from 4/6 parameter requests
   //to human readable form
   char * start = str;
   char * stop;
   char * ptr;
   int param;
   
   char buffer[256];
   
   //loops through str
   for (stop = start + 1; *stop != 0; stop++) {
      if (*stop == '/' || *(stop+1) == 0) {
         //a new parameter is found
         if (*start != 'A') {
            //parses parameter if it isn't the answer header
            memset (buffer, 0, sizeof(buffer));            
            //copies A/{##\##} substring enclosed in curly brace to buffer
            strncpy (buffer, start, stop - start + 1);         
            //finds the \
            for (ptr = buffer; *ptr != '\\'; ptr ++) {;}
            ptr++;
            
            //outputs Name(Param #) - State
            param = atoi (ptr);            
            if (IL2CODES[param][0] != '-')
               printf ("%s(%i) - %s\n",
                  IL2CODES[param], param,
                  (buffer[strlen(buffer) - 1] == '0')?"False":"True");
         }
         start = stop + 1;
         stop = start + 1;
      }
   }
}
         
         
int main (int argc, char *argv[]) {

   struct sockaddr_in sin;
   struct sockaddr_in reply;   
   int s;
   int i;   
      
   int nreply = sizeof(struct sockaddr_in);
      
   char str[256];   
   char buffer[256];
   
   memset ( (char*) &sin, 0, sizeof(struct sockaddr_in));
   memset ( (char*) &reply, 0, sizeof(struct sockaddr_in));
      
   //set up UDP to server address and port
   sin.sin_family = AF_INET;
   sin.sin_addr.s_addr = inet_addr (DL_ADDRESS);
   sin.sin_port = htons(DL_PORT);

   s = socket (AF_INET, SOCK_DGRAM, 0);

   for (i = 2; i < 450; i += 1) {   
      fd_set readfds;
      struct timeval timeout;
            
      //times out in 1second
      timeout.tv_sec = timeout.tv_usec = 1;
      
      //forms request packet based on parameter id (odd - set, even - get)
      if (i % 2 == 0)
         sprintf (str, "R/%c\\%i\0", '4', i);
      else
         sprintf (str, "R/%c\\%i\0", '6', i);
      
         
      //sends packet to server
      if (sendto (s, str, strlen(str), 0,
         (struct sockaddr *) &sin, sizeof(sin)) == -1) {
         perror("sendto");
         return 1;
      }      
   
      //clears receive buffer
      memset(buffer, 0, sizeof(buffer));

      //enables timeout
      FD_ZERO (&readfds);
      FD_SET (s, &readfds);
            
      if (select (s+1, &readfds, NULL, NULL, &timeout) < 0) {
         perror ("on select");
      }
      
      if (FD_ISSET (s, &readfds)) {
         //UDP receive buffer has been updated
         if (recvfrom (s, buffer, sizeof(buffer), 0,
            (struct sockaddr *) &reply, &nreply) == -1) {
            perror ("recvfrom");
         }
         //received package is parsed and printed
         parseOutput (buffer);
      }   
   }   
   return 0;
}


il2code.h (contains the name map for the parameters)
Code: Select all
#ifndef __IL2CODE_H_
#define __IL2CODE_H_

//Parameter Name Map
char * IL2CODES[451] = {
   "-",
   "-",
   "Version",
   "-",
   "Accessible Get",
   "-",
   "Accessible Set",
   "-",
   "-",
   "-",
   "-",
   "Camera Turn Angles",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "Time of Day",
   "-",
   "Aircraft Model",
   "-",
   "Cockpit Quantity",
   "-",
   "Current Cockpit",
   "-",
   "Engine Quantity",
   "-",
   "Airspeed Indicator",
   "-",
   "Variometer",
   "-",
   "Slip",
   "-",
   "Turn",
   "-",
   "Angular Speed",
   "-",
   "Altimeter",
   "-",
   "Azimuth",
   "-",
   "Beacon Azimuth",
   "-",
   "Roll",
   "-",
   "Pitch",
   "-",
   "Fuel",
   "-",
   "G Load",
   "-",
   "Shake Level",
   "-",
   "Left Gear Position",
   "-",
   "Right Gear Position",
   "-",
   "Center Gear Position",
   "-",
   "Magneto",
   "-",
   "Tachometer",
   "-",
   "Manifold Pressure",
   "-",
   "Intake Oil Temperature",
   "-",
   "Outlet Oil Temperature",
   "-",
   "Water Temperature",
   "-",
   "Cylinder Temperature",
   "-",
   "-",
   "-",
   "-",
   "-",
   "Throttle",
   "Throttle",
   "Flaps",
   "Flaps",
   "Aileron",
   "Aileron",
   "Elevator",
   "Elevator",
   "Rudder",
   "Rudder",
   "Brakes",
   "Brakes",
   "Prop Pitch",
   "Prop Pitch",
   "Aileron Trim",
   "Aileron Trim",
   "Elevator Trim",
   "Elevator Trim",
   "Rudder Trim",
   "Rudder Trim",
   "Stabilizer",
   "Stabilizer",
   "-",
   "Ignition",
   "Boost (WEP)",
   "Boost (WEP)",
   "Magneto Next",
   "Magneto Next",
   "Magneto Prev",
   "Magneto Prev",
   "Supercharger Next",
   "Supercharger Next",
   "Supercharger Prev",
   "Supercharger Prev",
   "-",
   "Select All Engines",
   "-",
   "Unselect All Engines",
   "-",
   "Select Left Engines",
   "-",
   "Select Right Engines",
   "-",
   "Select Engine #1",
   "-",
   "Select Engine #2",
   "-",
   "Select Engine #3",
   "-",
   "Select Engine #4",
   "-",
   "Select Engine #5",
   "-",
   "Select Engine #6",
   "-",
   "Select Engine #7",
   "-",
   "Select Engine #8",
   "-",
   "Toggle All Engines",
   "-",
   "Toggle Left Engines",
   "-",
   "Toggle Right Engines",
   "-",
   "Toggle Engine #1",
   "-",
   "Toggle Engine #2",
   "-",
   "Toggle Engine #3",
   "-",
   "Toggle Engine #4",
   "-",
   "Toggle Engine #5",
   "-",
   "Toggle Engine #6",
   "-",
   "Toggle Engine #7",
   "-",
   "Toggle Engine #8",
   "-",
   "Fire Extinguisher",
   "Feather Prop",
   "Feather Prop",
   "Gear Position",
   "Toggle Gear",
   "-",
   "Raise Gear Manually",
   "-",
   "Lower Gear Manually",
   "-",
   "Cowl/Armor Flaps",
   "Airbrake",
   "Airbrake",
   "Lock Tail Wheel",
   "Lock Tail Wheel",
   "-",
   "Jettison Drop Tanks",
   "-",
   "Attach/Detach Aircraft",
   "Weapon 1",
   "Weapon 2",
   "Weapon 2",
   "Weapon 2",
   "Weapon 3",
   "Weapon 3",
   "Weapon 4",
   "Weapon 4",
   "Weapon 1+2",
   "Weapon 1+2",
   "Toggle Gun Pods",
   "Toggle Gun Pods",
   "-",
   "Toggle Sight Mode",
   "-",
   "Increase Sight Distance",
   "-",
   "Decrease Sight Distance",
   "-",
   "Adjust Sight Right",
   "-",
   "Adjust Sight Left",
   "-",
   "Increase Sight Altitude",
   "-",
   "Decrease Sight Altitude",
   "-",
   "Increase Sight Velocity",
   "-",
   "Decrease Sight Velocity",
   "Wing Fold",
   "Wing Fold",
   "Canopy",
   "Canopy",
   "Arrestor Hook",
   "Arrestor Hook",
   "Chocks",
   "Chocks",
   "-",
   "-",
   "Gunner Fire",
   "Gunner Fire",
   "-",
   "Gunner Move",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "-",
   "Gunner Position",
   "Gunner Position",
   "-",
   "Jump to Cockpit #1 (Pilot)",
   "-",
   "Jump to Cockpit #2",
   "-",
   "Jump to Cockpit #3",
   "-",
   "Jump to Cockpit #4",
   "-",
   "Jump to Cockpit #5",
   "-",
   "Jump to Cockpit #6",
   "-",
   "Jump to Cockpit #7",
   "-",
   "Jump to Cockpit #8",
   "-",
   "Jump to Cockpit #9",
   "-",
   "Jump to Cockpit #10",
   "-",
   "FOV 90",
   "-",
   "FOV 85",
   "-",
   "FOV 80",
   "-",
   "FOV 75",
   "-",
   "FOV 70",
   "-",
   "FOV 65",
   "-",
   "FOV 60",
   "-",
   "FOV 55",
   "-",
   "FOV 50",
   "-",
   "FOV 45",
   "-",
   "FOV 40",
   "-",
   "FOV 35",
   "-",
   "FOV 30",
   "Toggle FOV",
   "Toggle FOV",
   "-",
   "Increase FOV",
   "-",
   "Decrease FOV",
   "-",
   "Cockpit View",
   "-",
   "No Cockpit View",
   "-",
   "External View",
   "-",
   "Next Friendly View",
   "-",
   "Next Enemy View",
   "-",
   "Fly-by View",
   "-",
   "Padlock Enemy",
   "-",
   "Padlock Friendly",
   "-",
   "Padlock Enemy Ground",
   "-",
   "Padlock Friendly Ground",
   "-",
   "Padlock Next",
   "-",
   "Padlock Prev",
   "-",
   "Instant View Forward w/ Padlock",
   "-",
   "Padlock Enemy (ext)",
   "-",
   "Padlock Friendly (ext)",
   "-",
   "Padlock Closest Enemy (ext)",
   "-",
   "Padlock Enemy Ground (ext)",
   "-",
   "Padlock Friendly Ground (ext)",
   "-",
   "Padlock Closest Enemy Ground (ext)",
   "-",
   "Chase View",
   "-",
   "Friendly Chase View",
   "-",
   "Enemy Chase View",
   "-",
   "Toggle Gunsight",
   "-",
   "Autopilot",
   "-",
   "Level Autopilot",
   "-",
   "Bailout",
   "-",
   "Gunsight Dimmer",
   "-",
   "Cockpit Lights",
   "-",
   "Nav Lights",
   "-",
   "Landing Lights",
   "-",
   "Wingtip Smoke",
   "-",
   "Map",
   "-",
   "Chat",
   "-",
   "Online Rating",
   "-",
   "Speed Bar",
   "-",
   "Icon Types",
   "-",
   "Mirrors",
   "-",
   "Quick Start/Save Track",
   "-",
   "Radio Mute",
   "-",
   "Radio Channel Switch",
   "-",
   "Time Acceleration",
   "-",
   "Normal Time",
   "-",
   "Time Deceleration",
   "-",
   "Pause",
   "-",
   "Next Ratings Page",
   "-",
   "Mute",
   "-",
   "Seat Position",
   "-",
   "Time Skip",
   "-"
   };
#endif //__IL2CODE_H_
Image
User avatar
3./JG51_Specter
Lance Air Corporal
 
Posts: 24
Joined: Sun May 21, 2006 4:09 am
Location: USA

Postby BaLrOg on Mon May 22, 2006 11:42 pm

Yes I think it is the main gripe people have that have developed with devicelink.

The main reason, as I understand it, that aspects of it were disabled online was due to worries that it would start some kind of online urban mythology that people would some how code some kind of cheat.

Shame realy because a lot of very good projects and ideas seem to have been more or less crippled from the get go as a result of this paranoia.

Still there is perhaps hope that maybe this can be rectified for BoB or at least re-enabled with in IL2 once the community has migrated to bob?

Thanks for the peak at the code it will be interesting to have a play around with this

Good luck with your own project I shall be interested to see how you get on :wink:
User avatar
BaLrOg
Corporal
 
Posts: 26
Joined: Thu May 11, 2006 5:51 pm
Location: Wiltshire, UK

...

Postby WWSensei on Thu Jun 15, 2006 1:18 am

Getting ready to post up v2.0.4 of my wrapper with some additional bug/logic fixes. Would appreciate someone looking over my 'A' response paramter parsing routine. I'm not happy with it. It works but screams at me that it coud be more efficient but haven't had time to futz with it too much. Would love the feedback.

2.0.3 has the same routine and can be downloaded here:

http://www.wingwalkers.org/vault/device ... rapper.zip
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

cron