Jump to content

Recommended Posts

Posted
I'm having a difficult time 'translating' the data DCS-BIOS is sending out (the dev docs themselves) & hoping there might a few people out there with some experience developing with it that can offer some help, specifically with C#.
 
Getting the UDP stream itself is easy enough but doing anything with it seems insanely difficult to get to the bottom of - if I'm honest, I'm struggling with the information provided in the docs. It seems to summarise more how it works than how to develop with & use it and I'm not really following...
 
Specifically, "The location of an integer value is defined by a 16-bit word address which specifies the start of the 16-bit word in which the data is located, a 16-bit mask which specifies which bits in that word belong to the value, and a shift value (which can also be deduced from the mask)." I'm unable to comprehend how this translates to determining a cockpit instrument and it's value; I'm not sure what it means by a "shift value" and how that relates to the format it goes on to mention or where this mask is described. I'm also struggling to understand what exactly the provided pseudo C code is doing - it's provided as an example of decoding a value but I have no idea how one determines what instrument that value is for.
 
It also mentions the export data stream is in the following format, where are the previously mentioned shift and mask value(s) in this format?
 
<Start Address (16 bits> <Data Length (16-bits)> <Data>
 
If I jump into a new mission, on Caucuses with just a Client 18 in, the first response is:
 
<21845> <8224> <0>
 
 
Following responses will all look equally similar and all start the same i.e. '21845' while some of the Data Length and Data sections will show as negative numbers.  Is anyone able to provide any insight at all in how this translates to an instrument and it's state / value?
 
I'm producing the above output with the following:
byte[] startAdd = new byte[16];
byte[] dataLength = new byte[16];
byte[] data = new byte[udpResult.Buffer.Length - 32];
 
Array.Copy(udpResult.Buffer, 0, startAdd, 0, 16);
Array.Copy(udpResult.Buffer, 16, dataLength, 0, 16);
Array.Copy(udpResult.Buffer, 32, data, 0, (udpResult.Buffer.Length - 32));
 
int _cStartAddress = BitConverter.ToInt16(startAdd.ToArray(), 0);
int _cDataLength = BitConverter.ToInt16(dataLength.ToArray(), 0);
int _cData = 0;
 
if (data.Length > 0)
    _cData = BitConverter.ToInt16(data.ToArray(), 0);
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...