-
Notifications
You must be signed in to change notification settings - Fork 14
Mijia refactoring #8
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
Conversation
| DBUS_METHOD_CALL_TIMEOUT, | ||
| self.session.connection.clone(), | ||
| ); | ||
| temp_humidity.start_notify().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your bluetooth.rs split is such a good idea that I'm suddenly trying to think of ways to move things like this into bluetooth.rs (definitely not in this PR).
ef8b569 to
777a8fa
Compare
777a8fa to
5fec7ad
Compare
mijia/src/bluetooth.rs
Outdated
| let k = k.as_str()?.into(); | ||
| let v = v.box_clone(); | ||
| let v = cast::<Vec<u8>>(&v)?.clone(); | ||
| let v = cast::<Variant<Vec<u8>>>(&v)?.0.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-approved for when you push the change to use into_iter() etc. I really think that the best time to fix it properly is as part of #9 so I'm happy to leave it as-is for now.
If you want to write a test that's realistic, you will probably need to add an extra layer of nesting, so you can't Any your way out of trouble without boxed_clone, (we're currently a hashmap of {sv}, where the v is a Variant of &[u8] or something, so we're already borrowing from the outer hashmap)
I've tried to separate the Mijia-specific code from the general BLE stuff. I've also added a few comments.