Sign in to follow this  
Guest gita1111

New "Freezing position" Event IDs

Recommended Posts

Has anyone played with the new Event IDs for freezing position that is new to the SDK as part of the service pack upgrade (SP1A)?First there are toggle events, and then set events for all 6 DOF variables (lat, lon, alt, pitch, roll, yaw). Not sure if you have to use both or not?But here's what I'm trying as a simple test to freeze lat and lon, but to no avail:/* setup */hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE, "FREEZE_LATITUDE_LONGITUDE_TOGGLE");hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_KEYS, EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE);/* action in callback */hr = SimConnect_TransmitClientEvent(hSimConnect, SIMCONNECT_OBJECT_ID_USER, EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE, TRUE, SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);I'm also checking the sim variable "IS LATITUDE LONGITUDE FREEZE ON" to see if the "FREEZE_LATITUDE_LONGITUDE_TOGGLE" Event ID is getting set to True, and it's not.Is there anything fundamental I'm doing wrong with using these Event IDs? Like is setting a "True" in the transmitClientEvent not correct?Here is the info in the SDK docs:KEY_FREEZE_LATITUDE_LONGITUDE_TOGGLE FREEZE_LATITUDE_LONGITUDE_TOGGLE Turns the freezing of the lat/lon position of the aircraft (either user or AI controlled) on or off. If this key event is set, it means that the latitude and longitude of the aircraft are not being controlled by Flight Simulator, so enabling, for example, a SimConnect client to control the position of the aircraft. This can also apply to altitude and attitude. Refer to the simulation variables: IS LATITUDE LONGITUDE FREEZE ON,IS ALTITUDE FREEZE ON, and IS ATTITUDE FREEZE ON Refer also to the SimConnect_AIReleaseControl function. Shared Cockpit KEY_FREEZE_LATITUDE_LONGITUDE_SET FREEZE_LATITUDE_LONGITUDE_SET Freezes the lat/lon position of the aircraft. Shared Cockpit KEY_FREEZE_ALTITUDE_TOGGLE FREEZE_ALTITUDE_TOGGLE Turns the freezing of the altitude of the aircraft on or off. Shared Cockpit KEY_FREEZE_ALTITUDE_SET FREEZE_ALTITUDE_SET Freezes the altitude of the aircraft.. Shared Cockpit KEY_FREEZE_ATTITUDE_TOGGLE FREEZE_ATTITUDE_TOGGLE Turns the freezing of the attitude (pitch, bank and heading) of the aircraft on or off. Shared Cockpit KEY_FREEZE_ATTITUDE_SET FREEZE_ATTITUDE_SET Freezes the attitude (pitch, bank and heading) of the aircraft. Shared Cockpit

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

>Has anyone played with the new Event IDs for freezing>position that is new to the SDK as part of the service pack>upgrade (SP1A)?Not new in SP1 -- as my list of FSX controls shows (made before FSX's original release):FREEZE_ALTITUDE_SET 66834 FREEZE_ALTITUDE_TOGGLE 66833 FREEZE_LATITUDE_LONGITUE_SET 66832 FREEZE_LATITUDE_LONGITUE_TOGGLE 66831I think they've "fixed" the spelling error (LONGITUE) by adding two extra controls spelled correctly (they can't really remove the old mis-spelled ones or programs using them like FSUIPC4, would fail).The ATTITUDE freeze is new to SP1 though, for sure.>But here's what I'm trying as a simple test to freeze lat and>lon, but to no avail:>>/* setup */>hr = SimConnect_MapClientEventToSimEvent(hSimConnect,>EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE,>"FREEZE_LATITUDE_LONGITUDE_TOGGLE");>>hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect,>GROUP_KEYS, EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE);>>/* action in callback */>hr = SimConnect_TransmitClientEvent(hSimConnect,>SIMCONNECT_OBJECT_ID_USER,>EVENT_FREEZE_LATITUDE_LONGITUDE_TOGGLE, TRUE,>SIMCONNECT_GROUP_PRIORITY_DEFAULT,>SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);You don't need to "AddClientEventToNotificationGroup" unless you want to also intercept these events, which seems unlikely. Simply matching your ID to the named event allows you to Transmit it when you like.The dwData value isn't used for a TOGGLE action, only a SET, but it doesn't matter that you have "TRUE" there.Try a higher priority than SIMCONNECT_GROUP_PRIORITY_DEFAULT. Some events don't reach the right parts of FSX if their priority is too low. Unless you have good reason to set the priority low it is safest to always use SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE.The comment "action in callback" leads me to believe you are only transmitting this when something else happens in SimConnect. You aren't waiting for a FREEZE event to arrive before transmitting one are you? They don't occur unless someone sends one. If they do, and you have that loop set up, it will continue forever! Oops!FSX Control assignments allows you to assign the Altitude and Latitude/Longitude freezes, but not the Attitude one, it seems. If you have a registered FSUIPC4 you can experiment with assigning the Freeze controls to buttons or keypresses. They are all there, including the mis-spellings and the new spellings.>I'm also checking the sim variable "IS LATITUDE LONGITUDE>FREEZE ON" to see if the "FREEZE_LATITUDE_LONGITUDE_TOGGLE">Event ID is getting set to True, and it's not.Check it after using the controls directly assigned.>Is there anything fundamental I'm doing wrong with using these>Event IDs? Like is setting a "True" in the>transmitClientEvent not correct?That is okay, but it is irrelevant for a Toggle. You'd use TRUE or FALSE for the SET events. For some events it is a real numerical value. This is the "parameter" in the FSUIPC keypress or button assignment facilities.RegardsPete

Share this post


Link to post
Share on other sites

Thanks for the reply. I see what you're saying now. But do you need to do a Toggle, before a Set?; or do these not work in tandem? Like is there a scenario where you would use a Toggle and not a Set, and vice versus? Basically I'm looking to freeze the 6 DOF (lat, lon, alt, pitch, roll, yaw) ownship (player) position so that I can feed the ownship my own 6 DOF data. I've been able to do this to date by just disabling the simulation, but this turns off the spinning engine animations, aircraft lighting, etc. So I'd much rather use this new technique of freezing position.

Share this post


Link to post
Share on other sites

>... do>you need to do a Toggle, before a Set?; or do these not work>in tandem?They are just different ways of doing things. If you were operating a momentary push button you'd use a Toggle command -- each time you press the button it will switch on if off, or switch off if on. i.e "toggle".The SET command for a binary choice like this (i.e. it's on (TRUE) or off (FALSE), no other choices) is effectively an ON command and an OFF command in one. You'd use it with a toggle switch. When the switch goes off you send the SET with FALSE, when it goes on you send the SET with TRUE.Think of a light switch (SET) compared with a bell push (TOGGLE). Horses for courses.RegardsPete

Share this post


Link to post
Share on other sites

Thanks Pete. Setting the priority to "SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE" did the trick. To answer your question in your first reply about when I was transmitting the event in my client, I'm only doing it when I get a SIM_START event.Thanks for your explanation of the SET vs. TOGGLE freeze functions. I guess intuitively I just found it odd that MS would have two different ways to do the same thing when it came to the freeze, hence why I questioned if they had to be used in tandem in order for the freeze to work. But I guess I shouldn't be surprised by that!But I opted to use the SET variants of the FREEZE functions, and still cannot get the variable "IS LATITUDE LONGITUDE FREEZE ON" to return TRUE. Is it possible that this variable only works with the TOGGLE functions, and not SET? That was going to be my next experiment.Thanks again!

Share this post


Link to post
Share on other sites

>But I opted to use the SET variants of the FREEZE functions,>and still cannot get the variable "IS LATITUDE LONGITUDE>FREEZE ON" to return TRUE. Is it possible that this variable>only works with the TOGGLE functions, and not SET?No. It is the state it is returning so it should make no difference. Have you checked the SimConnect log to see if there's an error? I've not used that variable at all so I don't know whether it works or not.Pete

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