Open MGlolenstine opened 1 year ago
Hi @MGlolenstine, glad to hear you're creating a UART adapter. I like the idea 🙌🏻.
Sure it would need some kind of refactoring/redesign. I think the first question is, how to identify UARTs connections?
The SocketAddr
returned by connect_with
ends up in the Endpoint
type used everywhere. I think the first change will be to allow the Endpoint
type to hold several kinds of connections:
pub enum Addr {
Network(SocketAddr),
Device(/* UART addr here*/ )
}
pub struct Endpoint {
resource_id: ResourceId,
addr: Addr,
}
Then, you can now return an Addr::Device()
from the connect_with()
function. WDYT?
I have to admit that I've only barely scratched the surface of the library, and the above ideas I've gotten from the documentation (which is excellent, by the way). Your idea will probably be much better than what I had, and I'll take a look later today and see if I can create a nice abstraction :)
Thank you!
Great! and any suggestion or other idea you feel fits better is welcome!
I've tried looking into making a custom adapter, but the
ConnectionInfo
requiresSocketAddr
which only supportsIPv4
andIPv6
, which UART doesn't have.Would it be possible to implement
connect_with
without having to specify an IP address?I've looked around for a bit and I think that one of the actions I could take, is to fork it and add COM/TTY support to
ConnectionInfo
andRemoteAddr
.EDIT: I know that the point of this library is networking, but I like the design and I thought it would make my interfacing with UART easier.