I am developing an aircraft that needs to use a Wasm module to (heavily) modify various state of the aircraft, through the simulation variables, while it is flying, to achieve its purpose. I use the Wasm SimConnect API for this.
I first used a standalone Wasm module, and that worked great. I call SimConnect_Open(), a few SimConnect_SubscribeToSystemEvent(), lots of SimConnect_AddToDataDefinition(), one SimConnect_RequestDataOnSimObject(), and then one SimConnect_CallDispatch().
Works as it should, my dispatch callback function gets called whenever any of the simulation variables I have requested data on changes.
But, I then realised that a standalone Wasm module, even if packaged as part of a specific aircraft, actually is loaded and active all the time, regardless of what aircraft the user is currently flying. Which is obviously not what I want.
So I need to turn it into a panel Wasm module instead. OK, just a slight change in the plumbing, use a FOO_gauge_callback() instead of module_init(), and do the initialisation when I get the PANEL_SERVICE_PRE_INSTALL callback. Sounds not like a major change.
But, it doesn’t seem to work;) I don’t get any dispatch callbacks when the simulation variables I have requested data for changes… I do get callbacks for the system events I have requested.
I wonder what I am missing, it must be something simple, as this is basically how any of the “interesting” third-party panel Wasm modules work, right? (Like what the helicopters use.)