SimEvents in external simulation

Posts: 9
Joined: Mon Jan 27, 2020 10:18 pm

SimEvents in external simulation

Postby Tadghostal » Tue Sep 01, 2020 8:25 pm

So a little background on what I am doing before I ask my question.

I am basically using an aircraft to drive the simulation of P3D. We have the GUS provide flight state variables to prepar3d, using the linuxsimulation example from the SDK as the starting point for this project. Prepar3d then simulates panels and a HUD populated with those values, so you can fly our aircraft but you get the simulated panels and HUD from a different aircraft. This all works very well with our system.

So now as part of the MFD simulation, we are developing a panel page that gets frames from an external video source and renders them on MFD page. I also want to be able to capture mouse events over top of the texture and send them via UDP packets to the external video source (think remote desktop or VNC through the MFD). So in the mouse area in the XML gauges I have mouse events that trigger simevents that are not used for the aircraft under simulation. Example:

<MouseClick id="MouseLftDwClick">
<!-- I am using events not used by the aircraft to convey mouse actions through simconnect -->
(M:Event) 'LeftSingle' scmp 0 == if{ (M:x) (&gt;K:MIXTURE3_SET, number) (M:y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:ROTOR_BRAKE) }
(M:Event) 'Move' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:ROTOR_GOV_SWITCH_TOGGLE) }
(M:Event) 'LeftRelease' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:ROTOR_CLUTCH_SWITCH_TOGGLE) }
(M:Event) 'RightSingle' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:PROP_PITCH2_LO) }
(M:Event) 'RightRelease' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:PROP_PITCH2_INCR) }
(M:Event) 'Wheel_Up' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:PROP_PITCH2_DECR) }
(M:Event) 'Wheel_Down' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:PROP_PITCH2_HI) }
(M:Event) 'Leave' scmp 0 == if{ (M:X) (&gt;K:MIXTURE3_SET, number) (M:Y) (&gt;K:MIXTURE4_SET, number) 1 (&gt;K:PROP_PITCH3_LO) }

I then use a separate simconnect program to subscribe to these events and pass the values along via UDP when the events get triggered. This works great when I use any of the included aircraft, but when I select my externally driven simobject I get exception 7 in the simconnect debug window when I call SimConnect_MapClientEventToSimEvent. It looks like this means the event isn't available to be subscribed to.

So my question is: Is there a way to add these simevents to my externally driven simobject?

I have done some a bunch of searching for answer today, but haven't really come up with anything. I still fairly new to Prepar3d development so any help or suggestions anyone has will be greatly appreciated.

Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 14 guests