Jump to content
The simFlight Network Forums

Best way to make browser interface with FSUIPC?


Firefly
 Share

Recommended Posts

10 hours ago, Paul Henty said:

My FSUIPCClient DLL (used by the socket server) now has support for accessing LVars/HVars directly from the WASM module. It seems to be stable now so next week I will expose this via the Socket Server.

This will mean you won't need to assign LVars to offsets anymore. You'll have direct access to them with something like "lvar.request". You'll also be able to set HVars and execute calculator code.

This will only be for MSFS/FSUIPC7.

 

Oh Paul, that sounds awesome - not even having to assign them in FSUIPC first. You're an angel! 🙂 I will be waiting as patiently as I can 🙇‍♂️

Link to comment
Share on other sites

  • 2 weeks later...

Version 0.3.0 is now available on the website.

http://fsuipcwebsockets.paulhenty.com/

The zip now contains an extra file FSUIPC_WAPID.DLL which must also be present in the folder you run the server from.

The new MSFS Variables feature has its own page in the main form. This shows you the status of the connection to John Dowson's WASM module and allows you to see logging information and list known variables.

From the client, access to the MSFS variables (LVars and HVars) is done through the 'vars' command. I've made it work almost identically to the offsets commands for consistency. Once difference is that to write variables, they don't need to be included in any 'declare' first. Any variable can be written at any time. This means the 'vars.write' will not send back a 'read' as it's not tied into a group of variables.

In theory calculator code can be run with 'vars.calc' but I've no examples here to try.

Full documentation is on the website along with working example code. 

Paul

  • Like 1
Link to comment
Share on other sites

On 9/12/2021 at 12:51 AM, Paul Henty said:

Version 0.3.0 is now available on the website.

I was playing around with it and believe I was successfully sending Hvars to the sim although I probably didn't use the right ones yet. The websocket response to the vars.write command was success=true at least.

But now I ran into some issue. I read about the MobiFlight WASM module and that it made more variables available (eg. for the G1000), so I installed that into the Community folder and when I then started MSFS and was trying to use the websocket server I got the error that it couldn't start the Variables service (see the first screenshot). Since I also had the FSUIPC WASM installed I was thinking that maybe I could not have both WASM modules installed at the same time, so I removed the MobiFlight one again, restarted MSFS and tried again. But I still get the same error (see second screenshot) - and if I click the Start button I get the unhandled exception which I also copied in below. (also tried restarting the computer entirely)

Since I got success=true in the beginning I believe everything was connecting ok under the MSFS Variables tab - but since I don't specifically recall what it said there I can't for sure say whether this problem was there before I tried the MobiFlight WASM module... Any ideas?

 

System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
   at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at FSUIPCWebSocketServer.GUI.ctlVariableServiceStatus.vs_LogEntryReceived(Object sender, LogEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at FSUIPCWebSocketServer.VariableServices.VS_OnLogEntryReceived(Object sender, LogEventArgs e)
   at FSUIPC.WAPI.fsuipcw_start()
   at FSUIPCWebSocketServer.VariableServices.Start()
   at FSUIPCWebSocketServer.GUI.ctlVariableServiceStatus.btnStartStop_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

fsuipcwebsocket server error1.png

fsuipcwebsocket server error2.png

Link to comment
Share on other sites

12 hours ago, Firefly said:

I read about the MobiFlight WASM module and that it made more variables available (eg. for the G1000)

The MF WASM module will not give you access to more variables. It will provide additional 'controls/events' (or what MF now call 'presets') what act upon existing variables (A, K, H, L).
Not sure about your actual issue - I'll leave that to Paul.

Link to comment
Share on other sites

Quote

if I click the Start button I get the unhandled exception which I also copied in below. (also tried restarting the computer entirely)

I've found that bug. Please try 0.3.1 - you shouldn't get that particular crash any more.

http://fsuipcwebsockets.paulhenty.com/#home

 

Quote

Since I got success=true in the beginning I believe everything was connecting ok under the MSFS Variables tab

Yes it was working then. If there was no connection it would have reported a "NoFlightSim" error.

For your connection problem - it sounds like something in the WASM module. The log entries are directly from that module, so not part of my software.

To check, please try John's WASMClient.exe which can be found in the "FSUIPC WASM Module 0.5.4" package available at http://fsuipc.com/

If that also fails to connect then you'll need to ask John Dowson about it. It could be that the other WASM module has messed something up. 

If his client does work then let me know and I'll look into it more on my side.

Paul

 

Link to comment
Share on other sites

12 hours ago, John Dowson said:

The MF WASM module will not give you access to more variables. It will provide additional 'controls/events' (or what MF now call 'presets') that act upon existing variables (A, K, H, L).

Okay, maybe I misunderstood what I was reading then, eg. here:

 

So now I'm all confused... Don't I need to install the MF WASM module to control the G1000 if I already have the FSUIPC WASM module installed? And for eg. the softkeys, isn't it the Hvars (or Lvars?!) I need to use to activate those?

Link to comment
Share on other sites

8 hours ago, Paul Henty said:

I've found that bug. Please try 0.3.1 - you shouldn't get that particular crash any more.

Great - now the MSFS Variable Service connected correctly to the sim and I was able to successfully use both the L and Hvars in the A320 as you have in your documentation example. It's just awesome to have this working so smoothly and responsive - looking so much forward to further reduce the use of that pesky mouse! So far so good.

Now I also got some of the G1000 buttons to work, eg. MFD range inc/dec, but most other Hvars don't work (none on the PFD). They don't work when I trigger them from FSUIPC either, so it's not an issue of the websocket server though...

  • Like 1
Link to comment
Share on other sites

14 hours ago, Firefly said:

Don't I need to install the MF WASM module to control the G1000 if I already have the FSUIPC WASM module installed? And for eg. the softkeys, isn't it the Hvars (or Lvars?!) I need to use to activate those?

You can use the MF WASM if you want to use those events, but the events are translated by the MF WASM and to calculator code which can simply activate lvars/hvars/etc, although some of the code is more complex. You can see what calculator code each MF event uses using the preset app list here: https://hubhop.mobiflight.com/#/list

12 hours ago, Firefly said:

but most other Hvars don't work (none on the PFD). They don't work when I trigger them from FSUIPC either, so it's not an issue of the websocket server though...

Check what the MF presets use.  Did you try with the G1000.hvar file (included in the HvarFiles subfolder)? This was created quite a while ago now and may be out of date, I'll review those hvar files when I get a chance. The hvars may also be different if using a mod for the G1000 (e.g. the WorkingTitle G1000 mod). What aircraft and/or mod are you using?
 

Link to comment
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...
 Share

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