diff --git a/cflib2/_rust.pyi b/cflib2/_rust.pyi index 4fff888..bcab1cc 100644 --- a/cflib2/_rust.pyi +++ b/cflib2/_rust.pyi @@ -324,6 +324,12 @@ class Crazyflie: r""" Disconnect from the Crazyflie """ + async def wait_disconnect(self) -> builtins.str: + r""" + Wait for the Crazyflie to be disconnected + + Returns a human-readable string describing the reason for disconnection. + """ def commander(self) -> Commander: r""" Get the commander subsystem diff --git a/rust/src/crazyflie.rs b/rust/src/crazyflie.rs index f0ad7bc..fdca6b2 100644 --- a/rust/src/crazyflie.rs +++ b/rust/src/crazyflie.rs @@ -134,6 +134,18 @@ impl Crazyflie { }) } + /// Wait for the Crazyflie to be disconnected + /// + /// Returns a human-readable string describing the reason for disconnection. + #[gen_stub(override_return_type(type_repr = "collections.abc.Coroutine[typing.Any, typing.Any, builtins.str]"))] + fn wait_disconnect<'py>(&self, py: Python<'py>) -> PyResult> { + let inner = self.inner.clone(); + pyo3_async_runtimes::tokio::future_into_py(py, async move { + let reason = inner.wait_disconnect().await; + Ok(reason) + }) + } + /// Get the commander subsystem fn commander(&self) -> Commander { Commander {