Handling an event from another plugin

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
ProfessorWC
Posts: 2
Joined: Tue Nov 19, 2019 11:30 pm

Handling an event from another plugin

Post by ProfessorWC »

My team is building two independent plugins, and we are trying to close the loop on some functionality between them. We have a C# application that is transmitting a custom client event, and a C++ plugin that we want to subscribe to the event and then take some actions within the simulator. We aren't getting any errors when the plugin loads, and no exceptions when we create the events in C#. When we transmit the event from C#, nothing happens. I can see the event transmitting in the Prepar3d console, but no event is triggering in the plugin.

Any advice on configuration or setup of the events would be appreciated.
ProfessorWC
Posts: 2
Joined: Tue Nov 19, 2019 11:30 pm

Re: Handling an event from another plugin

Post by ProfessorWC »

Updating with some sample code.

In the C# plugin I am creating some events that I would like the C++ to handle:

Code: Select all

simconnect.MapClientEventToSimEvent(EVENTS.ONE, "event.one");
simconnect.AddClientEventToNotificationGroup(NOTIFICATON_GROUPS.GROUP0, EVENTS.ONE, false);
In C++ I have tried to set it up as was recommended in a forum post that I found (admittedly it was from a few years ago). The event names are consistent between the plugins.

Code: Select all

hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENTS.ONE, "event.one");
Any advice on how to set this up correctly would be appreciated, but as it stands I am getting an exception 7 when trying to subscribe to the event in C++. I have tried using a Prepar3d event just to see if I could force an event to happen in C# and handle it in C++, but I could not get that to work either.
Post Reply