MCPcopy Create free account
hub / github.com/SmingHub/Sming / onReceive

Method onReceive

Sming/Components/Network/src/Network/UdpConnection.cpp:96–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void UdpConnection::onReceive(pbuf* buf, IpAddress remoteIP, uint16_t remotePort)
97{
98 debug_d("UDP received: %d bytes", buf->tot_len);
99 if(onDataCallback) {
100 auto data = new char[buf->tot_len + 1];
101 pbuf_copy_partial(buf, data, buf->tot_len, 0);
102 data[buf->tot_len] = '\0';
103
104 onDataCallback(*this, data, buf->tot_len, remoteIP, remotePort);
105
106 delete[] data;
107 }
108}
109
110void UdpConnection::staticOnReceive(void* arg, struct udp_pcb*, struct pbuf* p, LWIP_IP_ADDR_T* addr, u16_t port)
111{

Callers 1

staticOnReceiveMethod · 0.45

Calls 1

onDataCallbackFunction · 0.85

Tested by

no test coverage detected