Monitoring advertisements from a specific device that is off most of the time #148
Unanswered
LeCyberDucky
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Your code seems reasonable to me. I have not used LE passive monitoring with filters myself. The filtering is performed by the Bluetooth controller, so this is a low-level feature. Maybe @kjetijor can help. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey! I have scale that will submit measurements over bluetooth. I'm trying to log that on a Raspberry Pi using this crate.
I have made a basic program that discovers nearby devices, and here is some example output for the scale:
Ok([Name("MIBFS"), AddressType(LePublic), Uuids({0000181b-0000-1000-8000-00805f9b34fb}), Paired(false), Connected(false), Trusted(false), Blocked(false), Alias("MIBFS"), LegacyPairing(false), Rssi(-65), ManufacturerData({343: [216, 231, 47, 166, 17, 33]}), ServiceData({0000181b-0000-1000-8000-00805f9b34fb: [2, 164, 178, 7, 1, 8, 6, 93, 48, 255, 253, 63, 57]}), ServicesResolved(false)])
Now, I just want to log the
ServiceData({0000181b-0000-1000-8000-00805f9b34fb: [2, 164, 178, 7, 1, 8, 6, 93, 48, 255, 253, 63, 57]})
part, whenever the scale submits a new measurement.I've found a tiny Python example here: https://github.com/led788/bodyscale2/blob/main/main.py
From the bluer examples, I think this one is relevant: https://github.com/bluez/bluer/blob/master/bluer/examples/le_passive_scan.rs
Specifically:
Since I know the adress of exactly the device I'm looking for, I'm wondering whether this example is the way to go, though. It seems to continuously look for all nearby devices, which seems redundant to me. I don't think I can skip directly to the
let mut events = dev.events().await.unwrap();
part either, though, since that would fail when the scale turns off after a measurement. Is there a better way to approach this?Also, I'm wondering how to use the the
Pattern
s for filtering. I've taken a look here and here, but I can't quite figure out how to use that for my use case.Beta Was this translation helpful? Give feedback.
All reactions