Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

 

 I'm trying to read METAR at offset B800 through a VB application and using the usual way I use to read strings (in  the attachment), but in this case I get only an empty string.

 

Do you have suggestions respect what I am doing wrong helping me to solve the problem?

 

Thanks in advance

 

Joe

 

 

 

 

metar.txt

Posted

Hi,

 

 I'm trying to read METAR at offset B800 through a VB application and using the usual way I use to read strings (in  the attachment), but in this case I get only an empty string.

 

Do you have suggestions respect what I am doing wrong helping me to solve the problem?

 

Thanks in advance

 

Joe

 

Have you actually sent a read request first? It's the same as reading weather through the NWI, but just that you can get the string instead of having to decode the binary array data.

 

And try using FSInterrogage to monitor the offset. I'm not able to check your code, it is in VB I assume? I don't know it.

 

Pete

Posted

Do you mean that I could try to read directly the string not decoding the offset content byte for byte?

 

It IS a string! An ASCII string with one byte per ASCII character, ending with a zero byte. The format is called "ASCIIZ". It is standard format in C, C++ and FS, but not in VB.

 

How do you 'decode a string byte by byte'? Do you mean interpret the weather. converting METAR gobbledegook into English?

 

I suggested checking that you are reading the offset data correctly by comparing what FSInterrogate, shows. That is the utility provided in the SDK to help you debug your code. you can also use FSUIPC's logging which gives extensive assistance, especially with ipcRead and ipcWrite logging, to see if your program is operating correctly.

 

Pete

Posted

Hi Pete,

 

the problem here is that i use a routine like the one I attached for other ASCIIZ offsets (i.e. 3D00 or 3E00) with success, but in this case this does not seem to be correct.

 

In FSInterrogate e looking af FSUIPC logs the offset content looks fine, so I think is really a problem related how the VB6 code is written.

 

I hiope someone VB expert wll give a support.

 

Thanks again

 

 

Joe

Posted

the problem here is that i use a routine like the one I attached for other ASCIIZ offsets (i.e. 3D00 or 3E00) with success, but in this case this does not seem to be correct.

 

In FSInterrogate e looking af FSUIPC logs the offset content looks fine, so I think is really a problem related how the VB6 code is written.

 

I hiope someone VB expert wll give a support.

 

You could try Paul Henty, in the SubForum above dealing with his .Net interface. I know he is very good with .Net VB. I don't know if VB6 is much different.

 

Pete

Posted

In VB6, the easiest way to convert an ASCIIZ byte array (defined as barray() before reading offset) to a string, taking into account 0 terminator is

string = StrConv (barray, vbUnicode)

See your VB documentation

 

Hervé

Posted

Hi Joe,

 

The code you posted is just reading offset B800, but it's more complicated than that. There is a weather reading process you need to go through first to tell FSUIPC what station or lon/lat you want the METAR for.

 

This is all described in the "NewWeather ReadMe.txt" document supplied with the FSUIPC SDK. Specifically the section called "CC00-CFFF (Area 3): Weather reading area". This should be read in conjunction with "NewWeather.h" which is a C header file that contains the data structures. I'm not sure how you're going to deal with writing C data structures in VB6 though. You may need to build byte arrays instead but I don't know VB6 that well.

 

Paul

  • 2 months later...
Posted

Hi,

 

 I'm trying to read METAR at offset B800 through a VB application and using the usual way I use to read strings (in  the attachment), but in this case I get only an empty string.

 

Do you have suggestions respect what I am doing wrong helping me to solve the problem?

 

Thanks in advance

 

Joe

 

 

Hello Joe

I'm trying to do the same as you, in old fashioned VB6  ...

Had you success ?

 

Sofar I understand several steps are required:

1. Translate NewWeather.h  into VB6 declarations

2. Write ICAO or special codes GLOB ,????, <??> to &HB808.

    As VarPtr put the Variable defined Dim TmpString as string * 2000

3. Write same with same FSUIPC_Process  a command into &HB800

    Not sure yet what is for READ only

4. You get the a METAR String back

 

Theory  so far.

 

Regards

Peter Kruesi

Posted

You could try Paul Henty, in the SubForum above dealing with his .Net interface. I know he is very good with .Net VB. I don't know if VB6 is much different.

 

Pete

 

Hello Pete

 

Trying to use VB6 :razz: for my applications.

 

&H13FC, &H1400 Payload section

The Payload section does run as described. I can change the Weights and names off stations. FSX does adopt all relevant weights accordingly.

I have not verified yet other International configurations then my mixed US / metric. Kilogramms with conversion to/from lbs works fine.

 

NWI

Need to develop, see below reply to Joe.

 

Anyway, Thanks for your tremendous piece of work !

 

Best regards

Peter Kruesi

  • 2 weeks later...
Posted

Hello Pete

 

Sorry, can not get working the weather interface. I'm sure that basically my VB6 code is correct as well the variables or variable arrays.

Just confused how the process really is, need towrite what there ?  Need to read something where ???

 

What I want to do is globally change weather with a metar string. With this we can fly alltime in weather conditions we wanted ?

 

Everything else works so nicelly  !

 

Peter

www.airforcecenter.ch, select English and see under simulators    ...

Posted

Hello Pete

 

Sorry, can not get working the weather interface. I'm sure that basically my VB6 code is correct as well the variables or variable arrays.

Just confused how the process really is, need towrite what there ?  Need to read something where ???

 

