Jump to content
The simFlight Network Forums

NWI problems


Recommended Posts

I'm hoping somebody might be able to help me.

I'm trying to write a program that uses Pete's FSUIPC module to interface with MS FS9. While I'm having no trouble with most of what I'm trying to do, one area that is proving difficult is using the 'New Weather Interface'.

I want to be able to read the weather for any airport (by entering in the appropriate ICAO code). Unfortunately, I just can't get it to work; I consistenly get no data back after entering the ICAO in to the correct (I think) FSUIPC address together with the 'Signature' in the other address as detailed in the NWI programming guide.

I am programming in VB6, using the FSUIPC SDK that includes a VB6 module to read / write / process addresses in FSUIPC.

Have you programmed anything like this in VB6 (or VB generally, though not .NET)? Have you managed to get the NWI to work in VB? If so, would you be able to offer me some help or advice, or perhaps even show me some example code.

I appreciate that I'm asking a lot. However, If you are able to help, I promise to share with you the fruits of my programming endeavours (for what it's worth...)

Kind regards,

Alex Berry

Edingburgh, Scotland

Link to comment
Share on other sites

I want to be able to read the weather for any airport (by entering in the appropriate ICAO code). Unfortunately, I just can't get it to work; I consistenly get no data back after entering the ICAO in to the correct (I think) FSUIPC address together with the 'Signature' in the other address as detailed in the NWI programming guide.

One way to see what is going on, which may help, is to enable FSUIPC's IPC read and write logging. Then first use WeatherSet2 (supplied with FSUIPC) to read the weather at a specific ICAOand then do the same with your program.

Now just compare the logs for the two actions, this should show you what is wrong. If you need any help interpreting the logs show the extracts and I'll see what I can do.

Regards,

Pete

Link to comment
Share on other sites

Pete, thanks for your excellent advice. Using the IPC log soon showed what the problem was...

Just in case anyone else is interested (might be worth putting it in future versions of the VB SDK) -

You can enter Hex values in VB by typing &H at the start of the number, for example &H3AF0 for the Hex value 3AF0. However, VB treats these as a signed 2-byte integer, so anything greater than &H8000 (dec 32768) is actually treated as a negative number.

So entering the IPC addresses in Hex format only works up to &H8000. If addressing values up where the NWI is (&HC000), you need to use decimal notation for the addresses.

Anyway, worked for me and problem solved...

Thanks again,

Alex Berry

Edinburgh, Scotland.

Link to comment
Share on other sites

You can enter Hex values in VB by typing &H at the start of the number, for example &H3AF0 for the Hex value 3AF0. However, VB treats these as a signed 2-byte integer, so anything greater than &H8000 (dec 32768) is actually treated as a negative number.

How does VB allow you to define a full 32-bit word in hex, then? What if you used &H00008000? The value being used in the IPC interface is a 32-bit value, after all. In C/C++ the upper zeroes are rather implied by the notation, as in 0X8000. Maybe just VB &X08000 should work?

So entering the IPC addresses in Hex format only works up to &H8000. If addressing values up where the NWI is (&HC000), you need to use decimal notation for the addresses.

That is certainly one way, though I think the way to tell the VB compiler that your original is unsigned is to add an & at the end, thus: &HC000&. At least that is what some VB programmers tell me (JD being the first -- thanks John!).

Regards,

Pete

Link to comment
Share on other sites

Pete,

How does VB allow you to define a full 32-bit word in hex, then? What if you used &H00008000? The value being used in the IPC interface is a 32-bit value, after all. In C/C++ the upper zeroes are rather implied by the notation, as in 0X8000. Maybe just VB &X08000 should work?

These all seem reasonable, but don't appear to work.

I think the way to tell the VB compiler that your original is unsigned is to add an & at the end, thus: &HC000&.

That certainly does work though. Didn't see that in the help, so that's a good spot. :D

Regards,

Alex

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.