Jump to content
The simFlight Network Forums

Recommended Posts

Hello ,

I'm trying to make a weather injector for fsx , where the user inputs for , for example,  the surface wind and the program injects that into the simulator. I am very unsure about how this is done, Looking at the FSUIPC for programmers pdf I found the offsets list , after successfully getting the airspeed from the simulator from an offset i went to Changing the surface temperature , as this is one of the options available in my program. I found the offset 0EC0.

                int token = -1;
                int dwResult = -1;		
                fsuipc.FSUIPC_Write(0x0EC0, 10, ref token, ref dwResult);

This is an extract from my inject function. Using the included example project I was able to produce this. My questions are , what is int token used for ? All other variables in the example project where commented apart from token however  I couldn't figure out what token was used for. In addition to this regarding the weather aspect of the offset list , how do I tell whether I am getting  or setting a value. Is this surface temperature being set globally or for the nearest weather station? Is there an easier way to search for the offsets I need ? I also noticed it would be 10*256 as the actual temp in the simulator , is this correct?

 

Many thanks,

Arun

Edited by arunptl100
Link to comment
Share on other sites

I'm trying to make a weather injector for fsx , where the user inputs for , for example,  the surface wind and the program injects that into the simulator. I am very unsure about how this is done, Looking at the FSUIPC for programmers pdf I found the offsets list , after successfully getting the airspeed from the simulator from an offset i went to Changing the surface temperature , as this is one of the options available in my program. I found the offset 0EC0.

 

The "FSUIPC for Programmers.pdf" does not contain the definitive offsets list for FSX. You should be referring to the Offsets Status list. That is also in the SDK and would also have been already installed in your FSUIPC Documents folder, inside the FSX Modules folder.

 

The offsets you are trying to use date back to FS98 and are generally not really suitable for use in FS9 or FSX unless you are also dealing with the weather stations or setting global weather mode.

 

I suggest you investigate offsets B000 through to CFFF, which whilst being listed in the Offsets list, are best described in the NWI ("New Weather Interface" package included in the FSUIPC SDK. The program WeatherSet2 uses that interface.

 

Sorry, I can't help with C# as I don't know it at all. Maybe someone else can do that. If you are using Paul Henty's .Net client DLL then you'd be better off asking in his subforum, above.

 

Pete

Link to comment
Share on other sites

Hi Pete,

Im using "UIPC_SDK_CSHARP Revision 1.13" as I found in the SDK.

After looking at the offsets you mentioned I came across  B800 , "Weather at requested location (READ) For ICAO ID or Lat/Lon written in CCxx area.". In the NWI I came across offsets which are mentioned in the offsets status pdf .  So I assumed I was to try the offsets above it which where labelled FSX and beyond. I understand you cant help with C# however I will still post what I came up with incase you can spot anything wrong:

            bool result = false; 
            result = fsuipc.FSUIPC_Read(0xB800, 4096, ref token, ref dwResult); //where do I specify the ICAO ID?
            result = fsuipc.FSUIPC_Process(ref dwResult);
            result = fsuipc.FSUIPC_Get(ref token , ref dwResult);
            int globweather = dwResult;
            Console.WriteLine(globweather);

Running this shows me the following numbers on the console (Global weather was enabled) : 1247369539. Also looking at offset B000, I enter a fsx format Metar, observing the FSUIPC log in FSX showed me a few however , I was not able to decode it as it was nothing like metars I have seen. Is this metar applied globally? 

 

Arun

Link to comment
Share on other sites

Hi Pete,

Im using "UIPC_SDK_CSHARP Revision 1.13" as I found in the SDK.

After looking at the offsets you mentioned I came across  B800 , "Weather at requested location (READ) For ICAO ID or Lat/Lon written in CCxx area.". In the NWI I came across offsets which are mentioned in the offsets status pdf .  So I assumed I was to try the offsets above it which where labelled FSX and beyond. I understand you cant help with C# however I will still post what I came up with incase you can spot anything wrong:

            bool result = false; 
            result = fsuipc.FSUIPC_Read(0xB800, 4096, ref token, ref dwResult); //where do I specify the ICAO ID?
            result = fsuipc.FSUIPC_Process(ref dwResult);
            result = fsuipc.FSUIPC_Get(ref token , ref dwResult);
            int globweather = dwResult;
            Console.WriteLine(globweather);

Running this shows me the following numbers on the console (Global weather was enabled) : 1247369539. Also looking at offset B000, I enter a fsx format Metar, observing the FSUIPC log in FSX showed me a few however , I was not able to decode it as it was nothing like metars I have seen. Is this metar applied globally? 

 

Arun

 

I don't know the C# part of the SDK. It's a user contribution.

 

I think the "dwResult" is the success or failure of the call. I don't know why you are calling that "globweather". You are trying to read a complete area of 4096 bytes from offset 0xB8000, so reading the 2048 byte METAR string and the first 2048 bytes of the binary NWI tables following. Don't you think you need to sort out what you want to read and read it correctly?

 

The format of FSX SimConnect METARs is sort of

like real Metars but much extended. Also the read and write formats are different. You will need to look all this up in the SimConnect documentation in the FSX SDK, available on-line at

file:///E:/SDK/sdk%20overview.html

 

As for the ICAO id for reading, please refer to offset CC00-CCFF and the NWI package. The control over all these areas is via NWI. The raw FSX Metars are a bonus.

 

Pete

Link to comment
Share on other sites

Can you confirm the NWI is called "New Weather Interface for FS2004" in the FSUIPC SDK folder. I couldn't find instructions on how to use this header file just a text document with it describing what each part of the file does. It is probably very simple however I cannot figure it out .

 

Arun

Link to comment
Share on other sites

Hi Arun,

 

It is probably very simple however I cannot figure it out .

 

 

 

Using the NWI from a .net language is not simple at all. Especially if you're using the arcane C# SDK that you are using and you don't have a good understanding of C or C++. Even if you managed to get the raw data from the NWI area you've still got a ton of work to do decoding the raw bytes into usable C# variables.

 

To give you an idea, the NWI module in my .net dll is just over 600 lines of c# code.

 

I would like to suggest that you instead try my FSUIPC Client DLL for .NET. I have an unreleased beta version which allows you to access the NWI in a very friendly '.net' way (i.e. using a .net weather object). I'd be happy to let you test it.

 

To find out more please visit my subforum where you can download the DLL and the documentation.

 

http://forum.simflight.com/forum/167-fsuipc-client-dll-for-net/

 

If you want to test the weather stuff then send me a PM and I'll send you the beta version and some sample code. But please get familiar with the basics of reading/writing the more common offsets first.

 

Regards,

 

Paul

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.