()
| 90 | } |
| 91 | |
| 92 | pub async fn test_advertisement_manufacturer_data() { |
| 93 | use btleplug::api::{Central, CentralEvent, ScanFilter}; |
| 94 | use futures::StreamExt; |
| 95 | use std::time::Duration; |
| 96 | use tokio::time; |
| 97 | |
| 98 | let adapter = peripheral_finder::get_adapter().await; |
| 99 | let mut events = adapter.events().await.unwrap(); |
| 100 | adapter.start_scan(ScanFilter::default()).await.unwrap(); |
| 101 | |
| 102 | let mut found_manufacturer_data = false; |
| 103 | let timeout = time::sleep(Duration::from_secs(10)); |
| 104 | tokio::pin!(timeout); |
| 105 | |
| 106 | loop { |
| 107 | tokio::select! { |
| 108 | Some(event) = events.next() => { |
| 109 | if let CentralEvent::ManufacturerDataAdvertisement { manufacturer_data, .. } = event { |
| 110 | if manufacturer_data.contains_key(&gatt_uuids::MANUFACTURER_COMPANY_ID) { |
| 111 | found_manufacturer_data = true; |
| 112 | break; |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | _ = &mut timeout => break, |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | adapter.stop_scan().await.unwrap(); |
| 121 | assert!( |
| 122 | found_manufacturer_data, |
| 123 | "Did not receive ManufacturerDataAdvertisement with company ID 0xFFFF" |
| 124 | ); |
| 125 | } |
| 126 | |
| 127 | pub async fn test_advertisement_services() { |
| 128 | use btleplug::api::{Central, CentralEvent, ScanFilter}; |
nothing calls this directly
no test coverage detected