Monitoring advertisements from a specific device that is off most of the time #148
Unanswered
LeCyberDucky
asked this question in
Q&A
Replies: 2 comments · 3 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. |
3 replies
|
Generally, I am not sure if using the advertisement monitor is the right approach. It is pretty low-level and the API is marked as experimental. Wouldn't it be easier to use |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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
Patterns 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.All reactions