udpcommander: Add Qt6 support
This commit is contained in:
parent
e5413a8950
commit
5cbb2db471
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -29,9 +29,10 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "integrationpluginudpcommander.h"
|
#include "integrationpluginudpcommander.h"
|
||||||
#include "integrations/thing.h"
|
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
|
#include <integrations/thing.h>
|
||||||
|
|
||||||
IntegrationPluginUdpCommander::IntegrationPluginUdpCommander()
|
IntegrationPluginUdpCommander::IntegrationPluginUdpCommander()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ void IntegrationPluginUdpCommander::setupThing(ThingSetupInfo *info)
|
|||||||
}
|
}
|
||||||
qCDebug(dcUdpCommander()) << "Listening on port" << port;
|
qCDebug(dcUdpCommander()) << "Listening on port" << port;
|
||||||
|
|
||||||
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
|
connect(udpSocket, &QUdpSocket::readyRead, this, &IntegrationPluginUdpCommander::readPendingDatagrams);
|
||||||
m_receiverList.insert(udpSocket, thing);
|
m_receiverList.insert(udpSocket, thing);
|
||||||
|
|
||||||
return info->finish(Thing::ThingErrorNoError);
|
return info->finish(Thing::ThingErrorNoError);
|
||||||
@ -76,7 +77,7 @@ void IntegrationPluginUdpCommander::executeAction(ThingActionInfo *info)
|
|||||||
int port = thing->paramValue(udpCommanderThingPortParamTypeId).toInt();
|
int port = thing->paramValue(udpCommanderThingPortParamTypeId).toInt();
|
||||||
QHostAddress address = QHostAddress(thing->paramValue(udpCommanderThingAddressParamTypeId).toString());
|
QHostAddress address = QHostAddress(thing->paramValue(udpCommanderThingAddressParamTypeId).toString());
|
||||||
QByteArray data = action.param(udpCommanderTriggerActionDataParamTypeId).value().toByteArray();
|
QByteArray data = action.param(udpCommanderTriggerActionDataParamTypeId).value().toByteArray();
|
||||||
qDebug(dcUdpCommander()) << "Send UDP datagram:" << data << "address:" << address.toIPv4Address() << "port:" << port;
|
qCDebug(dcUdpCommander()) << "Send UDP datagram:" << data << "address:" << address.toIPv4Address() << "port:" << port;
|
||||||
udpSocket->writeDatagram(data, address, port);
|
udpSocket->writeDatagram(data, address, port);
|
||||||
|
|
||||||
return info->finish(Thing::ThingErrorNoError);
|
return info->finish(Thing::ThingErrorNoError);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef INTEGRATIONPLUGINUDPCOMMANDER_H
|
#ifndef INTEGRATIONPLUGINUDPCOMMANDER_H
|
||||||
#define INTEGRATIONPLUGINUDPCOMMANDER_H
|
#define INTEGRATIONPLUGINUDPCOMMANDER_H
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
QT += network
|
QT *= network
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationpluginudpcommander)
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationpluginudpcommander.cpp
|
integrationpluginudpcommander.cpp
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user