Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi!

 

I have a problem with getting the Transponder code from FSX, my code looks actually like this :

Offset<short> TransponderReq = new Offset<short>(0x0354);

FSUIPCManager.ProcessFSUIPC(); //Processing FSUIPC

double  Transponder2 = (double)TransponderReq.Value;
string Transponder = Transponder2.ToString();

And it returns "4608" for the transponder "2406".

It not works with any different values.

 

Thank you !

Posted

The encoding for this offset is Binary Coded Decimal which means you need to get the ToString() in hexadecimal, not decimal.

 

If your transponder is showing 2406 then this offset will contain the value 9222. If you convert 9222 in to hexadecimal you get 0x2406 which is what you want.

 

I've no idea why you are getting 4608. This is 0x1200. It might be that the aircraft you are testing on doesn't use the normal FSX transponder. Is it a 3rd party add-on? If so, try with a default FSX plane.

 

This conversion should work:

string Transponder = TransponderReq.Value.ToString("X4"); // X4 = Hex format padded to 4 characters

Paul

Posted

The encoding for this offset is Binary Coded Decimal which means you need to get the ToString() in hexadecimal, not decimal.

 

If your transponder is showing 2406 then this offset will contain the value 9222. If you convert 9222 in to hexadecimal you get 0x2406 which is what you want.

 

I've no idea why you are getting 4608. This is 0x1200. It might be that the aircraft you are testing on doesn't use the normal FSX transponder. Is it a 3rd party add-on? If so, try with a default FSX plane.

 

This conversion should work:

string Transponder = TransponderReq.Value.ToString("X4"); // X4 = Hex format padded to 4 characters

Paul

 

Working perfectly :D

 

I was just worried by the Offset description and went in the wrong way, thanks !

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.