Jump to content
The simFlight Network Forums

FSUIPC Client DLL for .NET - Version 2.0


Recommended Posts

theres nothing in the negative returning ;-)

What am i doing wrong, any ideas?

Hi Gert,

The Byte type in .NET is unsigned, therefore there will be no -tve values represented in this data type. It goes from 0 to 255.

You need to declare these offsets as the Signed Byte type (In VB.NET this is called SByte) which can represent values -128 to 127.

Note that all the other integer types in .NET are signed, but unsigned versions are provided (e.g. UShort for an unsigned Short).

Let me know if this doesn't fix your problem.

Good luck with your project - it's looks good.

Paul

Link to comment
Share on other sites

Paul and Pete,

Thanks for the almost immediate response. It seems sometimes things are so easy ;-).

The Signed byte solved the problem. And you solved another problem: me not knowing the concept of Signed and Unsigned,

I now got some values with wich I can get the needle to work as it should !!

Will keep you posted with some progress.

Thnx

regards

Gert

Link to comment
Share on other sites

Hey!

Just creating one program for flight simulator and I have one problem. I can't get fuel value from players plane.

Dim playerFuel As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&0AF4) 

at symbol & I have error 'Expression expected'

Link to comment
Share on other sites

Hey!

Just creating one program for flight simulator and I have one problem. I can't get fuel value from players plane.

Dim playerFuel As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&0AF4) 

at symbol & I have error 'Expression expected'

I don't know the syntax so I can't comment on the error, but you do realise that offset 0AF4 merely provides the conversion faction, to convert pounds to gallons or vice versa?

Regards

Pete

Link to comment
Share on other sites

Dim playerFuel As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&0AF4) 

at symbol & I have error 'Expression expected'

Hi,

In VB.NET hexadecimal literals are specified with the prefix &H. So your line should be:

Dim playerFuel As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HAF4) 

Note that you can type the value as &H0AF4, but the VB editor will remove the leading 0 resulting in &HAF4.

LATER: I've just checked the "FSUIPC for Programmers" PDF and &HAF4 is only 2 Bytes, not 4. The value is also unlikely to hold negative values so you should therefore be declaring the offset as UShort, not Integer.

Dim playerFuel As Offset(Of UShort) = New FSUIPC.Offset(Of UShort)(&HAF4) 

I recommend you spend some time reading at least the 'Getting Started' section of the User Guide PDF that comes with my DLL (in the docs folder). In the part called "Registering your interest in an Offset" there is a table that explains which VB types to use for each offset type. If you don't understand this basic concept there is no way your program will ever get sensible data.

Paul

Link to comment
Share on other sites

Before I bought my new computer and was developing with FSUIPC Cleint DLL v1.3 I had downloaded a nice program that had ALL offsets and it would connect to FS. One could select a group of offsets one wanted to have updated in real time (and leave the others without checking).

Unfortunately I seem to have lost that program on the old retired computer after I reformatted but have not been able to find it. Any clues where I could find such tool?

Link to comment
Share on other sites

I had downloaded a nice program that had ALL offsets and it would connect to FS. One could select a group of offsets one wanted to have updated in real time (and leave the others without checking).

Any clues where I could find such tool?

The only program I know of like that is FSInterrogate which comes bundles in the FSUIPC SDK download. Maybe that was it? If not then maybe ask again in the main FSUIPC forum.

Paul

Link to comment
Share on other sites

The only program I know of like that is FSInterrogate which comes bundles in the FSUIPC SDK download. Maybe that was it? If not then maybe ask again in the main FSUIPC forum.

Paul

Yup! that is the one I was talking about, however, when I download and open the latest FSUIPC from the PRoject Magenta site, there is no bundled FSInterrogate.

Never mind, found it at http://www.liljendal.dk/flightsim/fsinterrogate.htm

Edited by lordofwings
Link to comment
Share on other sites

Yup! that is the one I was talking about, however, when I download and open the latest FSUIPC from the PRoject Magenta site, there is no bundled FSInterrogate.

