1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Aircraft Failures - event processing not working?

Discussion in 'SimConnect' started by jhl_iv, 28/1/08.

  1. jhl_iv

    jhl_iv

    Joined:
    11/9/07
    Messages:
    10
    Country:
    us-texas
    I have tried without success (using both unmanaged C++ and managed c#)to receive "Aircraft Failures" events.
    I have searched the documentation, only seeing in the notes section :"Not all events apply to all aircraft and all situations". I have tried several different aircraft also (and some different situations).

    Anyway, for a specific example:
    1. I subscribe to TOGGLE_ELECTRICAL_FAILURE in my code.
    2. Start the program, see this event register in the SimConnect debug window.
    3. Then I click on the failure checkbox for Electrical in the Systems tab of the failures dialog (under the &Aircraft menu) in FSX, I see the electric go out on the aircraft panel but never receive an event for this in my code, nor do I see it in the SimConnect debug panel?
    4. Then when I go back into the failure dialog, I uncheck this failure setting and click OK and the electricity does come back to the aircraft, but again no event fires in my code nor the debug window.

    Is this the expected behavior and I just missed it in the documentation?
    Additionally, I have tried all single engine specific failure events (I didn't try Engine2, 3 or 4).

    Thanks,

    John
  2. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    I don't think any of the Menu system settings actually SEND the events in the first place for you to intercept. This is an event which can be sent by a program to set or clear electrical failures. The menus can do this directly, they are "built in".

    Think of events as controls or switches. I've always called them controls, in fact -- they are tabulated in the CONTROLS.DLL after all. In the gauges SDK they are called "KEY EVENTS".

    Gauges and externals programs and DLLs can use controls. many controls can be assigned to buttons and switches. But FS internally does not have to use controls to do anything.

    Perhaps what you are seeking is an additional "system event" for telling you when things are changed like this? That might be the proper way, though it is unnecessary because you can get what you want by subscribing to the Sim Var "PARTIAL PANEL ELECTRICAL" instead.

    Regards

    Pete
  3. jhl_iv

    jhl_iv

    Joined:
    11/9/07
    Messages:
    10
    Country:
    us-texas
    Thanks Pete,
    Well that explains why it was not working! :)

    I was assuming that this correlated through to the SDK client and the menu was a fast way to test, but I'll just try sending it from another client to test with.
    I am new to SimConnect so I appreciate your input.

    John
  4. ronh

    ronh

    Joined:
    2/11/06
    Messages:
    300
    Country:
    canada
    John,

    Peter is correct - the menu does not send this event - I got it to work by transmitting a client event. I assume you are testing with client event.cpp.

    then add:

    hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_ELEC_FAIL, "TOGGLE_ELECTRICAL_FAILURE");

    hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP0, EVENT_ELEC_FAIL);

    hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_HIGHEST);

    // add this line below
    SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_ELEC_FAIL, 0, GROUP0, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
  5. jhl_iv

    jhl_iv

    Joined:
    11/9/07
    Messages:
    10
    Country:
    us-texas
    Thanks Ron!
    I got it working last night. Which is great because I just wanted to be sure our instructor station will be able to make this event fire.

    Thanks for your help.

    John

Share This Page