Jump to content
The simFlight Network Forums

SDK Assistance


Recommended Posts

Hello guys,

Hopefully someone here will be able to help me.

I'm trying to create an ACARS system using VB.net and the FSUIPC SDK.

I'm got most of the standard 4byte Integer Offsets to work but I'm having a few problems with anything significantly higher.

I am trying to get the Latitude and Longitude to work. Well it works as it is but uncomfortably it only takes the Degree and then the first Minute is rounded and so wouldn't be useful to track location as there is quite a significant difference.

The Code I have is




Dim Lat As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H560)
Dim Longitude As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)

Dim Lati As Double = Lat.Value * 90.0 / (10001750.0 * 65536.0 * 65536.0)
Dim Longi As Double = Longitude.Value * 360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0)


Me.txtLat.Text = Lati.ToString("f1")
Me.txtLong.Text = Longi.ToString("f1")
[/CODE]

If there anyway I can get it to show the full Latitude and Longitude?

Also I have things like Aircraft Title What datatype do I need.

[CODE] Dim Title As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&HD00)

Me.txtAircraftTitle.Text = Title.ToString
[/CODE]

That's what I've got but it gives me an error in my TextBox which is

FSUIPC.Offset`1[system.Int64]

Thanks for the help.

Link to comment
Share on other sites

Hello guys,

Hopefully someone here will be able to help me.

I'm trying to create an ACARS system using VB.net and the FSUIPC SDK.

I'm got most of the standard 4byte Integer Offsets to work but I'm having a few problems with anything significantly higher.

I am trying to get the Latitude and Longitude to work. Well it works as it is but uncomfortably it only takes the Degree and then the first Minute is rounded and so wouldn't be useful to track location as there is quite a significant difference.

The Code I have is




Dim Lat As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H560)
Dim Longitude As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)

Dim Lati As Double = Lat.Value * 90.0 / (10001750.0 * 65536.0 * 65536.0)
Dim Longi As Double = Longitude.Value * 360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0)


Me.txtLat.Text = Lati.ToString("f1")
Me.txtLong.Text = Longi.ToString("f1")
[/CODE]

If there anyway I can get it to show the full Latitude and Longitude?

Use this

[CODE]

Private fsCurrentLatitude As Offset(Of Long) = New FSUIPC.Offset(Of Long)("position", &H560)
Public CurrentLatitude As Single

Private fsCurrentLongitude As Offset(Of Long) = New FSUIPC.Offset(Of Long)("position", &H568)
Public CurrentLongitude As Single

Public Sub getCurrentPosition()
FSUIPCConnection.Process("position")
Me.CurrentLatitude = Me.fsCurrentLatitude.Value
Me.CurrentLatitude = Me.CurrentLatitude * 90D / (10001750D * 65536D * 65536D)
Me.CurrentLongitude = fsCurrentLongitude.Value
Me.CurrentLongitude = CurrentLongitude * 360D / (65536D * 65536D * 65536D * 65536D)
End Sub

[/CODE]

Also I have things like Aircraft Title What datatype do I need.

[CODE] Dim Title As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&HD00)

Me.txtAircraftTitle.Text = Title.ToString
[/CODE]

That's what I've got but it gives me an error in my TextBox which is

FSUIPC.Offset`1[system.Int64]

Use this as you have the wrong offset assigned

[CODE]

Private fsName As Offset(Of String) = New FSUIPC.Offset(Of String)("name", &H3D00, 256)
Public Name As String

Public Sub getName()
FSUIPCConnection.Process("name")
Me.Name = Me.fsName.Value
End Sub

[/CODE]

Link to comment
Share on other sites

Also when i try to get Engine 1's N2 the same way i get Engine 1's N1 i seem to have a problem

I get a value of

77 for N1 (Perfectly Normal and Accurate)

and

5106000 for N2

Is this the correct Offset for N2

896

Thanks

Edited by Cori Haws
Link to comment
Share on other sites

By doing Dim instead of Private and Public

Should i change my code to that format?

It depends. The code I posted is my code I created in my aircraft class. The private vars are accessible only within that class whilst the public vars are accessible from anywhere that uses the object derived from the aircraft class. It depends what vars you want to access and from where.

Link to comment
Share on other sites

Also when i try to get Engine 1's N2 the same way i get Engine 1's N1 i seem to have a problem

I get a value of

77 for N1 (Perfectly Normal and Accurate)

and

5106000 for N2

Is this the correct Offset for N2

896

Thanks

My n2 code


Private fsEngine1N2 As Offset(Of Short) = New FSUIPC.Offset(Of Short)("enginesn2", &H896)
Public Engine1N2 As Decimal
Private fsEngine2N2 As Offset(Of Short) = New FSUIPC.Offset(Of Short)("enginesn2", &H92E)
Public Engine2N2 As Decimal
Private fsEngine3N2 As Offset(Of Short) = New FSUIPC.Offset(Of Short)("enginesn2", &H9C6)
Public Engine3N2 As Decimal
Private fsEngine4N2 As Offset(Of Short) = New FSUIPC.Offset(Of Short)("enginesn2", &HA5E)
Public Engine4N2 As Decimal
Public Sub getEnginesN2()
FSUIPCConnection.Process("enginesn2")
Me.Engine1N2 = Me.fsEngine1N2.Value * 100 / 16384
Me.Engine2N2 = Me.fsEngine2N2.Value * 100 / 16384
End Sub
[/CODE]

Check you have the maths side and variable types correct. It may also depend on the aircraft you are using. Some third party aircraft won't write the correct values, if any, to these offsets (Level-D 767 for one) so you will have to check what is used and what isn't depending on selected aircraft.

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.