SimConnect and GPS Event IDs

Hello there, I am trying to get the GPS Events (dialing through pages, MSG, etc) to work. Typically I am using MobiFlight and FSUIPC to achieve this and it worked all great with FSX and P3D.

I am looking at the SDK Documentation that comes with the latest SDK version 0.6.1 and the Events are clearly defined there and marked as “RECOGNIZED” which I assume is saying that they tested it and it should work.

For the GNS430 I am talking about:

KEY_TOGGLE_GPS_DRIVES_NAV1 TOGGLE_GPS_DRIVES_NAV1 Shared Cockpit Recognized
KEY_GPS_POWER_BUTTON GPS_POWER_BUTTON Shared Cockpit Recognized
KEY_GPS_NEAREST_BUTTON GPS_NEAREST_BUTTON Shared Cockpit Recognized
KEY_GPS_OBS_BUTTON GPS_OBS_BUTTON Shared Cockpit Recognized
KEY_GPS_MSG_BUTTON GPS_MSG_BUTTON Shared Cockpit Recognized
KEY_GPS_MSG_BUTTON_DOWN GPS_MSG_BUTTON_DOWN Shared Cockpit Recognized
KEY_GPS_MSG_BUTTON_UP GPS_MSG_BUTTON_UP Shared Cockpit Recognized
KEY_GPS_FLIGHTPLAN_BUTTON GPS_FLIGHTPLAN_BUTTON Shared Cockpit Recognized
KEY_GPS_TERRAIN_BUTTON GPS_TERRAIN_BUTTON Shared Cockpit Recognized
KEY_GPS_PROCEDURE_BUTTON GPS_PROCEDURE_BUTTON Shared Cockpit Recognized
KEY_GPS_ZOOMIN_BUTTON GPS_ZOOMIN_BUTTON Shared Cockpit Recognized
KEY_GPS_ZOOMOUT_BUTTON GPS_ZOOMOUT_BUTTON Shared Cockpit Recognized
KEY_GPS_DIRECTTO_BUTTON GPS_DIRECTTO_BUTTON Shared Cockpit Recognized
KEY_GPS_MENU_BUTTON GPS_MENU_BUTTON Shared Cockpit Recognized
KEY_GPS_CLEAR_BUTTON GPS_CLEAR_BUTTON Shared Cockpit Recognized
KEY_GPS_CLEAR_ALL_BUTTON GPS_CLEAR_ALL_BUTTON Shared Cockpit Recognized
KEY_GPS_CLEAR_BUTTON_DOWN GPS_CLEAR_BUTTON_DOWN Shared Cockpit Recognized
KEY_GPS_CLEAR_BUTTON_UP GPS_CLEAR_BUTTON_UP Shared Cockpit Recognized
KEY_GPS_ENTER_BUTTON GPS_ENTER_BUTTON Shared Cockpit Recognized
KEY_GPS_CURSOR_BUTTON GPS_CURSOR_BUTTON Shared Cockpit Recognized
KEY_GPS_GROUP_KNOB_INC GPS_GROUP_KNOB_INC Shared Cockpit Recognized
KEY_GPS_GROUP_KNOB_DEC GPS_GROUP_KNOB_DEC Shared Cockpit Recognized
KEY_GPS_PAGE_KNOB_INC GPS_PAGE_KNOB_INC Shared Cockpit Recognized
KEY_GPS_PAGE_KNOB_DEC GPS_PAGE_KNOB_DEC Shared Cockpit Recognized

I am using the SimConnect Demo that demonstrates how to read data from the sim and I enhanced it with the part where I am sending events.

The main steps are to:

map your client events to the ones that are known by the sim

    m_oSimConnect.MapClientEventToSimEvent(EVENT_ID.GPS_MSG_BUTTON, "GPS_MSG_BUTTON");
    m_oSimConnect.MapClientEventToSimEvent(EVENT_ID.GPS_PAGE_KNOB_INC, "GPS_PAGE_KNOB_INC");
    m_oSimConnect.MapClientEventToSimEvent(EVENT_ID.GPS_PAGE_KNOB_DEC, "GPS_PAGE_KNOB_DEC");

