Jump to content
Sign in to follow this  
Guest Tezaa

Notification of client events

Recommended Posts

Guest Tezaa

Hi all,I am on the long and windy road of learning simconnect ... So far, I can trigger basic events (Gear,Flaps) when I press a button on a Windows Form, and (sometimes) receive notifications of when sim events happen (eg: push F8 on the keyboard - and it sends notification that the FLAPS_DOWN event occurred).However, I can't seem to get a notification when I initiate the event via a Windows Form. eg: When I press a button on my windows form to set the Flaps down, I want a notification of the event (So I can print to a text box "Flaps Down"). This doesn't seem to work. I have checked via the DeBug console - and no notification is being sent. Relevant code snippets:simconnect.MapClientEventToSimEvent(EVENTS.FLAPS_DOWN,"FLAPS_DOWN");simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.FLAP_GROUP, EVENTS.FLAPS_DOWN, false);void simconnect_OnRecvEvent(SimConnect sender, SIMCONNECT_RECV_EVENT recEvent){display.Text = ("OnRecvEvent");switch (recEvent.uEventID) { case (uint)EVENTS.FLAPS_DOWN: display.Text = ("Flaps Down"); break; }}So, what am I doing wrong? Any help would be much appreciated.Thanks,Terry (My first post - so go easy on me!)

Share this post


Link to post
Share on other sites

>However, I can't seem to get a notification when I initiate>the event via a Windows Form. eg: When I press a button on my>windows form to set the Flaps down, I want a notification of>the event (So I can print to a text box "Flaps Down"). >>This doesn't seem to work. I have checked via the DeBug>console - and no notification is being sent. It's all to do with Priorities. When you Transmit an Event via Simconnect it has a priority. It trickles down through all the clients requesting notifications, but only those BELOW that priority level. If it didn't do this, if all clients received notifications of all events they themselves sent, then it would make it impossible to trap an event and produce a variation of it for onward transmission -- you'd end up in an endless loop.In fact this is exactly what happened in the very first Beta of SimConnect, before FSX was released.Anyway, check this: SimConnect_SetNotificationGroupPriorityand this in the TransmitClientEvent details:GroupID [in] The default behavior is that this specifies the GroupID of the event. The SimConnect server will use the priority of this group to send the message to all clients with a lower priority. To receive the event notification other SimConnect clients must have subscribed to receive the event. See the explanation of SimConnect Priorities. The exception to the default behavior is set by the SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY flag, described below.Get the event transmitted at the highest priority, then everyone will see it, including you.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...