Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Imports FSUIPC

----------------------

Structure TCAS_DATA

Dim id As Integer

Dim lat As Single

Dim lon As Single

Dim alt As Single

Dim hdg As Short

Dim gs As Short

Dim vs As Short

Dim idATC() As Byte

Dim com1 As Short

End Structure

Sub Test_TCAS_DATA()

Dim dwResult As Integer

Dim Token As Integer

Dim result As Integer

Dim fsByte(4095) As Byte

Dim TCA(0) As TCAS_DATA

Dim T As System.Type

T = TCA(0).GetType

Try

If Connected Then

If FSUIPC_Read(&HF000, 4096, Token, dwResult) Then

If FSUIPC_Process(dwResult) Then

If FSUIPC_Get(Token, 4096, fsByte) Then

.

.

.

End Sub

Using:

- Visual Basic 2008

- FSUIPC unregistered

- FSUIPC last update 4.7

ERROR LIST IS READING

- Name Connected is not declared

- FSUIPC_Read is not declared

- FSUIPC_Get is not declared

I would like to use the code found at the Link (year 2003):

http://forum.simflig...dpost__p__34735

Normally i'm reading Offsets like:

Dim fsLocalDateTime As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H238, 10)

Someone can tell me what is wrong here and how can I make it working ?

Many thanks for your kind help and assistance.

Friedrich

.

Posted

Someone can tell me what is wrong here and how can I make it working ?

I can't help you myself as I know nothing at all about VB. Surely the compiler errors themselves are telling you what you are missing? I mean "Connected" to start with must be a variable you declare, set and clear as appropriate. And evidently you are missing the most important parts, the links to the main interface routines (FSUIPC_Read, FSUIPC_Process). I don't know what "FSUIPC_Get" is -- must be peculiar to the VB implementation.

I assume there's a lot more code someplace that you've not posted. I mean you haven't even opened the link (FSUIPC_Open) in that extract!

Have you tried the examples? They worked when posted by the volunteers who did the VB part. Also,all of the interface source is provided so if you know VB well enough you should be able to sort things out quite quickly. If you don't know VB then this area is probably not the place way to learn.

Unfortunately the title you've given to this thread isn't very useful to attract the right folks to reply. Shouldn't you have used something like "Trying to use VB2008 to interface to FSUIPC, need help"?

Regards

Pete

Posted

Thanks for your answer Mr. Pete

My VB program is working with all other Offsets. I get all single data as stated above like:

Dim fsLocalDateTime As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H238, 10)

FSUIPC is open.

Private Sub OpenFSUIPC()

Try

' Attempt to open a connection to FSUIPC (running on any version of Flight Sim)

FSUIPCConnection.Open()

Me.Timer1.Enabled = True

Catch ex As Exception

MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

JUST the TCAS reading data Procedure is giving errors.

There must be DECLARATIONS missing which are not a part of the VB basic language.

Sure, the 'Connection' Error is easy to master with a boolean value.

Maybe someone knows the way it should work.

Anyway, many thanks

Friedrich

Posted

My VB program is working with all other Offsets.

Ah, I thought you were pointing to the compiler errors you listed, i.e.

ERROR LIST IS READING

- Name Connected is not declared

- FSUIPC_Read is not declared

- FSUIPC_Get is not declared

But all you are saying is that you can't read a byte at offset 0238. which just provides the local Hour (0-23)?

I get all single data as stated above like:

Dim fsLocalDateTime As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H238, 10)

I've no idea what all that means -- is "Byte()" supposed to mean an array of bytes? Is "(&H238, 10)" supposed to mean you read 10 bytes?

JUST the TCAS reading data Procedure is giving errors.

What's the 10 bytes from 0238 got to do with TCAS? Sorry, I'm obviously confused -- that just seems to be about getting time and date information!

What lines do you have which do actually work? Maybe you need to compare what does with what doesn't work to see what the difference is? Why did you post that code fragment originally, as it seems to have nothing at all to do with your questions?

Sure, the 'Connection' Error is easy to master with a boolean value.

So, why, then, are you listing those errors? I'm not clear what your first post was about at all now. There seems to be no information here relevant to your questions, only information showing a fragment of code with compiler errors?.

Pete

Posted

Friedrich,

The example code you posted originally is using the old VB.NET SDK. It looks like you are using my .NET Client DLL, so that's why it looks strange to you and doesn't work.

Please download the latest version of my DLL 2.0 from here:

http://forum.simflight.com/topic/40989-fsuipc-client-dll-for-net-version-20/

You'll see it has new facilities to give you the TCAS data from FSUIPC using one method call. All the structure stuff is taken care of by the DLL behind the scenes. You just need to retrieve the info from a strongly-typed collection of AIPlaneInfo classes using a For Each loop.

It's all explained in the documentation and shown in the new example application.

Paul

Posted

Ah, I thought you were pointing to the compiler errors you listed, i.e.

Pete

In fact my reference to offset 238 is just mentioned in order to show that other offset-readings with 'that' method (Dim .....) is working while the TCAS procedure does not.

Now i will try it with the new DLL suggested by Paul Henty.

thanks

Friedrich

Posted

Friedrich,

The example code you posted originally is using the old VB.NET SDK. It looks like you are using my .NET Client DLL, so that's why it looks strange to you and doesn't work.

Paul

Thank you. Now it is working.

Friedrich

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.