register your groups

m_oSimConnect.AddClientEventToNotificationGroup(GROUP_ID.GPS, EVENT_ID.GPS_MSG_BUTTON, true);
            m_oSimConnect.AddClientEventToNotificationGroup(GROUP_ID.GPS, EVENT_ID.GPS_PAGE_KNOB_DEC, true);
            m_oSimConnect.AddClientEventToNotificationGroup(GROUP_ID.GPS, EVENT_ID.GPS_PAGE_KNOB_INC, true);
            m_oSimConnect.SetNotificationGroupPriority(GROUP_ID.GPS, SimConnect.SIMCONNECT_GROUP_PRIORITY_HIGHEST);

And then when I click a button I am sending an Event like this:

m_oSimConnect.TransmitClientEvent(0, EVENT_ID.GPS_PAGE_KNOB_INC, 2, GROUP_ID.GPS, SIMCONNECT_EVENT_FLAG.DEFAULT);

I have also tried
m_oSimConnect.TransmitClientEvent(0, EVENT_ID.GPS_PAGE_KNOB_INC, 0, GROUP_ID.GPS, SIMCONNECT_EVENT_FLAG.DEFAULT);

I am not 100% clear on what the first param (0) and the third param (0 or 2) is about.

I have tried with the same command to send the parking brake event, and that one just works fine.

What am I missing? Does anyone know?

2 Likes

These events doesn’t work. You need to use a WASM module, use clientEvents in simconnect and send_keys using the legacy C++ gauges lib.

Ok, that doesn’t sound like it is gonna be easily done for the G1000/GNSx30 in a generic way, sounds like you have to alter every individual plane - is the example from RealSimGear somewhere published so that I could review it?

I saw there are people who are creating mods for g1000 and the gnsX30… could we include support for custom events in there?

The software from RealSimGear was done by Aerosoft so you may have some luck asking there. I cannot share our code (I’m from Virtual Fly) which is in the final testing process. However I can guide you on how you can do it.

You are absolutely correct and each and every one of the aircraft with G1000 need to be modded. Regarding the G1000 mod, our software does work with it and we recommend using it, however I am not sure if it can be added to their mod. It might be worth a shot trying to contact them and see what can be done. Again, I have my hands tied in what I can and cannot share but I can guide you or anyone who wants to do that.

I do believe it would be a great addition to the software!

Regards,

Pau Garcia

I see some problems arising with the current (wasminstrument) approach.

RealSimGear/Aerosoft and others will provide a wasm instrument, mimicing a empty gauge, and override the panel.cfg of the aircrafts, to get that empty gauge loaded.
This enables “bridging” access to the gauges/simdata that is currently not accessible via SimConnect, and offer the possibility to bridge events to the javascript gauges (e.g. the G1000) bypassing the shortcomings of the current Asobo implementation and the lack of handling of the e.g. G1000/GPS-SimConnect-Events.

Problem 1:
You have several addons, each providing such a wasminstrument. They all want to do more or less the same thing. They all override the default panel.cfg of the C172. There’s no “loading order” in msfs so, which panel.cfg will be in effect? Random

Problem 2:
More than one addon addressing the same shortcomings will add unnecessary load to the sim.

Problem 3:
You have 3 addon reacting to G1000_MFD_GROUP_KNOB_INC event and translate it.
E.g. 2 will emulate the corresponding keypress , 1 will call into the javascript gauge
This will lead to a mess

Problem 4
Everyone implements it’s own Custom Events to handle that stuff.

(Not talking about the surely needed customer support here, which will hit us all, if panels not loaded / functions are (not) working randomly)

I’m working on such a wasminstrument for SPAD.neXt as well, and stumbled right into all those problems.

I don’t think this is the way we should do it.

So what to do?

