• 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.

SIMCONNECT_RCEV_EVENT mild puzzler

DragonflightDesign

Resource contributor
Messages
1,368
Country
northernireland
Code follows:

Code:
enum CLIENT_EVENT_ID
{
   CLIENT_EVENT_1SEC=65,
   CLIENT_EVENT_4SEC=64,
   CLIENT_EVENT_6HZ=67,
   CLIENT_EVENT_FRAME
};

void OnRecvEvent(SIMCONNECT_RECV_EVENT *pEvent, DWORD cbData)
{
   switch (pEvent->uEventID)
   {
       case CLIENT_EVENT_6HZ:
       {
           // -----------------------------------------------------
           // Fuel state
           hr = SimConnect_RequestDataOnSimObjectType(hSimConnect, REQUEST_FUEL_STATE_DATA, DEFINE_FUEL_STATE, 0, SIMCONNECT_SIMOBJECT_TYPE_USER);
       }
       break;

       case CLIENT_EVENT_1SEC:
       {
           hr = SimConnect_RequestDataOnSimObjectType(hSimConnect, REQUEST_AIRCRAFT_STATE_DATA, DEFINE_AIRCRAFT_STATE, 0, SIMCONNECT_SIMOBJECT_TYPE_USER);

           hr = SimConnect_RequestSystemState(hSimConnect, FLIGHT_LOADED, "FlightLoaded");
           hr = SimConnect_RequestSystemState(hSimConnect, AIRCRAFT_LOADED, "AircraftLoaded");
           hr = SimConnect_RequestSystemState(hSimConnect, FLIGHT_PLAN, "FlightPlan");
       }
       break;
   }
}

CLIENT_EVENT_6HZ is only ever hit once, just after connect. CLIENT_EVENT_1SEC is hit every second as expected. What did I miss? Changing the enumeration number makes no difference.
 
Enumeration number doesn't matter. It must just be unique from other client events. Did you call SimConnect_SubscribeToSystemEvent(hSimConnect, CLIENT_EVENT_6HZ, "6Hz"); anywhere?
 
Huh. Put that one down to Murphy. I made some code changes in a related area (not SimConnect itself) and it started running through the 6HZ call again.
 
Back
Top