Jump to content
The simFlight Network Forums

read aircraft type problem


Recommended Posts

Hello Pete !

Info:

I have fixed a solution for the Multiplayer function for my commercial product, using a "FSVPI" custom licence. Now I need to read out traffic using FSUIPC. The purpose is to copy all aircrafts from one PC with traffic, info next PC using Multiplayer.

I seams read all aircraft positions without problem. But I get problem at read "ATC aircraft type, plus ATC aircraft model" string.

Ref: FSUIPC version 3.48 . Document FSUIPC for Programmers 4th March 2005.

"Reading full AI Traffic identity strings"

"2. Read the timestamp at D008 (32-bit DWORD)"

I tried first all code as your example but reading timestamp at D008 always return zero. Also if the first thing I do (after initializing) is just read timestamp at D008, it return zero every read.

If I test read a 32-bit value at another offset e.g. 2E80, it return correct value 0 or 1.

If I skip your step "5. Wait till the timestamp in D008 changes." and instead Sleep one sec, process all application messages and then just read "6. Read string result (up to 48 bytes including terminating zero) from D010." there is just zero in the string at D010.

Additional info. Prior try read "ATC aircraft type, plus ATC aircraft model" string, I read aircraft ID as typical like e.g. -124 -87. And I pass this ID in "3. Write the AI id (from the TCAS table, see earlier) to D00C (32-bit DWORD)".

Question 1:

Is it correct that I should use command "ATC aircraft type, plus ATC aircraft model string." to get info what type of aircraft (type e.g. "Boeing 737", "Cessna 172" etc), or how to get most visual information about aircrafts ?

Remmark. I dont know exactly what type of string I need, I have to try out. FSVPI can take e.g. just string "737" or an id-integer-number.

Question 2:

Do you have any idea, or can you say what to try, why cant I read "ATC aircraft type, plus ATC aircraft model string." ?

Question 3:

Where can I read aircraft pitch and bank, the doc doesn't say ?

Thanks and regards !

Attach my code in case I have some obvious misunderstand: traffic.zip

traffic.zip

Link to comment
Share on other sites

I have fixed a solution for the Multiplayer function for my commercial product, using a "FSVPI" custom licence.

What's an "FSVPI" custom licence?

Ref: FSUIPC version 3.48 . Document FSUIPC for Programmers 4th March 2005

Please always refer to the latest version, which is dated 25th April (it is the one which matches FSUIPC 3.48).

I tried first all code as your example but reading timestamp at D008 always return zero. Also if the first thing I do (after initializing) is just read timestamp at D008, it return zero every read.

Of course it will be zero initially, before anything has read anything. The timestamp is set to indicate some data has been made available. Until an operation is performed on it to read something, it won't be set. Can you not see that is perfectly logical?

If I skip your step "5. Wait till the timestamp in D008 changes." and instead Sleep one sec, process all application messages and then just read "6. Read string result (up to 48 bytes including terminating zero) from D010." there is just zero in the string at D010.

Why would you want to skip any steps?

Instead of trying to explain in words here, please use FSUIPC IPC read/write logging. That is what it is for. From the logging we can both see exactly what is being written and read and can analyse what is going wrong for you.

Is it correct that I should use command "ATC aircraft type, plus ATC aircraft model string." to get info what type of aircraft (type e.g. "Boeing 737", "Cessna 172" etc), or how to get most visual information about aircrafts ?

I don't know how you'd want to get the "visual information". The type and model won't tell you the livery, for instance.

The string which is used to actually SELECT the aircraft in FS, the string which is saved in the FLT files for this purpose, it the aircraft title, so you may want that. It could be anything, but if you have the same aircraft installed in both systems it is the string which conclusively points to a particular model and texture set in the installation.

All the strings are from declarations made in the Aircraft.CFG files, so perhaps you can look at some of those to see what you need?

Do you have any idea, or can you say what to try, why cant I read "ATC aircraft type, plus ATC aircraft model string." ?

Not without more information. Please try using some of the tools provided. In this case a short part of the FSUIPC Log with IPC read and write logging enabled would explain everything.

