mecelectronics: Add Qt6 support

This commit is contained in:
Simon Stürz 2025-08-08 14:46:04 +02:00
parent 202e726df4
commit 19921dc6db
2 changed files with 8 additions and 7 deletions

View File

@ -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,11 +31,12 @@
#include "integrationpluginmecelectronics.h" #include "integrationpluginmecelectronics.h"
#include "plugininfo.h" #include "plugininfo.h"
#include <network/networkaccessmanager.h>
#include <plugintimer.h> #include <plugintimer.h>
#include <network/networkaccessmanager.h>
#include <platform/platformzeroconfcontroller.h> #include <platform/platformzeroconfcontroller.h>
#include <network/zeroconf/zeroconfservicebrowser.h> #include <network/zeroconf/zeroconfservicebrowser.h>
#include <QRegularExpression>
#include <QNetworkReply> #include <QNetworkReply>
#include <QJsonDocument> #include <QJsonDocument>
#include <QTimer> #include <QTimer>
@ -69,8 +70,8 @@ void IntegrationPluginMecMeter::discoverThings(ThingDiscoveryInfo *info)
continue; continue;
} }
qCDebug(dcMecElectronics()) << "zeroconf entry:" << entry; qCDebug(dcMecElectronics()) << "zeroconf entry:" << entry;
QRegExp match("mec[A-Z0-9]{12}");
if (match.exactMatch(entry.name())) { if (QRegularExpression("mec[A-Z0-9]{12}").match(entry.name()).hasMatch()) {
qCDebug(dcMecElectronics()) << "Found mec meter!"; qCDebug(dcMecElectronics()) << "Found mec meter!";
ThingDescriptor descriptor(mecMeterThingClassId, entry.name(), entry.hostAddress().toString()); ThingDescriptor descriptor(mecMeterThingClassId, entry.name(), entry.hostAddress().toString());
descriptor.setParams({Param(mecMeterThingIdParamTypeId, entry.name())}); descriptor.setParams({Param(mecMeterThingIdParamTypeId, entry.name())});
@ -345,7 +346,7 @@ QNetworkRequest IntegrationPluginMecMeter::composeRequest(const QString &meterId
if (address.isNull()) { if (address.isNull()) {
pluginStorage()->beginGroup(meterId); pluginStorage()->beginGroup(meterId);
address = pluginStorage()->value("cachedAddress").toString(); address = QHostAddress(pluginStorage()->value("cachedAddress").toString());
pluginStorage()->endGroup(); pluginStorage()->endGroup();
} }

View File

@ -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 INTEGRATIONPLUGINMECMETER_H #ifndef INTEGRATIONPLUGINMECMETER_H
#define INTEGRATIONPLUGINMECMETER_H #define INTEGRATIONPLUGINMECMETER_H
#include "integrations/integrationplugin.h" #include <integrations/integrationplugin.h>
class PluginTimer; class PluginTimer;
class ZeroConfServiceBrowser; class ZeroConfServiceBrowser;