diff options
author | 2019-05-28 21:42:53 +0300 | |
---|---|---|
committer | 2019-05-28 21:42:53 +0300 | |
commit | b4855908d867e86de77dbda29a39a625111249ef (patch) | |
tree | 7431295051e2991562e41c6b645cebc747c91ee7 /src/device/device_network.cpp | |
parent | 078a767c5a878fc5fb7b851a5a4b68590a78bca9 (diff) | |
download | usurpation-b4855908d867e86de77dbda29a39a625111249ef.tar.gz usurpation-b4855908d867e86de77dbda29a39a625111249ef.tar.bz2 usurpation-b4855908d867e86de77dbda29a39a625111249ef.zip |
Screen: very shoddy implementation of message code.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/device/device_network.cpp')
-rw-r--r-- | src/device/device_network.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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; } - |