Where can I read aircraft pitch and bank, the doc doesn't say ?

That's because the SDK was only updated after the facility was added (in 3.48 ). You could check the History documentation enclosed with the FSUIPC package, or just look at the "Recent Release Changes"announcement near the top of this Forum, which shows the same data. I think you'll find it as item 8 in the 3.48 changes.

But the best thing is to always keep your SDK up to date.

Regards,

Pete

Link to comment
Share on other sites

Attach my code in case I have some obvious misunderstand: traffic.zip

I've had a brief look. First thing -- your code will be EXTREMELY inefficient. You are reading all 96 slots for both ground and airborne traffic, all individually.

This involves 192 separate Process calls, which is 192 separate Process switches between your program and FS!!!

Please think about that and compare it to a method which has two arrays of 96 TCAS structures and does one read of 96 x 40 bytes for each, and then one Process. That will take about the same time as just one of your 40 byte reads -- i.e. 192 times faster!

Then your loop to read strings reads them for every slot, even empty ones (Id == 0). Furthermore, you are writing the Signature to D00C, immediately overwriting the Aircraft ID you just wrote. The proper signature offset D000 is never written, so no command is ever obeyed.

Please consider debugging code before thinking FSUIPC is in error. If your own compiler's debugger isn't any use, at least use the tools FSUIPC provides - checking the actual sequences of writes and reads in the Log would tell you everything.

Finally, please note that this method of reading all the strings is grossly inefficient for what you wish to to. It was implemented to help programs like Radar Contact name the *one* aircraft in front of your own in a queue for take-off, and things like that.

For your purposes, why not use the Aircraft ATC ID string which is provided in the TCAS tables already? If you want a specific one, read the current settings from E068/F068 areas, then set the ones you eant, read all the TCAS tables (in one Process), then restore the previous settings.

I know the strings you get that was are rather abbreviated, but I'm sure you could work it to your purposes and end up with a much more efficient program.

Regards,

Pete

Link to comment
Share on other sites

What's an "FSVPI" custom licence?

http://www.fsvpi.com/ (I got a much lower licence fee specific for my type of application)

Sorry I did not know how the timestamp work or what was wrong, just tried follow your example without understand exactly what happen behind the FSUIPC codes. I didnt think or say FSUIPC is in error, I think something is in error, primary I did not understand how the timestamp should work.

So I understand timestamp change once after a proper access. This may explane why it doesnt change, cause I didnt write signature correct. I will try later when I come home.

I also now understand how you explain, it really need to write as few Process call as possible. I didnt know how much each call acctually make sence to save.

Yes I do have an issue to know what I want to read, it's the egg and hen. I dont know what aircraft type/livery information FSUIPC can offer as read out, string or ID. I dont know what kind of aircraft type/livery information FSVPI support and accept. I have to try this out. Right now I just know I need to read out something and try this at FSVPI.

I'll check out all your other info also and try out what suit my need. Thank you.

Then your loop to read strings reads them for every slot, even empty ones (Id == 0)

I dont think so. I skip empty slots in the two first loops.

Why would you want to skip any steps?

Just did try to read out the string without the wait-loop, 'cause the wait-loop hang due to my mistake.

why not use the Aircraft ATC ID string which is provided in the TCAS tables already?

ok if the char idATC[15] in TCAS_DATA can be used for FSVPI, then I dont need more.

Link to comment
Share on other sites

I also now understand how you explain, it really need to write as few Process call as possible. I didnt know how much each call acctually make sence to save.

Yes, the reason the FSUIPC_Process call is separate is so that you can build up a complete set of requests -- as much as 30k data (including overhead data, 16 bytes per Read or Write) can be accumulated -- for one transfer to/from FSUIPC.

All the read/write stuff is actually in your program, and very fast. But every Process call requires a process switch to FS and a switch back to your program after. So each such call can be 100 or more miliiseconds. Compared to the time for the actual data that is huge. It is even worse of course over WideFS where you add Network latency.

I dont think so. I skip empty slots in the two first loops.

Ah, okay. I see that now -- I missed it on my quick perusal.

Regards,

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.