diff --git a/src/socket/mod.rs b/src/socket/mod.rs index 5f6482f..bd7eba7 100644 --- a/src/socket/mod.rs +++ b/src/socket/mod.rs @@ -1,4 +1,6 @@ -pub trait Socket {} +pub trait Socket { + // TODO expose method to get address of socket +} pub type OwnedSockets = ( Socket0, diff --git a/src/udp/mod.rs b/src/udp/mod.rs index dafc5c7..48a245e 100644 --- a/src/udp/mod.rs +++ b/src/udp/mod.rs @@ -1,5 +1,12 @@ use crate::socket::Socket; pub struct UdpSocket { - pub socket: SocketImpl, + socket: SocketImpl, +} + +impl UdpSocket { + pub fn new(socket: SocketImpl) -> Self { + // TODO initialize socket for UDP mode + UdpSocket { socket } + } } diff --git a/src/w5500.rs b/src/w5500.rs index 669c905..a3e182b 100644 --- a/src/w5500.rs +++ b/src/w5500.rs @@ -51,7 +51,7 @@ impl W5500 { } pub fn open_udp_socket(&self, socket: SocketImpl) -> UdpSocket { - UdpSocket { socket } + UdpSocket::new(socket) } }