From b4855908d867e86de77dbda29a39a625111249ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Tue, 28 May 2019 21:42:53 +0300 Subject: Screen: very shoddy implementation of message code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ramūnas Mažeikis --- src/device/device_network.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/device/device_network.cpp') diff --git a/src/device/device_network.cpp b/src/device/device_network.cpp index d7781a0..f2456d9 100644 --- a/src/device/device_network.cpp +++ b/src/device/device_network.cpp @@ -26,7 +26,7 @@ static struct netstate { WiFiUDP udp; - char udppacketbuffer[1500]; + char udppacketbuffer[MTU]; char *udppacketcursor; IPAddress daemon_ip; bool acquired; @@ -59,6 +59,17 @@ int udp_flush(void) return state.udp.endPacket(); } +size_t udp_get_data(char *buf, size_t size) +{ + size_t ret; + if (state.udp.available() != 0) { + ret = state.udp.read(buf, size); + } else { + ret = 0; + } + return ret; +} + void discover_client(const int port) { IPAddress bcastip(255, 255, 255, 255); @@ -100,4 +111,3 @@ static void udp_init_packet_expaddr(IPAddress ip, const int port) memset(state.udppacketbuffer, 0, sizeof(state.udppacketbuffer)); state.udppacketcursor = state.udppacketbuffer; } - -- cgit v1.2.3