Jump to content
The simFlight Network Forums

Recommended Posts

Posted
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 🙇‍♂️

  • 2 weeks later...
Posted

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
Posted
10 hours ago, Paul Henty said:

From the client, access to the MSFS variables (LVars and HVars) is done through the 'vars' command.

Awesome - I'll check it out when I get a chance!

Posted
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

Posted
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.

Posted
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

 

Posted
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?

Posted
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
Posted
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?
 

Posted
7 hours ago, John Dowson said:

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

Oh, that's a godsent link right there! Using the calculator codes I find there it works beautifully. I just wonder why calculator code "(>H:AS1000_PFD_SOFTKEYS_4)" works but the Hvar "AS1000_PFD_SOFTKEYS_4" doesn't - isn't that what the CalcCode is doing? (yes, I did copy the .hvar file to the modules folder in fsuipc-lvar-module). I don't really need to know why though, since I have a working solution, I just wondered...

And this means I don't need to install the MF WASM - how nice.

 

7 hours ago, John Dowson said:

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?
 

I'm using stock C172 and is indeed using the WorkingTitle G1000 mod. Tried googling hvars for that but didn't really find anything... But it seems to work with the code from hubhop.

Posted
16 minutes ago, Firefly said:

Oh, that's a godsent link right there! Using the calculator codes I find there it works beautifully. I just wonder why calculator code "(>H:AS1000_PFD_SOFTKEYS_4)" works but the Hvar "AS1000_PFD_SOFTKEYS_4" doesn't - isn't that what the CalcCode is doing? (yes, I did copy the .hvar file to the modules folder in fsuipc-lvar-module). I don't really need to know why though, since I have a working solution, I just wondered...

Did you rename the hvar file so that it is loaded with the aircraft you are using? To check, can you see the hvar in the Add-ons->WASM->Activate Hvar... menu item, and if so does it work there? If not, please let me know the aircraft you are using + any mods and I will check here.

16 minutes ago, Firefly said:

I'm using stock C172 and is indeed using the WorkingTitle G1000 mod. Tried googling hvars for that but didn't really find anything... But it seems to work with the code from hubhop.

Ah, ok. I haven't checked with the WT G1000 mod. However, it is strange that it works via calculator code and not using the hvar directly. I will check this tomorrow and get back to you.

John

Posted
52 minutes ago, John Dowson said:

Did you rename the hvar file so that it is loaded with the aircraft you are using? To check, can you see the hvar in the Add-ons->WASM->Activate Hvar... menu item, and if so does it work there? If not, please let me know the aircraft you are using + any mods and I will check here.

I didn't rename the file (it's still called G1000.hvar) but it shows up in the Activate HVAR window so I'm presume it's loaded. But nothing happens when I press Activate. (Only using stock C172 with WT G1000 mod)

Posted
16 hours ago, Firefly said:

I didn't rename the file (it's still called G1000.hvar) but it shows up in the Activate HVAR window so I'm presume it's loaded.

Yes, thats fine, as the aircraft title is "Cessna Skyhawk G1000 Asobo" and so has 'G1000' in the title, so the jvar file is loaded.

The problem is with the G1000.hvar file. You need to add a 'H:' before each hvar name. I will correct this in the next WASM release so this is optional (and the provided hvar files will work as is), but for the time being make sure that each hvar name in your .hvar files are preceded with  'H:'.

John

Posted (edited)

You could try using the attached WASM, which will work with hvars not preceded by 'H:'. Just replace the file in your Community/fsuipc-lvar-module/modules folder: FSUIPC7_WASM.wasm

Also replace the layout.json file (in the /fsuipc-lvar-module folder) with the following: layout.json

Edited by John Dowson
layout.json added
Posted
On 9/22/2021 at 12:31 PM, John Dowson said:

The problem is with the G1000.hvar file. You need to add a 'H:' before each hvar name. I will correct this in the next WASM release so this is optional (and the provided hvar files will work as is), but for the time being make sure that each hvar name in your .hvar files are preceded with  'H:'.

Finally had time to continue with this. Adding the "H:" did seem to fix it.

  • 2 months later...
Posted

Hi @Paul Henty Thanks for the brilliant Websocket Server. I succeeded to access a lot of HVars and LVars which is really great.

By trying to use the website i built as well on my mobile, i noticed, that i'm only able to register the websocket server either on localhost or 127.0.0.1 (which is just the IP4 representation of localhost). But via the IPV6 nor - and worse - the Hostname i do not succeed to register/start the websocket server.

With a websocket server i made on my own, i can easily register on that port. Probably you've an idea, what the reason might be.
My aim is to access with multiple clients to the websocket server. Is that supported as well?

Best regards and thanks for your great solution,

       Joe

Posted

Hi Joe,

The server was designed for multiple clients so that shouldn't be a problem.

For IPv6 addresses:

there was a bug in the server which I have now fixed. Please get the latest version (0.5.2).

For host names and IP addresses other than local:

Windows does not allow binding to some IP addresses and hostnames unless the application is running "as Administrator". If you are getting the error "Access is Denied" then this is the problem.

If you run the Websocket Server "as Administrator" then you also need to run FSUIPC7 and MSFS "as Administrator".

Running the new version "as Administrator" should solve your problems.

Paul

  • Thanks 1
Posted
12 hours ago, Paul Henty said:

Windows does not allow binding to some IP addresses and hostnames unless the application is running "as Administrator". 

That was, what made my day. 

So thanks a lot!

  • Like 1
  • 5 months later...
Posted

Hello Paul. My name is Manuel, and I am part of the Staff of a virtual airline and we are building our own ACARS with your websocket. We saw that every so often you update it and that is very good. What I wanted to ask you, if you don't mind, some kind of API to know when there are socket updates. Is there any chance of that?

Thank you very much and great job!

Posted

Hi Manuel,

I don't know if I understand what you are asking for correctly.

The server program will notify about new versions on the 'about' tab.

Do you want a way for your client application (web page) to know if the server program needs to be updated (new version available)?

Paul

  • 3 months later...
Posted
On 5/21/2022 at 7:04 PM, Paul Henty said:

Hi Manuel,

I don't know if I understand what you are asking for correctly.

The server program will notify about new versions on the 'about' tab.

Do you want a way for your client application (web page) to know if the server program needs to be updated (new version available)?

Paul

Hi Paul, sorry for the delay in responding. My question is if there is any possibility of automatic updates. In case of being very complicated if you could add a kind of API in the web page with which you could verify the current version of the socket with that of the client, and in case there is a new version it is notified that it exists and redirected to the website to download it. Thanks for your time.

Posted

Hi,

I don't have any plans to add an automatic update. 

In version 1.0.0 of the WebSocketServer I added a property to the 'about.read' response called 'newServerVersionAvailable'.

Your web socket client program (or website) can check this. If it's 'true' it means that the WebSocketServer you are connected to is out of date. You can then warn the user and give instructions on updating.

Will that fit your needs?

Paul 

Posted
On 9/12/2022 at 6:54 AM, Paul Henty said:

Hi,

I don't have any plans to add an automatic update. 

In version 1.0.0 of the WebSocketServer I added a property to the 'about.read' response called 'newServerVersionAvailable'.

Your web socket client program (or website) can check this. If it's 'true' it means that the WebSocketServer you are connected to is out of date. You can then warn the user and give instructions on updating.

Will that fit your needs?

Paul 

Hi Paul, yes that would be very helpful. Thanks again for your time on this project!

Greetings, Manu.

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.