MCPcopy Create free account
hub / github.com/deviceplug/btleplug / find_light

Function find_light

examples/lights.rs:15–29  ·  view source on GitHub ↗
(central: &Adapter)

Source from the content-addressed store, hash-verified

13use tokio::time;
14
15async fn find_light(central: &Adapter) -> Option<Peripheral> {
16 for p in central.peripherals().await.unwrap() {
17 if p.properties()
18 .await
19 .unwrap()
20 .unwrap()
21 .local_name
22 .iter()
23 .any(|name| name.contains("LEDBlue"))
24 {
25 return Some(p);
26 }
27 }
28 None
29}
30
31#[tokio::main]
32async fn main() -> anyhow::Result<()> {

Callers 1

mainFunction · 0.85

Calls 3

iterMethod · 0.80
peripheralsMethod · 0.45
propertiesMethod · 0.45

Tested by

no test coverage detected