Part 1 ( Missing / Unhandled SimConnect Events )
a) Working together with Asobo on adressing the SimConnect shortcomings and enhance the javascript panels to work correctly with the simconnect events.
b) If Asobo is not “interested”, start a joint project to “do it ourselves”. (Just like FlyBaWire did for the A320)

Part 2
I think we can agree the one of the biggest shortcoming is the lack of the ability to create a “non gauge” global addon, in order to get the “PANEL” struct/function for access to Lvars etc.
Again i think, everyone creating his own “workaround” is not a good solution. As long as there is no official solution for that, I again vote for a joint project . Let’s draft a common interface, which enables the stuff needed, and we all use the same “gauge plugin” to talk to the aircraft/sim.

Regards,
Ulrich Strauss

11 Likes

I agree 100% - this is something that the platform has to provide and hence it’s their job to take care of it. The best would be that there is a common set for all aircrafts and some option that addons can bring their own events and extend the existing ones.

Is there anything like this on the list that the devs are watching and planning for their backlog?

3 Likes

I completely agree with you both. I am going to contact (again) Asobo regarding this. Let’s see what they have to say.

I will update when I have some answer.

6 Likes

Yes, we need this very much for GPS systems, Camera and SLEW controls. Lots of missing SIMCONNECT stuff needed for hardware control of many systems…

1 Like

Thank you for taking the time to investigate this problem and sharing your findings. I really like your idea (in Part 2) of a common, open interface that provides other JS or WebAssembly mods access to plane gauges. Such an interface is essential to allow more than just one mod to access them.

I really appreciate what Asobo is doing with this sim. That said, considering what I’ve seen so far (e.g. with the Longitude), I wouldn’t bet on the platform providing this soon-ish. Hence, the common interface idea.

Great news! From the last Dev Update (2020-11-14):

WebAssembly:

  • We added support for standalone WASM modules. These should be placed in a “modules” folder located at the root of the package, and will be loaded automatically when the said package is mounted. The “module_init” and “module_deinit” functions will be called upon loading/unloading.

Assuming that standalone WASM can also access the gauge API, that means we can access the things missing in SimConnect in a less hacky way that works with more than one mod. It would also mean that (premium) deluxe aircraft won’t have to be modified directly (in the official packages folder) anymore. To Asobo and the person who asked Asobo to do this: thank you! This is one step closer to having all sim controls in your home cockpit.

Also, apparently now you can now write WASM modules accessing the Gauge API in rust: https://github.com/devsnek/msfs-rs

I believe this will make everything easier for everyone! Thank you Asobo!

Does anybody know if the next or the following update will have these events working?

1 Like

WASM Standalone modules are working in the current version.

I would also like those SimConnect events to work so i can finally use my GarminGPS clone again.
I don’t know what this WASM thing even is…

Is there some instructions on the web on how to do this ?
I know C+ a bit and for a test project, i would love to be able to map a joystick button to the fpl button of the pfd of the garmin 1000…i have time and would like to learn how to program such a module.
Thanks

i am close to releasing a new MobiFlight version with support for all these Events. Unfortunately it won’t work with Joysticks. Once I’m done I plan to make a short video that explains how all the pieces work together.

2 Likes

Are the C:fs9GPS: simconnect functions even documented in the current MSFS SDK ??

Answer - NO !! neither appear anywhere in the current SDK , but Asobo is using then in their planes …

Also, how about things like “PLAY_INSTRUMENT_SOUND” ???

ie Coherent.call(“PLAY_INSTRUMENT_SOUND”, soundId)

I will be very interested to see the documentation.
Thanks
I have an arduino board…i may try the mobiflight but my cockpit is already built and i used some BU0836A 12-Bit Joystick Controller boards.
Cheers

In my case, as i am sure this would apply to others, if i could learn how to write a module that could map a joystick button to, let’s say, the FPL button of the garmin 1000, i would be very happy…:grin:

haha, well this is exactly what I’m trying to do as well.