Jump to content
The simFlight Network Forums

VB FSUIPC TCAS tables


Recommended Posts

I am trying to read TCAS data and tried to read offset F068 (Traffic Range) but it returns 0, see if you can see where I am going wrong :D

Dim dwResult As Long
Dim range As Byte

FSUIPC_Read &HF000, 1, VarPtr(range), dwResult
FSUIPC_Process dwResult
MsgBox range

I have also tried to 'inject' the TCAS structure in to offset 1F80 as it says to in the FSUIPC SDK, but still no avail.

Public Type TCASData
    id As Single
    lat As Long
    lon As Long
    alt As Long
    hdg As Integer
    gs As Integer
    vs As Integer
    comm As Integer
    stat As Byte
    call As String * 15
End Type

    Dim tDat As TCASData
    Dim dwResult As Long

    FSUIPC_Write &H1F80, Len(tDat), VarPtr(tDat), dwResult
    FSUIPC_Process (dwResult)

And then I try reading the offset above and it still doesnt work :? . I hope I have explained it ok and I hope you are able to help.

Thanks

Craig

Link to comment
Share on other sites

I am trying to read TCAS data and tried to read offset F068 (Traffic Range) but it returns 0, see if you can see where I am going wrong :D

Dim dwResult As Long
Dim range As Byte

FSUIPC_Read &HF000, 1, VarPtr(range), dwResult
FSUIPC_Process dwResult
MsgBox range

I can see two things wrong, easily, and I don't know VB at all!

First you say you want to read F068, yet you specify F000!

Second, I'm pretty sure that VB expands &HF000 to make a 32-bit value FFFFF000, which is certainly not what you want. I seem to remember someone saying you needed to postpend another & to stop it doing that, so try &HF068&.

I have also tried to 'inject' the TCAS structure in to offset 1F80 as it says to in the FSUIPC SDK, but still no avail.

Ouchthat's too much VB for me. I wouldn't know if your TCAS datatype matched my C structure at all. However you can check:

Please use the FSUIPC logging facilities to see the results of your endeavours. I'm sure you'll be able to figure it out from that -- use the IPC Read and Write logging options and the FSUIPC Log file will show you what your code results in across the interface.

And then I try reading the offset above and it still doesnt work

Well, the documentation does explicitly say that you cannot read back what you write there, doesn't it. ;-). Also, don't forget that the target is eraed if you don't keep replenishing in within 8 seconds -- use a 2 or 3 second time at most to be safe.

Regards,

Pete

Link to comment
Share on other sites

When I read the offset F096 (Aircraft ID) it returns ???4. '4' being the last character in the callsign SKY2304, any suggestions?? :D

Yes. Use FSUIPC logging, PLEASE? I cannot debug your program step by step. I don't even know VB and you've shown none this time in any case.

You need to do your own debugging. It is part of the joy of programming. There are enough tools around surely. Apart from the Logging, there's FSInterrogate where you can look at every byte, and surely VB must have a debugger?

Offhand I have no idea what "F096" should be in any case. The TCAS tables contain an array of structures. Treat them like that.

Regards,

Pete

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.