What I want to do is globally change weather with a metar string. With this we can fly alltime in weather conditions we wanted ?

 

In FSX or FS9?

 

Usually, and especially in FS9, you first need to clear all weather. Because if weather has been set in any weather station beforehand, the global weather you are setting only applies to stations not yet so set. However, in FSX there is a GLOBAL mode supported, so first you set that.

 

Have you referred at all to the "New Weather Interface" ZIP in the FSUIPC SDK? That really should tell you most of what you need to know.  There you will see about NW_CLEAR, and, in the Header file, NW_GLOBAL, which you need to use to set global mode. The use of the METAR strings is only described in the Offsets Status list.

 

To set weather using SimConnect's special format METAR strings (and you need the SimConnect documentation for that), you first write the pseudo ICAO ID "GLOB" to C808, the chICAO element in the "NewWeather" structure. You need to do this before writing the full METAR string to B000.

 

Pete

Posted

- FSX

- Yes studied the SDK and documents

 

So the procedure is:

 

- Declared NW_CLEAR and NW_GLOBAL as other similar constants in VB6

- Write or WriteS (?) the string "GLOB" to &HC808, 8,

- Write the command parameter NW_GLOBAL=3 &HC800, 8

- Call FSUIPC_Process

- Then Write or WriteS (?) the string "xxx" containing the METAR string to &HB000 (I take sample METAR string from one I found in the forum told "working")

- Call FSUIPC_Process

 

- No really required, just to see if changes take place: Wait until FSUIPC has got new data then read &HB000 a string to verify

- Call FSUIPC_Process

 

I try later again.

Posted

- Declared NW_CLEAR and NW_GLOBAL as other similar constants in VB6

- Write or WriteS (?) the string "GLOB" to &HC808, 8,

- Write the command parameter NW_GLOBAL=3 &HC800, 8

- Call FSUIPC_Process

- Then Write or WriteS (?) the string "xxx" containing the METAR string to &HB000 (I take sample METAR string from one I found in the forum told "working")

- Call FSUIPC_Process

 

- No really required, just to see if changes take place: Wait until FSUIPC has got new data then read &HB000 a string to verify

- Call FSUIPC_Process

 

I try later again.

 

I don't know VB at all so I can't advise on the programming.

 

- Write or WriteS (?) the string "GLOB" to &HC808, 8,

- Write the command parameter NW_GLOBAL=3 &HC800, 8

- Call FSUIPC_Process

 
Several points here:
 
1. I think you want to first do the clear (one write), then set Global mode (you MIGHT be able to get away without clearing -- it was needed in FS2004. May not be needed in FSX).
2. You do NOT write the command to C808! Please PLEASE do refer to the SDK data. The header file clearly shows that uCommand is a short integer (ie. 2 byte, or 16bits) at C800. It's the very first element of the NewWeather structure. How could you miss that?
3. The ICAO 'GLOB' is 4 bytes. there's no zero terminator as there would be for a string. I tend to write such values as a 32bit integer instead. i.e 0x424F4C47 (in C/C++ notation). 
4. Where are those 8's coming from? Do you think everything is 8 bytes long? It isn't. Please look at the NewWeather structure again.
5. The clear, then the global mode requests are separate commands and need their own Process, and may  even need a pause between them. Try first without the clear, but have a short pause after the process for the global mode setting. These things take time in FS.  Writing the GLOB ICAO can be done in the same process as writing the METAR, but should be fore it in sequence.
 
The most important thing in programming is to be precise. Garbage in, garbage out. Please be more careful when referring to the details. You seem to go headlong into things without actually looking at what is written.
 
Pete
  • 2 years later...
Posted

Hi Pete, I do not want to program myself a little Add-On for reading the current (!) FSX weather.

Do you know about a small program , which reads the current METAR out of FSX ?

How can I use FSUIPC ? With FS-Interrogate I found a first step.

Here I found a thread http://www.fsdeveloper.com/forum/threads/simconnect-weather.5254/

but the add-on is no more available.

thanks

    Alhard

  • 2 weeks later...
Posted
On 5/15/2017 at 10:11 PM, alihor said:

I do not want to program myself a little Add-On for reading the current (!) FSX weather.

Do you know about a small program , which reads the current METAR out of FSX ?

My own little program "WeatherSet2" (or "WeatherSet") does this, and more. See the "Useful Additional Programs" thread in the Download Links subforum.

Pete

 

 

 

Posted
1 hour ago, alihor said:

But I suppose, you are reading the weather info via FSX offsets.

No, the offsets are part of FSUIPc, populated by information from FSX.

1 hour ago, alihor said:

I need a program, which reads the current weather info via SimConnect Calls like SimConnect_WeatherRequestObservationAtStation

Do you have an idea?

The point of FSUIPC is to allow folks to interface to FSX in a compatible manner across versions of FS. If you want to interface directly to FS, it isn't anything to do with FSUIPC. You need to refer to the FSX SDK.

Pete

 

Posted

Thanks for your quick response. I think, you have a lot to do after vacation time.

Yes, I tried a lot with the Simconnect SDK, but as I am not very experienced with C++ programming, I am looking for a quick solution wtih a VB frame program to start with.

Posted
1 hour ago, alihor said:

as I am not very experienced with C++ programming, I am looking for a quick solution wtih a VB frame program to start with.

Isn't there some parts of the SimConnect SDK providing details for managed languages.

I'm not the right person in any case -- my languages are nly C, Assembly code, and even machine code.

Pete

 

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.