Terminates a connection to the device. This is a synchronous operation.
(&self)
| 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<()> { |
nothing calls this directly
no test coverage detected