Open Sector95 opened 1 year ago
This is very welcome. Thank you!
Unfortunately, the little there is about ClientEvent and NotificationGroup is neither correct nor ergonomic. Please give me a few days to develop something better to base this PR on.
OK, it's done. It ended up being a pretty chunky refactor. https://github.com/mihai-dinculescu/simconnect-sdk-rs/commit/d89fa524c2bc585f806f44143a7d95d09040968f.
Probably it's best to read the whole changelog for the rebase, but here are the main takeaways:
register_event
has been replaced by subscribe_to_client_event
. transmit_client_event
will require the user to call subscribe_to_client_event
beforehand. It's not ideal, but the SimConnect API is not leaving much choice.client_event_register
that can be used to determine if the event has been subscribed to, like here.ClientEventRequest
and ClientEvent
. Having transmit_client_event
take a ClientEvent
will improve the API by making it evident to the user when they have to provide a data field and its purpose. This conversion will probably prove handy to you.Thanks, I'll take a look and rebase when I get a moment here 👍
Hey @Sector95 How's the feature coming along as I have an app idea that need to write data to sim and or trigger events in the sim
Hey @Sector95 How's the feature coming along as I have an app idea that need to write data to sim and or trigger events in the sim
Hey sorry, life's been wild, I'll try to tackle this sometime this week!
Updated the example, and merged in your code changes. Sorry for the delay!
Implemented a little cleaner of an interface for both radios and transponders, so the client doesn't have to do conversion or encoding. Updated the example on this PR for the new pattern, demonstrating both setting radios and transponders.
Also swapped i32
for u32
for the From<ClientEvent> for (ClientEventRequest, i32)
trait, as the SimConnect::transmit_client_event
function requires a u32
for the dword
value anyway.
Think I've addressed what showed up in the format workflow there. Let me know if they're is anything else left outstanding.
The BCD conversion is excellent! Thanks for adding it!
Given that this isn't merged, does simconnect-sdk-rs
currently have the ability to transmit client events and set data (e. g. frequencies) in the sim?
Given that this isn't merged, does
simconnect-sdk-rs
currently have the ability to transmit client events and set data (e. g. frequencies) in the sim?
Not without this PR.
@Sector95 are you happy to wrap up the PR? I believe that it's getting very close.
Example usage, setting the COM1 standby frequency to 127.625 and transponder to 7700: