• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

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

Messages
22
Country
sweden
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:
Actually, no of the events works except FLAPS_INCR. FLAPS_INCR is the only one that is working
 
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
 
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.
 
Back
Top