Jump to content
The simFlight Network Forums

azapf1972

Members
  • Posts

    7
  • Joined

  • Last visited

About azapf1972

  • Birthday 01/01/1970

Contact Methods

  • Website URL
    http://

azapf1972's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Pete, thanks for your consideration - and my apologies for responding a bit late. I have been working a little bit with the .NET DLL in the meantime and that kept me busy... still sort of "probing my possibilites..." True, the ICAO Codes for both Departure and Arrival Airport are empty for MP-Aircraft and that (at least to my observations) might be the case as well for aircraft spawned through FSX's MP-Interface. However, putting something into the code tables that would only be valid for MP-Aircraft seems a bit odd to me - I was going through your documentation several times to look up things and one thing I did not get to work yet (but sounds promising) is what you labelled as "TCASid option" - I got it to work through the UI-Setting and Trafficlook but did not try in my own code yet. What do you think of just adding another option (i.e. 6 = Transponder Code) like you did for the other Items 0-5? Maybe that would provide a way of getting this aircraft detail in without changing the behaviour of the existing items? I'd be honoured to :) - wouldn't matter to me that it is "just" FSX-only although the beauty of FSUIPC currently seems to be that it would work against both versions? Andreas
  2. Hi Pete, thanks for the input - you are right, usually the Transponder Codes would not matter in any way... unless you'd like to display the Squawks of Multiplayer Aircrafts which at least for FSX - I did not test FS2004 - are nicely reported through the same tables as it seems. Anyway, thanks for the reply and thanks for the great efforts you are putting into that great tool of yours... Andreas
  3. I searched the forum but came up with nothing useful - I am currently trying to read as much aircraft information on AI-Traffic using FSUIPC 4.16 as I can. My little C# Program works fine reading the data blocks D040/E080 & D840/F080 - that gives me almost all information I want but I am missing a possibility to retrieve the current transponder (squawk) codes for the AI-Traffic... is there any way to get to this information? I checked out SimConnect and was wondering if that would be a way but honestly, if I'd start using the SimConnect Interface, I would not need to use the FSUIPC Interface at all... (which I find easier to work with). By the way: I noticed in the FSUIPC4 Offset Document that (i.e. the D040-Section) the formula for conversion is given as "*65536 / 360" - shouldn't that be the other way round: "/65536 * 360"? Andreas
  4. Pete, C# supports both 32bit and 64bit floating point variables - no problem there. What happened (at least to me - and that might just be because i did not find a "proper" way doing it...) is that when calling FSUIPC_Get, one has to pass a variable reference which will then take the result of the _Get call. In the C#-SDK, there are four overloads declared for FSUIPC_Get, each differing in the datatype of the receiving variable. And although 32 bit are 32 bit (memory wise), the compiler does not allow to pass a float variable when the overload is declared to receive an int parameter - the compiler throws an error. Also, loading the 4 byte into an integer and then casting to a float did not work either because the value was already interpreted before casted... I will continue to look into this...maybe there is a different solution, maybe the SDK could use another _Get overload (but I am not sure mine is the best way of doing it.... I am rather sure it is currently not...) Andreas
  5. Pete, first of all, thanks for that outstanding piece of software called FSUIPC... I've been playing with it for a few days now and tried to use it with C# (I know, I know, you don't use C#...) The C# Code contained in the SDK works fine - it just left me with one problem: I was unable to retrieve and values that you defined as FLOAT (i.e. AI Traffic Block LAT, LON, ALT) with the FSUIPC_Get methods provided. I have been pushing if forwards and backwards and finally wrote myself another method overload for FSUIPC_Get to handle floats. public bool FSUIPC_Get(ref int Token, ref float Result) { int Size = 4; // 2 bytes in an int float[] myFloat = new float[1]; if ((Token < 0) || (Token > IPC_BUFFER_SIZE - (4 + Size)) ) { //Token out of range Result = 0; return false; } IntPtr heapbuf = Marshal.AllocHGlobal(Size); Marshal.Copy(IPC, Token + 4, heapbuf, 4); Marshal.Copy(heapbuf, myFloat, 0, 1 ); Result = myFloat[0]; Marshal.FreeHGlobal(heapbuf); if (IPCdr[Token] ) { IPCdr[Token] = false; return true; } else { // if (data ready flag not set, function returns false and value found return false; } } Now, most of the code is a simple copy from one of the existing ones - I just adopted the following section IntPtr heapbuf = Marshal.AllocHGlobal(Size); Marshal.Copy(IPC, Token + 4, heapbuf, 4); Marshal.Copy(heapbuf, myFloat, 0, 1 ); Result = myFloat[0]; and of course had to define float[] myFloat = new float[1]; . Unfortunately, the Marshal.Copy does only provide an overload for a float[] Array - not a single float, hence that funny one-element array. To make a long story short: it works - I can now define a float variable in the code, pass it to FSUIPC_Get and get the proper results from the AI Traffic tables. What I want to know: is there any other (simpler) way and how have others using C# overcome my initial problem of not being able to read a float properly... Any thoughts are welcome - I want to learn... Andreas
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.