Fix filter not letting beacons through after the first one
This commit is contained in:
parent
649af90de8
commit
556599609a
@ -1,6 +1,6 @@
|
||||
use std::{collections::HashMap, convert::Infallible, sync::Arc, time::{SystemTime, UNIX_EPOCH}};
|
||||
|
||||
use bluer::{self, Adapter, AdapterEvent, Address};
|
||||
use bluer::{self, Adapter, AdapterEvent, Address, DiscoveryFilter, DiscoveryTransport};
|
||||
|
||||
use anyhow::Result;
|
||||
use futures::{Stream, StreamExt};
|
||||
@ -108,6 +108,13 @@ async fn extract(adapter: Arc<Adapter>, evt: AdapterEvent) -> Option<Data> {
|
||||
}
|
||||
|
||||
async fn sensor_reports<'a>(adapter: Arc<Adapter>) -> Result<impl Stream<Item=Data> + 'a> {
|
||||
let filter = DiscoveryFilter {
|
||||
transport: DiscoveryTransport::Le,
|
||||
duplicate_data: true,
|
||||
..Default::default() };
|
||||
|
||||
adapter.set_discovery_filter(filter).await?;
|
||||
|
||||
Ok(adapter.discover_devices_with_changes().await?
|
||||
.filter_map(move |evt| { extract(Arc::clone(&adapter), evt) }))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user