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

Method disconnect

src/winrtble/peripheral.rs:445–454  ·  view source on GitHub ↗

Terminates a connection to the device. This is a synchronous operation.

(&self)

Source from the content-addressed store, hash-verified

443
444 /// Terminates a connection to the device. This is a synchronous operation.
445 async fn disconnect(&self) -> Result<()> {
446 // We need to clear the services because if this device is re-connected,
447 // the cached service objects will no longer be valid (they must be refreshed).
448 self.shared.ble_services.clear();
449 let mut device = self.shared.device.lock().await;
450 *device = None;
451 self.shared.connected.store(false, Ordering::Relaxed);
452 self.emit_event(CentralEvent::DeviceDisconnected(self.shared.address.into()));
453 Ok(())
454 }
455
456 /// Discovers all characteristics for the device. This is a synchronous operation.
457 async fn discover_services(&self) -> Result<()> {

Callers

nothing calls this directly

Calls 1

emit_eventMethod · 0.45

Tested by

no test coverage detected