Jump to content
The simFlight Network Forums

homer09001

Members
  • Posts

    13
  • Joined

  • Last visited

homer09001's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. it wasent that i was not reading the SDK some of it just was not making much sense to me. but after reading it over and over and reading your comments, i worked it out! one of the problems i was having was the large number being output would not equal that of FS-Interrogate after performing the same math calculations that are used by FS-Interogate, but finnaly i managed to get it to work! // Get altitude long Result = 0; result = fsuipc.FSUIPC_Read(0x0570, 8, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref Result); double lowalt = Result * 3.28084 / 65536 / 65536; double tlowalt = Math.Round(lowalt, 0); altit.Text = Convert.ToString(tlowalt);
  2. ahh finnaly im getting somewhere after reading the SDK in depth i have found FSUIPC.cs had a ready made function to return 64 bit results, only problem is its outputting a very long number still, all be it a different number!! long Result = 0; // Get altitude result = fsuipc.FSUIPC_Read(0x0570, 8, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref Result); long acalt = Result; altit.Text = Convert.ToString(acalt); ouputs: 566534471680 in FS: 432.8? is there somekind of mathematical calculation i need to perform to convert a to b?
  3. i took one look at c++ and ran miles, i find C# increadibly easy compared to C++ due to its similarities to PHP which i have been using for about 2 years yeah i have a look at it, couldnt make much sense of the installation :S any i have had an idea on how to change dwResult to a 64-bit variable so im going to give that a shot.
  4. Okay. I'm a bit lost with C#. Is that "dwResult" a 64-bit integer? You are correctly reading 8 bytes (which is 64 bits), but it looks like you maybe are only using the first 32-bits, which would be the fraction of a metre in 1/(65536*65536) ths. your right dwResult is set as a 32 it integer, i have changed it to a "Long" a 64 bit integer but thats kicked up loads or errors im not 100% sure im just learning c# myself how that got in there im not sure, as for using FSInterrogate, its showing the correct altitude in the factored column?
  5. sorry im using C# to get the alitude using FSUIPC: the code: // Get altitude result = fsuipc.FSUIPC_Read(0x0570, 8, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref dwResult); double acalt = dwResult/ (65536 / 65536); altit.Text = Convert.ToString(acalt);
  6. how on earth do i get the altitude out of FS? currently its outputting: 908591104 where in fact when i press CTRL+Z in FS it shows: 269.7? i can't for the life of me workout how to get it to output the correct altitude
  7. i copied the code form the example in the SDK for C# but im getting a value of 0 when pulling the longitude from FS? the code: double longHi = 0; double longLo = 0; double longitude = 0; // Get longitude result = fsuipc.FSUIPC_Read(0x056C, 4, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref dwResult); longHi = dwResult; result = fsuipc.FSUIPC_Read(0x0568, 4, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref dwResult); longLo = dwResult; if (longLo != 0) { longLo = longLo / (65536.0 * 65536.0); } if (longHi > 0) { longitude = longHi + longLo; input3.Text = Convert.ToString(Convert.ToInt32(longitude)); } else { longitude = longHi - longLo; input3.Text = Convert.ToString(Convert.ToInt32(longitude)); }
  8. from the SDK docs:
  9. me again, im at the point now in which i am using FSUIPC to get the data from FS, but ihave hit a brickwall getting my program to build due to errors with the code. the following peice of code is the first instance of anything to do with FSUIPC: public Fsuipc () { FSUIPC_Close(); FSUIPC_Initialization(); } but its showing an error:
  10. ahh that would have been 100% easier than getting them from FSNav. well thanks for your help, i have managed to get my app to calculate distance in NM from a Lat/Long to and ICAO specified :D considering i only started learning C# a day ago im on a roll :D
  11. correct me if im wrong but should there not already be a file somewhere within the FS9 folder with all airports names, icao, lat and long in?
  12. Yew, the Aircraft On Ground flag at offset 0366. How the hell did i miss that lol im using FS-Interrogate2 to get variables etc, i went throught the entire list last night and couldnt find it lol Only if you know the lat/lon of the airport. That's not something FS or FSUIPC can look up for you. If you do have it, it's a matter of spherical trigonometry, though for short distances you could simplify by assuming a flat Earth! ;-) Regards Pete i might just have every fs9 airport in a database along with its lat longs edit: no i dont damn, any ideas where i could obtain these free?
  13. im currently writing an Application for use with FS, i need to know if there is anyway i can determine if an aircraft is in contact with the ground via FSUIPC? and... is it possible to calculate the distance in NM from an aircraft current position to a specified ICAO airport code?
×
×
  • 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.