-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async Connection Trait #256
Comments
Hi @pv42, nice idea, surely mavlink-camera-manager (and potentially mavlink2rest) would benefit from that! To contextualize, I did implement these tokio-based async read/write because I've been experimenting with a new mavlink router written in rust (mavlink-server). This router can also be refactored to make use of that, but it already has an implementation (which might help us here?). Feel free to use any of that code if useful, |
I was literally looking to see if this existed last night! +100! |
@pv42 just so you know, I'm reworking the tokio async reader around tokio-utils' codec, so we can ensure a frame would be received from the raw read functions, and using the same codec you can have a tokio's UdpStream. |
With #255 support for
tokio
-basedasync
was merged, addingasync
versions ofwrite_versioned_msg
andread_v2_msg
which is very welcome (as it is something I was thinking of doing myself).I suggest adding an
async
version of the connection trait similar toMavConnection<M: Message>
:And then implementing it for the
tcp
,udp
,file
and potentiallyserial
(unsure if/howtokio
support that) connections and providing a public function to openasync
connections:pub async fn connect_async<M: Message>(address: &str) -> io::Result<Box<dyn AsyncMavConnection<M> + Sync + Send>>
If this is something that would fit and if @joaoantoniocardoso is not already working on it I would be happy to submit a PR.
The text was updated successfully, but these errors were encountered: