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

Method disconnect

src/corebluetooth/peripheral.rs:301–320  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

299 }
300
301 async fn disconnect(&self) -> Result<()> {
302 let fut = CoreBluetoothReplyFuture::default();
303 self.shared
304 .message_sender
305 .to_owned()
306 .send(CoreBluetoothMessage::DisconnectDevice {
307 peripheral_uuid: self.shared.uuid,
308 future: fut.get_state_clone(),
309 })
310 .await?;
311 match fut.await {
312 CoreBluetoothReply::Ok => {
313 self.shared
314 .emit_event(CentralEvent::DeviceDisconnected(self.shared.uuid.into()));
315 trace!("Device disconnected!");
316 }
317 _ => error!("Shouldn't get anything but Ok!"),
318 }
319 Ok(())
320 }
321
322 async fn discover_services(&self) -> Result<()> {
323 let fut = CoreBluetoothReplyFuture::default();

Callers

nothing calls this directly

Calls 2

get_state_cloneMethod · 0.80
emit_eventMethod · 0.45

Tested by

no test coverage detected