P3D v4 Can't get MapClientEventToSimEvent to work for engine failure

#1
Hi!

Im trying to get information to my application when a failure occures. This is my code:

Enums:
Code:
        enum EVENTS
        {
            PAUSE_ON,
            PAUSE_OFF,
            TOGGLE_VACUUM_FAILURE,
            TOGGLE_ELECTRICAL_FAILURE,
            TOGGLE_PITOT_BLOCKAGE,
            TOGGLE_STATIC_PORT_BLOCKAGE,
            TOGGLE_HYDRAULIC_FAILURE,
            TOGGLE_TOTAL_BRAKE_FAILURE,
            TOGGLE_LEFT_BRAKE_FAILURE,
            TOGGLE_RIGHT_BRAKE_FAILURE,
            TOGGLE_ENGINE1_FAILURE,
            TOGGLE_ENGINE2_FAILURE,
            TOGGLE_ENGINE3_FAILURE,
            TOGGLE_ENGINE4_FAILURE,
            FLAPS_INC
        };
        enum NOTIFICATION_GROUPS
        {
            GROUP0,
            GROUP1
        };
Binding events:
Code:
            // On P3D Quit
            simconnect.OnRecvQuit += new SimConnect.RecvQuitEventHandler(simconnect_OnRecvQuit);
            // Exceptions
            simconnect.OnRecvException += new SimConnect.RecvExceptionEventHandler(simconnect_OnRecvException);

            // Simobject data request
            simconnect.OnRecvEvent += new SimConnect.RecvEventEventHandler(simconnect_OnRecvEvent);

            // Setup events
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_ENGINE1_FAILURE, "TOGGLE_ENGINE1_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_ENGINE1_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_ENGINE2_FAILURE, "TOGGLE_ENGINE2_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_ENGINE2_FAILURE, false);

            simconnect.MapClientEventToSimEvent(EVENTS.FLAPS_INC, "FLAPS_INCR");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.FLAPS_INC, false);

            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_ELECTRICAL_FAILURE, "TOGGLE_ELECTRIAL_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_ELECTRICAL_FAILURE, false);

            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_ENGINE3_FAILURE, "TOGGLE_ENGINE3_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_ENGINE3_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_ENGINE4_FAILURE, "TOGGLE_ENGINE4_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_ENGINE4_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_HYDRAULIC_FAILURE, "TOGGLE_HYDRAULIC_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_HYDRAULIC_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_LEFT_BRAKE_FAILURE, "TOGGLE_LEFT_BRAKE_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_LEFT_BRAKE_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_PITOT_BLOCKAGE, "TOGGLE_PITOT_BLOCKAGE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_PITOT_BLOCKAGE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_RIGHT_BRAKE_FAILURE, "TOGGLE_RIGHT_BRAKE_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_RIGHT_BRAKE_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_STATIC_PORT_BLOCKAGE, "TOGGLE_STATIC_PORT_BLOCKAGE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_STATIC_PORT_BLOCKAGE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_TOTAL_BRAKE_FAILURE, "TOGGLE_TOTAL_BRAKE_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_TOTAL_BRAKE_FAILURE, false);
            simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_VACUUM_FAILURE, "TOGGLE_VACUUM_FAILURE");
            simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP1, EVENTS.TOGGLE_VACUUM_FAILURE, false);

            simconnect.SetNotificationGroupPriority(NOTIFICATION_GROUPS.GROUP1, SimConnect.SIMCONNECT_GROUP_PRIORITY_HIGHEST);
simconnect_OnRecvEvent dosn't get called when I trigger a engine failure in p3d. However it does get called when FLAPS_INCR happens.
According to the SDK it should be TOGGLE_ENGINE1_FAILURE to subscribe to engine failures?

Thanks in advance for any help!
 
Last edited:
#3
Ok, when I manually induce an engine failure with this:
Code:
simconnect.TransmitClientEvent(0, EVENTS.TOGGLE_ENGINE1_FAILURE, 0, NOTIFICATION_GROUPS.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
Then it works. simconnect_OnRecvEvent get called when the engine fails. But when I go to failures in P3D and choose complete failure engine 1 the method dosn't get called. I am lost right now
 

JB3DG

Resource contributor
#4
The menu isn't necessarily going to trigger the event. It can set the failure state directly. The event is more for gauges/addons to trigger the failure.
 
Top