diff options
author | 2019-06-01 15:27:19 +0300 | |
---|---|---|
committer | 2019-06-01 15:27:19 +0300 | |
commit | fb220a85890b1de874061cc6b1b2102ba33ad43f (patch) | |
tree | 6ec02e665d35d114c2212a5243dd1cb0f6afff37 /src/device/device_network.cpp | |
parent | 96d7d31534921889c219a5c9e00a46c3e94d0124 (diff) | |
parent | 227a0e12ee262dbabdd8d988fec194273cf90029 (diff) | |
download | usurpation-fb220a85890b1de874061cc6b1b2102ba33ad43f.tar.gz usurpation-fb220a85890b1de874061cc6b1b2102ba33ad43f.tar.bz2 usurpation-fb220a85890b1de874061cc6b1b2102ba33ad43f.zip |
Merge branch '35-Message-Output'
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
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; } - |