From b4b1f663b977e69b9d5c7e40a1a8201da6d10471 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 12 Oct 2020 15:27:06 +0200 Subject: [PATCH] Fix processing of multiple UDP datagrams in one go --- .../integrationpluginudpcommander.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/udpcommander/integrationpluginudpcommander.cpp b/udpcommander/integrationpluginudpcommander.cpp index c1741367..97c09b5f 100644 --- a/udpcommander/integrationpluginudpcommander.cpp +++ b/udpcommander/integrationpluginudpcommander.cpp @@ -116,15 +116,16 @@ void IntegrationPluginUdpCommander::readPendingDatagrams() while (socket->hasPendingDatagrams()) { datagram.resize(socket->pendingDatagramSize()); socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort); + qCDebug(dcUdpCommander()) << "Incoming datatram" << datagram << "on" << thing->name() << "from" << sender.toString() << senderPort; + + Event ev = Event(udpReceiverTriggeredEventTypeId, thing->id()); + ParamList params; + params.append(Param(udpReceiverTriggeredEventDataParamTypeId, datagram)); + ev.setParams(params); + emit emitEvent(ev); + + // Send response for verification + socket->writeDatagram("OK\n", sender, senderPort); } - qCDebug(dcUdpCommander()) << thing->name() << "got command from" << sender.toString() << senderPort; - Event ev = Event(udpReceiverTriggeredEventTypeId, thing->id()); - ParamList params; - params.append(Param(udpReceiverTriggeredEventDataParamTypeId, datagram)); - ev.setParams(params); - emit emitEvent(ev); - - // Send response for verification - socket->writeDatagram("OK\n", sender, senderPort); }