It has never been bundled with FSUIPC, it has only ever been part of the FSUIPC SDK, and it is certainly there in the current release! It is actually called "FSInterrogate2Std" and works with the FSUIPC.FSI file also supplied. The program called just "FSInterogate.exe" was the original one and long superseded.

Note that the data it uses is not fully up to date (there aren't enough hours in a day!), so it shouldn't be used for reference to offset functions. For information on offsets, and details of them all, you should use the two reference documents in the SDK -- the programmers guide (for FS9 and before), and the offset status for FSUIPC4 (when using FSX, ESP or Prepar3d).

Pete

Link to comment
Share on other sites

Paul,

I'm stuck again with a little challenge.

I'm trying to get the map display working. I'm using a navdata file so i can update to the lates navdata cycle.

The point is that all waypoints, stations and airports in those files are defined as following: SCH,AMSTERDAM SCHIPHOL,109.150,0,1,195,52.313311,4.798658,-11,EH

and now i'm having trouble to get the positional numbers back to a FsLatitude cand FsLongitude point so I can calculate the distance between the station an my current position. Is there a way to convert these values back to the same values as i would get from the Fsuipc offset. Or am i totally wrong and should i use anther method?

Sorry Paul, i just saw the light in your FSUIPCClientExample.

With regards,

Gert

Edited by Gert P
Link to comment
Share on other sites

Morning to all,

i'm tring to write al little routine who helps me to understand if an airplane is on the ground or not.

I'm using FSX and i've choose the 0X0366 offset. This offset could really help me but,after fsx's and routine's lunch, the value remains always to 0 (airplane airborned) while the aircraft in on the ground.

Can someone help me to understadn why the value is always 0 with no chages?

Thanks in advance

Emanuele

Public Class Form1
	Dim airspeed As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2BC)
	Dim onground As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H336)


	Friend Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    	Try
        	FSUIPCConnection.Open()

    	Catch ex As Exception
        	MessageBox.Show(ex.Message, "errore connessione", MessageBoxButtons.OK, MessageBoxIcon.Error)
    	End Try
    	Timer1.Enabled = True

	End Sub

	Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    	FSUIPCConnection.Process()
    	Me.Label1.Text = airspeed.Value / 128D
    	Me.Label2.Text = onground.Value

	End Sub



End Class

Link to comment
Share on other sites

I'm using FSX and i've choose the 0X0366 offset. This offset could really help me but,after fsx's and routine's lunch, the value remains always to 0 (airplane airborned) while the aircraft in on the ground.

Can someone help me to understadn why the value is always 0 with no chages?

Yes, that's easy to see:

Public Class Form1
	Dim airspeed As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2BC)
	Dim onground As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H336)

You are reading 0336 which isn't used as far as I know.

Regards

Pete

Link to comment
Share on other sites

Yes, that's easy to see:

Public Class Form1
	Dim airspeed As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2BC)
	Dim onground As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H336)

You are reading 0336 which isn't used as far as I know.

Regards

Pete

Oh my god!

I'm very stupid, sorry!

thanks mr Dowson.

emanuele

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I'm having one problem with this...

I want to use the crash detection offset 0x0830

private Offset<int> offset_detect_crash = new Offset<int>(0x0830)

...

int xxx = (int)offset_detect_crash.Value;

but allways return xxx=16842752

Has I can see in manual, should return 0= Ignore crash or 1= detect crash and restart.

What I'm doing wrong?? :blink:

Thanks,

Link to comment
Share on other sites

I want to use the crash detection offset 0x0830

but allways return xxx=16842752

Has I can see in manual, should return 0= Ignore crash or 1= detect crash and restart.

What I'm doing wrong?? :blink:

It seems you are using FSUIPC4 and FSX, but you are not referring to the Offsets Status documentation for FSUIPC4. The decimal value 16842752 is hexadecimal 0x01010000, which gives:

0000 in the 2-byte offset 0830

01 in the 1 byte offset 0832

01 in the 1 byte offset 0833

all of which seems to agree perfectly with the correct 'manual', for "crash detection on" and "crash detection with other aircraft" on.

