Jump to content
The simFlight Network Forums
Delphi

Issue with Lvar and WideClient

Recommended Posts

Hi Paul,
I have a problem reading Lvars if my application runs on a remote computer. My application uses some of the GSX Lvars. Works fine if the application is running on the FS PC. On the remote PC the reading of all GSX LVars is '0'. I do not user the private offset range 0x66F8-0x66FF. Some help would be very appreciated.

Ruediger

Share this post


Link to post
Share on other sites

Hi Ruediger,

I assume you are using the FSUIPCConnection.ReadLVar() method. Unfortunately this doesn't work over WideFS. WideClient is sending your application a cached value, without waiting for the real value to arrive from FSUIPC. This is because of the way this feature is implemented in FSUIPC.

There is a workaround I can try but it will make each LVAR read at least three times slower. They are not fast at the moment so I suspect slowing them down by three will make it unusable. If you're only reading a few LVARs and not very frequently then I can add a new method for reading LVARs over WideFS if you want to try it.

Paul

Share this post


Link to post
Share on other sites

Hi Paul,
I'm fine as it works. I can run the application on the FS computer. Thanks for your offer to add a new method for reading Lvars over WideFS. Don't inverst time for it.

Ruediger

Share this post


Link to post
Share on other sites

Hi Paul,

I have the same Problem when reading several LVars on my Application. I don't have the possibility to run it on the FS Computer.

Is there a solution possible to get it with the Client.dll, I read about 10 LVars and that every second. I can extend the time if needed? 

Regards

Matthias

Share this post


Link to post
Share on other sites

Hi Matthias,

Yes it's possible. I've included some code below (VB and C#).

Call this new function (ReadLVarWideFS) in the same way as you call FSUIPCConnection.ReadLVar().

It works by reading the value some milliseconds after the normal ReadLVar is called. This gives time for WideFS to see the change and update its cached value for the user offset.

This obviously slows things down a lot. On my system here a 150ms delay produces reliable reads. You'll need to experiment. Maybe your system can use a lower value, or maybe, if you have a lot of other WideFS traffic, or lots of add ons, or a slower PC, you might need to increase this time.

C#

        private Offset<double> lvarData = new Offset<double>("LvarData", 0x66F8);
        private int WideFSLVarDelay = 150;

        private double ReadLVarWideFS(string LVAR)
        {
            FSUIPCConnection.ReadLVar(LVAR);
            Thread.Sleep(WideFSLVarDelay); 
            FSUIPCConnection.Process("LvarData");
            return lvarData.Value;
        }

VB.NET

    Private lvarData As Offset(Of Double) = New Offset(Of Double)("LvarData", &H66F8)
    Private WideFSLVarDelay As Integer = 150

    Private Function ReadLVarWideFS(LVAR As String) As Double
        FSUIPCConnection.ReadLVar(LVAR)
        Thread.Sleep(WideFSLVarDelay)
        FSUIPCConnection.Process("LvarData")
        Return lvarData.Value
    End Function

Paul

Share this post


Link to post
Share on other sites

Hi Paul,

I will try the workaround, too. Running my GSX application on the remote computer would make the handling more comfortable.

I will let you know the results.

Ruediger

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • 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.