diff --git a/mavlink-core/src/async_connection/mod.rs b/mavlink-core/src/async_connection/mod.rs index 6ef4cc156a..ed727ec93b 100644 --- a/mavlink-core/src/async_connection/mod.rs +++ b/mavlink-core/src/async_connection/mod.rs @@ -13,12 +13,12 @@ mod file; #[cfg(feature = "signing")] use crate::SigningConfig; -/// A MAVLink connection +/// An async MAVLink connection #[async_trait::async_trait] pub trait AsyncMavConnection { /// Receive a mavlink message. /// - /// Blocks until a valid frame is received, ignoring invalid messages. + /// Wait until a valid frame is received, ignoring invalid messages. async fn recv(&self) -> Result<(MavHeader, M), crate::error::MessageReadError>; /// Send a mavlink message @@ -61,7 +61,7 @@ pub trait AsyncMavConnection { fn setup_signing(&mut self, signing_data: Option); } -/// Connect to a MAVLink node by address string. +/// Connect asynchronously to a MAVLink node by address string. /// /// The address must be in one of the following formats: /// @@ -70,12 +70,11 @@ pub trait AsyncMavConnection { /// * `udpin::` to create a UDP server, listening for incoming packets /// * `udpout::` to create a UDP client /// * `udpbcast::` to create a UDP broadcast -/// * NOT `serial::` to create a serial connection /// * `file:` to extract file data /// +/// Serial is currently not supported for async connections, use [`crate::connect`] instead. /// The type of the connection is determined at runtime based on the address type, so the /// connection is returned as a trait object. -// TODO only reason this has to be send is udp serve pub async fn connect_async( address: &str, ) -> io::Result + Sync + Send>> { @@ -102,16 +101,6 @@ pub async fn connect_async( { protocol_err } - } else if cfg!(feature = "direct-serial") && address.starts_with("serial:") { - #[cfg(feature = "direct-serial")] - { - todo!() - //Ok(Box::new(direct_serial::open(&address["serial:".len()..])?)) - } - #[cfg(not(feature = "direct-serial"))] - { - protocol_err - } } else if address.starts_with("file") { Ok(Box::new(file::open(&address["file:".len()..]).await?)) } else { @@ -119,7 +108,6 @@ pub async fn connect_async( } } -// TODO remove this ? /// Returns the socket address for the given address. pub(crate) fn get_socket_addr( address: T, diff --git a/mavlink-core/src/lib.rs b/mavlink-core/src/lib.rs index d68fe1d214..7a3341950d 100644 --- a/mavlink-core/src/lib.rs +++ b/mavlink-core/src/lib.rs @@ -1133,7 +1133,7 @@ async fn read_v2_msg_async_inner read: &mut AsyncPeekReader, signing_data: Option<&SigningData>, ) -> Result<(MavHeader, M), error::MessageReadError> { - let message = read_v2_raw_message_async_signed::(read, signing_data).await?; + let message = read_v2_raw_message_async_inner::(read, signing_data).await?; Ok(( MavHeader { @@ -1212,7 +1212,7 @@ pub async fn write_versioned_msg_async( w: &mut W, version: MavlinkVersion,