这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@qwandor-google
Copy link
Collaborator

I've tried to separate the Mijia-specific code from the general BLE stuff. I've also added a few comments.

DBUS_METHOD_CALL_TIMEOUT,
self.session.connection.clone(),
);
temp_humidity.start_notify().await?;
Copy link
Owner

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).

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();
Copy link
Owner

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)

@qwandor-google qwandor-google merged commit 7172a84 into master Sep 22, 2020
@qwandor-google qwandor-google deleted the mijia branch September 25, 2020 18:13
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.

4 participants