| 32 | } |
| 33 | |
| 34 | void UDPcomm::init() { |
| 35 | if (config.discovery == 0) { |
| 36 | if (udp.listenMulticast(UDPIP, UDPPORT)) { |
| 37 | udp.onPacket([this](AsyncUDPPacket packet) { |
| 38 | if (packet.remoteIP() != wm.localIP()) { |
| 39 | this->processPacket(packet); |
| 40 | } |
| 41 | }); |
| 42 | } |
| 43 | } else { |
| 44 | if (udp.listen(UDPPORT)) { |
| 45 | udp.onPacket([this](AsyncUDPPacket packet) { |
| 46 | if (packet.isBroadcast() && packet.remoteIP() != wm.localIP()) { |
| 47 | this->processPacket(packet); |
| 48 | } |
| 49 | }); |
| 50 | } |
| 51 | } |
| 52 | setAPchannel(); |
| 53 | } |
| 54 | |
| 55 | void UDPcomm::processPacket(AsyncUDPPacket packet) { |
| 56 | if (config.runStatus == RUNSTATUS_STOP) { |
no test coverage detected