Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update libs #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pum-purum-pum-pum
Copy link

@pum-purum-pum-pum pum-purum-pum-pum commented Jan 16, 2023

This PR updates the crates and fixing clippy warnings.
The part with the

pub use gen::manager::ManagerServicesChanged;
pub use gen::service::ServicePropertyChanged;
pub use gen::technology::TechnologyPropertyChanged;

is mainly a way to implement property updates on my side. But I'm not sure what API would be nice to expose it. Maybe it's ok if we expose the generated types? Maybe as gen module?

@jmagnuson
Copy link
Owner

Sorry, I totally missed this.

I tried experimenting with signals in feature/signals a while (wow, 4 years) ago, but it felt pretty unwieldy and I got busy with other things. Do you have an example of how to use something like ServicePropertyChanged?

As an aside, I have started writing supplicant-rs using zbus rather than dbus-rs, just to see how it compares. Similar features may exist in dbus-rs by now, but the code generation in zbus makes working with signals pretty easy. For example, interface_state_stream.rs essentially gives asynchronous state updates for the wlan0 interface.

@pum-purum-pum-pum
Copy link
Author

Yeah thanks!
I'll have a look at your branch at some point (shifted focus from WiFi right now)
Sure! I don't have any design for signals, the way I used it is like that I just manually add a match to connection:

        let service_property_mr = ServicePropertyChanged::match_rule(None, None);
        let _properties_changed_signal = runtime.block_on(async {
            Ok(connection
                .add_match(service_property_mr)
                .await
                .map_err(WifiManagerStartError::FailedToAddMatchToConnection)?
                .cb(move |message, property_change: ServicePropertyChanged| {
....

Basically this monitors whenever we receive the signal and calls this callback (In "..." in my particular case I send it through the channel to some other place which needs to handle this signal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants