c-true / FsConnect

Wrapper for Flight Simulator 2020 SimConnect library
59 stars 20 forks source link

Client event support #11

Closed sushiat closed 3 years ago

sushiat commented 3 years ago

Hi, I'm finally far enough into my development that it was time to look at setting the time in the sim and enabling/disabling slew mode. Both those things can only by achieved by sending simconnect events not by setting sim vars.

So I checked out your feature/settime branch and copied the fsconnect changes into my project overriding the one from the published nuget package. I'm happy to say it worked flawlessly for both purposes. I did not test out the world manager class as I want to keep the dependency down to just the main package but my code is nearly identical so that should work.

Not sure when you were planning to release that branch into the main package but looking forward to removing a whole bunch of warnings regarding conflicting class definitions 😄 and to provide some additional testing feedback.

homeavionicgroup commented 3 years ago

Hi, glad to hear. Regarding "Events" are you referring to "https://docs.flightsimulator.com/html/Programming_Tools/SimVars/Legacy_Event_IDs.htm"?

I am looking to set the COM Frequency and Transponder Code. It seems not possible through the Variables, but through the Events. On the otherside the documentation states that they are legacy and only there for legacy support.

sushiat commented 3 years ago

I don't fully understand what they mean by that sentence up there but it also says "... for reference" and there is no such text in the sim events document that is part of the local help that get's installed with the sdk.

And at least as far as I know there is no other way of doing this via SimConnect, so if these event IDs work I would go with it.

KEY_XPNDR_SET | XPNDR_SET | Sets transponder code (BCD)

KEY_COM_RADIO_SET | COM_RADIO_SET | Sets COM frequency (BCD Hz) or KEY_COM_STBY_RADIO_SET | COM_STBY_RADIO_SET | Sets COM 1 standby frequency (BCD Hz)

If they ever wanted to replace these with a new method I'm pretty sure they would deprecate these first and giving developers some time to adjust their code - one would hope so anyway 😄

TimianHeber commented 3 years ago

Hi @markuskorbel , I've been away but have some time this weekend to work on FsConnect. I'll push a new version with more support for events and specifically the set time feature. Is it so that you would prefer to only be dependent on a single NuGet package? My thought was that FsConnect package would in time be a replacement for the SimConnect usage, and the FsConnect.Managers would provide convenient extensions to it and demonstrate how to do common tasks. But I could for easier use combine these into a single NuGet package, while still keeping the distinction between FsConnect / FsConnect.Manager.

sushiat commented 3 years ago

No sorry, you misunderstood me. By all means keep them separate packages - makes sense.

I simply implemented that bit of code to set the time again in my own code so I wouldn't need the worldmanager and keep it down to just the one packet.

homeavionicgroup commented 3 years ago

Sweet, thanks

sushiat commented 3 years ago

Yes, thank you very much indeed

TimianHeber commented 3 years ago

You're welcome. Let me know if you need anything tweaked. I have not started using events myself yet, so there may be API adjustments that would make it easier to use. I will probably make enumerations for known events, which would be optional to use.