Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello everyone,

 

I am trying to find when engines start and i am aware that there is an offset for it. I am using:

 

private Offset<int> eng1Ignition = new Offset<int>("AcarsData", 0x0894);

 

to obtain this offset's value but i am positive i'm doing something wrong.

 

eng1Ignition.Value doesn't return the expected value and the documentation states "0894 2 Engine 1 combustion flag (TRUE if engine firing)". This got me confused because TRUE is a boolean value and if i set my offset like this:

 

 

private Offset<bool> eng1Ignition = new Offset<bool>("AcarsData", 0x0894);

 

i get an exception. Can someone be so kind to point me in the right direction here?

 

 

In another subject, i'm also having difficulties understanding the Aircraft Information data. I'm trying to retrieve the full name of the aircraft in use (ex: 'Airbus A320 Air Malaysia'), and if possible its registration, but i don't seem to find where to look into this information.

 

I found this on the C# example 'private Offset<string> aircraftType = new Offset<string>("AircraftInfo", 0x3160, 24);' but i can't seem to be able to squeeze anything out of it except "AIRBUS" or "BOEING" or the company callsign.

 

Any help would be appreciated.

 

Thank you everyone,

Nuno

 

 

Posted

Hi Nuno,

 

Looking at the documentation for 0x0894 is says the length is 2 bytes. This means you should declare the offset as an unsigned short:

private Offset<ushort> eng1Ignition = new Offset<ushort>("AcarsData", 0x0894);

The UserGuide.pdf (found in the Docs folder of the Zip file you downloaded) has a section that explains what .NET types to use with various offset sizes. See page 7,

 

The documentation for FSUIPC is written for C programmers. In C, unlike C# there isn't really a dedicated boolean type. Any integer > 0 is considered 'true', 0 is 'false'. So Pete is just saying that the offset value will be 0 if the engine is not running and > 0 if it is.

bool engine1Running = eng1Ignition.Value > 0;

For the aircraft info, 0x3148 is only the aircraft type as defined in the Aircraft.cfg file. The name of the airline is in 0x3148. Offsets 0x3130 and 0x313C might also be useful.

 

Paul

Posted

Hi,

"0894 2 Engine 1 combustion flag (TRUE if engine firing)"

the "2" gives the length of the offset, in this case it is int16, what is in C# a short.

private Offset<int> eng1Ignition = new Offset<int>("AcarsData", 0x0894);

should be

private Offset<short> eng1Ignition = new Offset<short>("AcarsData", 0x0894);

(TRUE if engine firing), rmember computer do only know 1 and 0, 1=true / 0=false.

 

So the offset will return in that case value ONE (1) for true.

Posted

Thank you very much.

 

I don't have much experience yet with C# so these sometimes slip under :oops:

 

It's all good now, i can get the engine status correctly. As far as the Aircraft info is concerned, i'll check it out later, but these offsets should provide all i need.

 

Once again, thank you for your prompt responses.

 

Nuno

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.