@@ -13,12 +13,12 @@ mod file;
13
13
#[ cfg( feature = "signing" ) ]
14
14
use crate :: SigningConfig ;
15
15
16
- /// A MAVLink connection
16
+ /// An async MAVLink connection
17
17
#[ async_trait:: async_trait]
18
18
pub trait AsyncMavConnection < M : Message + Sync > {
19
19
/// Receive a mavlink message.
20
20
///
21
- /// Blocks until a valid frame is received, ignoring invalid messages.
21
+ /// Wait until a valid frame is received, ignoring invalid messages.
22
22
async fn recv ( & self ) -> Result < ( MavHeader , M ) , crate :: error:: MessageReadError > ;
23
23
24
24
/// Send a mavlink message
@@ -61,7 +61,7 @@ pub trait AsyncMavConnection<M: Message + Sync> {
61
61
fn setup_signing ( & mut self , signing_data : Option < SigningConfig > ) ;
62
62
}
63
63
64
- /// Connect to a MAVLink node by address string.
64
+ /// Connect asynchronously to a MAVLink node by address string.
65
65
///
66
66
/// The address must be in one of the following formats:
67
67
///
@@ -70,12 +70,11 @@ pub trait AsyncMavConnection<M: Message + Sync> {
70
70
/// * `udpin:<addr>:<port>` to create a UDP server, listening for incoming packets
71
71
/// * `udpout:<addr>:<port>` to create a UDP client
72
72
/// * `udpbcast:<addr>:<port>` to create a UDP broadcast
73
- /// * NOT `serial:<port>:<baudrate>` to create a serial connection
74
73
/// * `file:<path>` to extract file data
75
74
///
75
+ /// Serial is currently not supported for async connections, use [`crate::connect`] instead.
76
76
/// The type of the connection is determined at runtime based on the address type, so the
77
77
/// connection is returned as a trait object.
78
- // TODO only reason this has to be send is udp serve
79
78
pub async fn connect_async < M : Message + Sync + Send > (
80
79
address : & str ,
81
80
) -> io:: Result < Box < dyn AsyncMavConnection < M > + Sync + Send > > {
@@ -102,24 +101,13 @@ pub async fn connect_async<M: Message + Sync + Send>(
102
101
{
103
102
protocol_err
104
103
}
105
- } else if cfg ! ( feature = "direct-serial" ) && address. starts_with ( "serial:" ) {
106
- #[ cfg( feature = "direct-serial" ) ]
107
- {
108
- todo ! ( )
109
- //Ok(Box::new(direct_serial::open(&address["serial:".len()..])?))
110
- }
111
- #[ cfg( not( feature = "direct-serial" ) ) ]
112
- {
113
- protocol_err
114
- }
115
104
} else if address. starts_with ( "file" ) {
116
105
Ok ( Box :: new ( file:: open ( & address[ "file:" . len ( ) ..] ) . await ?) )
117
106
} else {
118
107
protocol_err
119
108
}
120
109
}
121
110
122
- // TODO remove this ?
123
111
/// Returns the socket address for the given address.
124
112
pub ( crate ) fn get_socket_addr < T : std:: net:: ToSocketAddrs > (
125
113
address : T ,
0 commit comments