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

Method discover_services

src/winrtble/ble/device.rs:264–280  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

262 }
263
264 pub async fn discover_services(&mut self) -> Result<&[GattDeviceService]> {
265 let winrt_error = |e| Error::Other(format!("{:?}", e).into());
266 let service_result = self.get_gatt_services(BluetoothCacheMode::Cached).await?;
267 let status = service_result.Status().map_err(winrt_error)?;
268 if status == GattCommunicationStatus::Success {
269 // We need to convert the IVectorView to a Vec, because IVectorView is not Send and so
270 // can't be help past the await point below.
271 let services: Vec<_> = service_result
272 .Services()
273 .map_err(winrt_error)?
274 .into_iter()
275 .collect();
276 self.services = services;
277 debug!("services {:?}", self.services.len());
278 }
279 Ok(self.services.as_slice())
280 }
281}
282
283impl Drop for BLEDevice {

Callers 5

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 1

get_gatt_servicesMethod · 0.80

Tested by 1