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

Interfacing external switch

Dear Pete:

I mean the key events are input keybord events like:

"CTRL+A", "SHIFT+1" or "."

For me this is a key event:

hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT0, "shift+ctrl+u", EVENT_BRAKES);

Am i wrong with the meaning of "Key events" or shoud i name it
input key events?

Thanks.
Alfredo Mendiola Loyola
Lima, Perú
 
I'm not using Key events i just call to:
...
"THROTTLE1_SET"

I think you misunderstand. The term "Key Event" refers to all the FS controls which are defined for Gauges, and for mapping in SimConnect. Your "THROTTLE1_SET" IS a "Key Event", it is defined as KEY_THROTTLE1_SET is the Gauges header file and it has a Key Event number. It is listed in my FS Controls documentation and it is assignable in FSUIPC's dropdowns.

This use of the term "Key Event" has been in use in FS now for many years, though I've always avoided it ands used the term "Control" (after all they are all tabulated in the FS CONTROLS.DLL.

I don't need to map key events like for example "Ctrl+A"

Ah, now I see your confusion! "Ctrl+A" is NOT a "Key Event" but an "Input Event". Inputs are how you get input from buttons, keys, whatever. They are nothing to do with FS's controls and Key Events.

Using Inputs to RECEIVE information, and using key Events to CONTROL FS are two different things, they are not alternatives, and both have their place in any program which wants to use them. They are not "alternatives" so it is meaningless to say one is faster than the other. they do completely different things.

Regards

Pete
 
Dear Acolvard:
**************

You can get rid of the slow and CPU eater "INPUT EVENTS" to throw events.

I just call SimConnect_TransmitClientEvent() to set for example a throttle position.

You've got to set up the event with the following code:

hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_THROTTLE1_SET, "THROTTLE1_SET");

Then i assign a value to to variable acelerador1 and transmit the event.

You must validate that hSimConnect not be null.

HRESULT hr;
if(hSimConnect != NULL){
hr = SimConnect_TransmitClientEvent(hSimConnect, SIMCONNECT_OBJECT_ID_USER, EVENT_THROTTLE1_SET, acelerador1, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
}

The performace without using INPUT EVENTS events is better and the CPU usage is lower.

I was simulating input events (keyboard events) with c++ code, but this method was slow than call directly the KEY_EVENTS USING SimConnect_TransmitClientEvent.

This performace reduction using "input events" occurs when you need for example to set values to THROTTLE1_SET where you rececive a lot of data in a short period of time.

Thanks.
Alfredo Mendiola Loyola
Lima, Perú
 
I do not use input events. I have been using SimConnect_TransmitClientEvent(). The origanl problem was re-mapping, which is solved by (SUCCEEDED(SimConnect_Open(&hSimConnect, "Input Event", NULL, 0, 0, 0)))
 
Dear Acolvard:

When i call SimConnect_TransmitClientEvent(...) that events is sent to all simconnect clients, but is there a way to just send the event to FSX and that the other simconnect clients doesn't recieve my sent Events?

Thanks.
Alfredo Mendiola Loyola
Lima, Perú
 
The SimConnect_TransmitClientEvent function is used to request that the Flight Simulator server transmit to all SimConnect clients the specified client event.

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
 
I had a similar problem until I got the concept of priorities. For example, I wanted to intercept an event, and then depending on other logic, forward it to the sim or not, and modify the event parameter if necessary.

So, for an example, to map an event to be masked by the client:

hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_PROP_PITCH_SET,"PROP_PITCH_SET");
hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, INPUT_GROUP, EVENT_PROP_PITCH_SET,true);

Then in the event trap, get the parameter:

case EVENT_PROP_PITCH_SET :
dwData = (long)evt->dwData;

I can then send it to the sim if I want by calling:

hr = SimConnect_TransmitClientEvent(hSimConnect,0,EVENT_PROP_PITCH_SET,dwData ,SIMCONNECT_GROUP_PRIORITY_STANDARD,SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);

Of course, if I can modify dwData before doing so.

Or, if I want to retransmit it so it gets detected and masked by my client again. (I have code that does this where one event may trigger several others that I also need to mask and rewrite processing for) I just call the same function with a higher group priority, i.e.:

hr = SimConnect_TransmitClientEvent(hSimConnect,0,simEvent,val,SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE,SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);

Si
 
Back
Top