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

Event IDs-Which Ones Work???

Discussion in 'SimConnect' started by jonesie, 3/10/07.

  1. jonesie

    jonesie

    Joined:
    3/10/07
    Messages:
    4
    Country:
    unitedstates
    I am using SimConnect in my application to read data from FSX; pitch, bank, etc. This all works fine. Now I want to use the Event IDs to trigger FSX. I am having success with some IDs but others do nothing?? Is anyone aware of this unreliability. Specifically I am trying to trigger the Garmin G1000 PFD while flying the Cessna C172SP Skyhawk G1000. I can get G1000_PFD_ZOOMIN_BUTTON and G1000_PFD_ZOOMOUT_BUTTON to work but nothing else in that G1000 Keys group? I am able to get several other Event IDs to work (COM_STBY_RADIO_SWAP,COM_RADIO_WHOLE_DEC, COM_RADIO_WHOLE_INC, COM_RADIO_FRACT_DEC, COM_RADIO_FRACT_INC,HEADING_BUG_DEC,HEADING_BUG_INC, ....) but some I really need don't (TOGGLE_DME, FREQUENCY_SWAP). When I click on the G1000 in the game (even while Paused) the FPL button displays the Flight Plan page so why doesn't G1000_PFD_FLIGHTPLAN_BUTTON event do the same thing? Am I wasting my time trying to get this to work? My code is fine, I assume, since many of the events do work as expected. Any insight would be greatly appreciated. Thanks.
  2. Alex Barrett

    Alex Barrett

    Joined:
    19/4/07
    Messages:
    48
    Country:
    unitedkingdom
    Hi Jonsie!

    How are you trying to trigger these events? is it keypresses or based on other events, or a button in the form window?

    I haven't had many problems with events myself, but haven't tried those quoted.

    Are you willing to post your code so I can try it on my machine? not suggesting that you are doing anything wrong, its just I'm sure you know, sometimes things work on one machine but not another and vice versa!

    Thanks,

    Alex
  3. jonesie

    jonesie

    Joined:
    3/10/07
    Messages:
    4
    Country:
    unitedstates
    Hi Alex,

    I am triggering the events from a button in the form window. Below is a very simplified version of my code. On the form Button6 calls my function with an integer which is actually the EventId in this case. In PISimConn_SendEvent I call SimConnect_MapClientEventToSimEvent using several EventIds then I transmit. I use eventData=0 all the time. So in this sample code the first 4 EventIds work (zoom and heading bug) but the procedure and flightplan don't. I am wondering if I need to use something other than SIMCONNECT_OBJECT_ID_USER or if the priority flags are correct.

    Thanks a ton for the help! I really appreciate it.

    Jonesie

    void __fastcall TForm1::Button6Click(TObject *Sender)
    {
    int eventdata=4;
    int res=PISimConn_SendEvent("temporarily not used", eventdata);
    }

    extern int PISimConn_SendEvent(const char *eventName, int eventData)
    {

    string name(eventName);
    long eventId;


    eventId=eventData;
    eventData=0;
    //map the eventIDs I want

    SimConnect_MapClientEventToSimEvent(hSimConnect, 1, "g1000_pfd_zoomin_button");
    SimConnect_MapClientEventToSimEvent(hSimConnect, 2, "g1000_pfd_zoomout_button");
    SimConnect_MapClientEventToSimEvent(hSimConnect, 3, "heading_bug_dec");
    SimConnect_MapClientEventToSimEvent(hSimConnect, 4, "heading_bug_inc");
    SimConnect_MapClientEventToSimEvent(hSimConnect, 5, "g1000_pfd_procedure_button"); //doesn't work
    SimConnect_MapClientEventToSimEvent(hSimConnect, 6, "g1000_pfd_flightplan_button"); //doesn't work



    if (S_OK == SimConnect_TransmitClientEvent(hSimConnect, SIMCONNECT_OBJECT_ID_USER, eventId, eventData,
    SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY))
    {
    return TRUE;
    }
    return FALSE;
    }

Share This Page