Please do refer to the correct documents.

Pete

Link to comment
Share on other sites

Hello everyone,

some of you would be so kind as to suggest to me that offsets used to obtain the weight of fuel carried in an aircraft?

I use FS2004 & FSX

Currently, I use the method current weight - ZFW (but I notice some small changes in value of the ZFW).

This is an example (converting in kg):

Dim offset As current_weight (Of Double) = New FSUIPC.Offset (Of Double) (& H30C0)

Dim offset As zero_fuel (Of Integer) = New FSUIPC.Offset (Of Integer) (& H3BFC)

Fuel_weight Dim As Double = ((current_weight.Value) - ((zero_fuel.Value) / 256) * 0.45)

Is there an easier way?

Thanks in advance.

Emanuele

Edited by Emanuele
Link to comment
Share on other sites

Currently, I use the method current weight - ZFW (but I notice some small changes in value of the ZFW).

Changes due to different payloads I assume? else what is it you mean?

Is there an easier way?

On FSX, yes -- read offset 126C.

Otherwise there's only the more complicated method of totalling the fuel in gallons, from all tanks, and factoring by the current weight per gallon value (0AF4).

Pete

Link to comment
Share on other sites

Changes due to different payloads I assume? else what is it you mean?

Morning Mr. Dowson,

not due to changes in the value of the payload, but there are small fluctuations - usually downward - that I personally linked to the consumption of fuel even though it is not formally correct.

In fact, if the engine is turned off, the ZFW stabilizes. I do not know the reason for all this.

Thanks.

Emanuele

Link to comment
Share on other sites

not due to changes in the value of the payload, but there are small fluctuations - usually downward - that I personally linked to the consumption of fuel even though it is not formally correct.

In fact, if the engine is turned off, the ZFW stabilizes. I do not know the reason for all this.

I don't think they could be fuel, but I suppose they could be related to some other consumable, such as oil? If they were fuel consumption then the amount would be very noticeable. Check ZFW before takeoff and after landing, for instance. How different are they? Maybe it is something to do with the ejection of other matter from the pressure vents, like the air as the cabin pressure is reduced? If so then it should increase again as the pressure is increased again during descent.

I shall log the value over my next flight and see what these changes look like.

Regards

Pete

Link to comment
Share on other sites

I shall log the value over my next flight and see what these changes look like.

I haven't done that flight yet, but I've checked what is going on whilst parked.

In FSX (not sure about FS9) I have to compute the ZFW from the total weight (30C0) and the total fuel weight (126C). FSX doesn't supply the ZFW.

Using logging I can see that when the aircraft is cold and dark, the Zero Fuel Weight, Fuel Weight, and Total Weight all stay firmly stable. As soon as I turn the battery on, the Total Weight is declining at about .055 pounds per second, regularly and evidently deliberately, every second. This is in the 738.

The payloads aren't changing. I checked that. So it something accounting for electric power and associated machinery, activated by the battery. I think you need to ask someone who knows more about aircraft systems. At something like 3 pounds per minute it certainly isn't completely insignificant, so if you find out before me please do let me know!

Regards

Pete

Link to comment
Share on other sites

Hi,

Is there any way to disable the settings in FS?

For instance disable and put the realism settings in Hard and disable the tab, or disable all items.

I saw the 0c44 but user can change the settings after start the flight, can I disable all the tab?

Thanks

Edited by Framac
Link to comment
Share on other sites

Hello Paul and Peter, your class was extremely helpful, I am developing a program for the VA to which I belong, how can I code something that would indicate the three situations below:

1 - Check if the FS is running.

2 - Check the FSUIPC is running.

3 - Check the location of the aircraft corresponds to a particular aerodrome. I guess I would have to have a database with localization (coordinates) of each aerodrome and compare with the current position in the FS. However, even when it would be accurate, because the range of 1 minute ever return a false comparison.

Thanks in advance. Best regards. Sorry about my english, is very bad.

I is program in C#.

Edited by FranklinJS
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.