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

Method is_connected

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

Source from the content-addressed store, hash-verified

258 }
259
260 async fn is_connected(&self) -> Result<bool> {
261 let fut = CoreBluetoothReplyFuture::default();
262 self.shared
263 .message_sender
264 .to_owned()
265 .send(CoreBluetoothMessage::IsConnected {
266 peripheral_uuid: self.shared.uuid,
267 future: fut.get_state_clone(),
268 })
269 .await?;
270 match fut.await {
271 CoreBluetoothReply::State(state) => match state {
272 CBPeripheralState::Connected => Ok(true),
273 _ => Ok(false),
274 },
275 _ => panic!("Shouldn't get anything but a State!"),
276 }
277 }
278
279 async fn connect(&self) -> Result<()> {
280 let fut = CoreBluetoothReplyFuture::default();

Callers

nothing calls this directly

Calls 1

get_state_cloneMethod · 0.80

Tested by

no test coverage detected