Merge PR #218: Add Qt6 support
This commit is contained in:
commit
b2b802ed19
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2021, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -29,6 +29,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "integrationpluginalphainnotec.h"
|
||||
#include "alphainnotecmodbustcpconnection.h"
|
||||
#include "plugininfo.h"
|
||||
|
||||
#include <network/networkdevicediscovery.h>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2020, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -34,9 +34,8 @@
|
||||
#include <plugintimer.h>
|
||||
#include <integrations/integrationplugin.h>
|
||||
|
||||
#include "alphainnotecmodbustcpconnection.h"
|
||||
|
||||
class NetworkDeviceMonitor;
|
||||
class AlphaInnotecModbusTcpConnection;
|
||||
|
||||
class IntegrationPluginAlphaInnotec: public IntegrationPlugin
|
||||
{
|
||||
|
||||
@ -52,7 +52,7 @@ void AmperfiedConnectDiscovery::startDiscovery(const QString &nameFilter)
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::hostAddressDiscovered, this, &AmperfiedConnectDiscovery::checkNetworkDevice);
|
||||
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||
qCDebug(dcAmperfied()) << "Discovery: Network discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "network devices";
|
||||
qCDebug(dcAmperfied()) << "Discovery: Network discovery finished. Found" << discoveryReply->networkDeviceInfos().length() << "network devices";
|
||||
m_networkDeviceInfos = discoveryReply->networkDeviceInfos();
|
||||
m_gracePeriodTimer.start();
|
||||
discoveryReply->deleteLater();
|
||||
@ -144,14 +144,14 @@ void AmperfiedConnectDiscovery::finishDiscovery()
|
||||
qint64 durationMilliSeconds = QDateTime::currentMSecsSinceEpoch() - m_startDateTime.toMSecsSinceEpoch();
|
||||
|
||||
// Fill in finished network device information
|
||||
for (int i = 0; i < m_discoveryResults.count(); i++)
|
||||
for (int i = 0; i < m_discoveryResults.length(); i++)
|
||||
m_discoveryResults[i].networkDeviceInfo = m_networkDeviceInfos.get(m_discoveryResults.value(i).address);
|
||||
|
||||
// Cleanup any leftovers...we don't care any more
|
||||
foreach (AmperfiedModbusTcpConnection *connection, m_connections)
|
||||
cleanupConnection(connection);
|
||||
|
||||
qCInfo(dcAmperfied()) << "Discovery: Finished the discovery process. Found" << m_discoveryResults.count()
|
||||
qCInfo(dcAmperfied()) << "Discovery: Finished the discovery process. Found" << m_discoveryResults.length()
|
||||
<< "Amperfied wallboxes in" << QTime::fromMSecsSinceStartOfDay(durationMilliSeconds).toString("mm:ss.zzz");
|
||||
m_gracePeriodTimer.stop();
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ void IntegrationPluginAmperfied::discoverThings(ThingDiscoveryInfo *info)
|
||||
return;
|
||||
}
|
||||
|
||||
qCInfo(dcAmperfied()) << "Discovery results:" << discovery->discoveryResults().count();
|
||||
qCInfo(dcAmperfied()) << "Discovery results:" << discovery->discoveryResults().length();
|
||||
|
||||
foreach (const EnergyControlDiscovery::Result &result, discovery->discoveryResults()) {
|
||||
ThingDescriptor descriptor(energyControlThingClassId, "Amperfied Energy Control", QString("Slave ID: %1").arg(result.slaveId));
|
||||
@ -82,7 +82,7 @@ void IntegrationPluginAmperfied::discoverThings(ThingDiscoveryInfo *info)
|
||||
if (info->thingClassId() == connectHomeThingClassId || info->thingClassId() == connectBusinessThingClassId || info->thingClassId() == connectSolarThingClassId) {
|
||||
AmperfiedConnectDiscovery *discovery = new AmperfiedConnectDiscovery(hardwareManager()->networkDeviceDiscovery(), info);
|
||||
connect(discovery, &AmperfiedConnectDiscovery::discoveryFinished, info, [this, info, discovery](){
|
||||
qCInfo(dcAmperfied()) << "Discovery results:" << discovery->discoveryResults().count();
|
||||
qCInfo(dcAmperfied()) << "Discovery results:" << discovery->discoveryResults().length();
|
||||
|
||||
foreach (const AmperfiedConnectDiscovery::Result &result, discovery->discoveryResults()) {
|
||||
QString description;
|
||||
|
||||
1
debian-qt6/changelog
Symbolic link
1
debian-qt6/changelog
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/changelog
|
||||
1
debian-qt6/compat
Normal file
1
debian-qt6/compat
Normal file
@ -0,0 +1 @@
|
||||
13
|
||||
308
debian-qt6/control
Normal file
308
debian-qt6/control
Normal file
@ -0,0 +1,308 @@
|
||||
Source: nymea-plugins-modbus
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: nymea GmbH <developer@nymea.io>
|
||||
Standards-Version: 4.7.2
|
||||
Build-depends: debhelper,
|
||||
libnymea-dev,
|
||||
libnymea-gpio-dev,
|
||||
qt6-base-dev,
|
||||
qt6-base-dev-tools,
|
||||
qt6-serialport-dev,
|
||||
qt6-serialbus-dev,
|
||||
nymea-dev-tools:native,
|
||||
pkg-config,
|
||||
libi2c-dev,
|
||||
python3:native
|
||||
|
||||
|
||||
Package: libnymea-sunspec1
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea.io sunspec library
|
||||
This package contains the nymea sunspec library.
|
||||
|
||||
|
||||
Package: libnymea-sunspec-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libnymea-sunspec1 (= ${binary:Version}),
|
||||
pkg-config,
|
||||
qt6-base-dev,
|
||||
qt6-base-dev-tools,
|
||||
Description: The main libraries and header files for developing with nymea sunspec.
|
||||
This package contains the nymea sunspec library - development files.
|
||||
|
||||
|
||||
Package: libnymea-modbus
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea modbus integration plugins library
|
||||
This package contains the nymea modbus library for integration plugins.
|
||||
|
||||
|
||||
Package: libnymea-modbus-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libnymea-modbus (= ${binary:Version}),
|
||||
pkg-config,
|
||||
qt6-base-dev,
|
||||
qt6-base-dev-tools,
|
||||
python3,
|
||||
Description: The main libraries and header files for developing with modbus based nymea integration plugins.
|
||||
This package contains the nymea modbus integration plugin library - development files.
|
||||
|
||||
|
||||
Package: nymea-modbus-cli
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea modbus command line tool for testing modbus TCP communication
|
||||
This package contains the nymea modbus command line tool for testing modbus TCP communication.
|
||||
|
||||
|
||||
Package: nymea-plugin-alphainnotec
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for alpha innotec heat pumps
|
||||
This package contains the nymea integration plugin for alpha innotec head pumps.
|
||||
|
||||
|
||||
Package: nymea-plugin-amperfied
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Amperfeid/Heidelberg wallboxes
|
||||
This package contains the nymea integration plugin for Amperfeid/Heidelberg wallboxes.
|
||||
|
||||
|
||||
Package: nymea-plugin-bgetech
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for B+G E-Tech Modbus based energy meters
|
||||
This package contains the nymea integration plugin for Modbus based energy meters
|
||||
made by B+G E-Tech.
|
||||
|
||||
|
||||
Package: nymea-plugin-drexelundweiss
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Drexel & Weiss heat pumps
|
||||
This package contains the nymea integration plugin for Drexel & Weiss heat pumps.
|
||||
|
||||
|
||||
Package: nymea-plugin-idm
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for iDM heat pumps
|
||||
This package contains the nymea integration plugin for iDM heat pumps.
|
||||
|
||||
|
||||
Package: nymea-plugin-inepro
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for inepro Metering Modbus based energy meters
|
||||
This package contains the nymea integration plugin for Modbus based energy meters
|
||||
made by inepro Metering.
|
||||
|
||||
|
||||
Package: nymea-plugin-inro
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for INRO PANTABOX chargers
|
||||
This package contains the nymea integration plugin for Modbus based PANTABOX
|
||||
support.
|
||||
|
||||
|
||||
Package: nymea-plugin-huawei
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea integration plugin for Huawei FusionSolar energy devices
|
||||
This package contains the nymea integration plugin for Huawei FusionSolar devices
|
||||
based on Modbus TCP.
|
||||
|
||||
|
||||
Package: nymea-plugin-kostal
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea.io plugin for Kostal Solar inverters
|
||||
This package contains the nymea.io plugin for Kostal Solar inverters
|
||||
|
||||
|
||||
Package: nymea-plugin-mennekes
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea.io plugin for Mennekes wallboxes
|
||||
This package contains the nymea.io plugin for Mennekes wallboxes
|
||||
|
||||
|
||||
Package: nymea-plugin-modbuscommander
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin to send and receive generic modbus commands
|
||||
This package contains a nymea integration plugin which allows to send and receive
|
||||
generic Modbus commands to/from a Modbus device.
|
||||
|
||||
|
||||
Package: nymea-plugin-mypv
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for my-pv heating rods
|
||||
This package contains the nymea integration plugin for my-pv solar inverters.
|
||||
|
||||
|
||||
Package: nymea-plugin-mtec
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for M-TEC heat pumps
|
||||
This package contains the nymea integration plugin for M-TEC heat pumps.
|
||||
|
||||
|
||||
Package: nymea-plugin-schrack
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Schrack wallboxes
|
||||
This package contains the nymea integration plugin for Schrack wallboxes.
|
||||
|
||||
|
||||
Package: nymea-plugin-senseair
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Senseair sensors
|
||||
This package contains the nymea integration plugin for Senseair sensors.
|
||||
|
||||
|
||||
Package: nymea-plugin-sma
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: nymea integration plugin for SMA solar inverters and meters
|
||||
This package contains the nymea integration plugin for SMA solar inverters and meters.
|
||||
|
||||
|
||||
Package: nymea-plugin-solax
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Solax modbus devices
|
||||
This package contains the nymea integration plugin for solax compatible solar inverters, meters and batteries.
|
||||
|
||||
|
||||
Package: nymea-plugin-stiebeleltron
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea.io plugin for Stiebel Eltron heat pumps
|
||||
This package will install the nymea.io plugin for Stiebel Eltron heat pumps.
|
||||
|
||||
|
||||
Package: nymea-plugin-sungrow
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Sungrow devices
|
||||
This package contains the nymea integration plugin for Sungrow solar inverters, meters and batteries.
|
||||
|
||||
|
||||
Package: nymea-plugin-sunspec
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for SunSpec Modbus devices
|
||||
This package contains the nymea integration plugin for SunSpec compatible solar inverters.
|
||||
|
||||
|
||||
Package: nymea-plugin-pcelectric
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for PCE wallboxes
|
||||
This package contains the nymea integration plugin for wallboxes made by PC Electric.
|
||||
|
||||
|
||||
Package: nymea-plugin-phoenixconnect
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Conflicts: nymea-plugin-wallbe
|
||||
Replaces: nymea-plugin-wallbe
|
||||
Description: nymea integration plugin for PhoenixConnect wallboxes
|
||||
This package contains the nymea integration plugin for wallboxes made
|
||||
by PhonenixConnect and rebranded as Wallbe, Compleo and Scapo.
|
||||
|
||||
|
||||
Package: nymea-plugin-vestel
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Vestel wallboxes
|
||||
This package contains the nymea integration plugin for wallboxes made
|
||||
by Vestel.
|
||||
|
||||
|
||||
Package: nymea-plugin-wattsonic
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Wattsonic hybrid inverters
|
||||
This package contains the nymea integration plugin for hybrid inverters made
|
||||
by Wattsonic.
|
||||
|
||||
|
||||
Package: nymea-plugin-webasto
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: nymea integration plugin for Webasto Live wallboxes
|
||||
This package contains the nymea integration plugin for wallboxes made
|
||||
by Webasto.
|
||||
1
debian-qt6/copyright
Symbolic link
1
debian-qt6/copyright
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/copyright
|
||||
1
debian-qt6/libnymea-modbus-dev.install.in
Symbolic link
1
debian-qt6/libnymea-modbus-dev.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/libnymea-modbus-dev.install.in
|
||||
1
debian-qt6/libnymea-modbus.install.in
Symbolic link
1
debian-qt6/libnymea-modbus.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/libnymea-modbus.install.in
|
||||
1
debian-qt6/libnymea-sunspec-dev.install.in
Symbolic link
1
debian-qt6/libnymea-sunspec-dev.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/libnymea-sunspec-dev.install.in
|
||||
1
debian-qt6/libnymea-sunspec1.dirs.in
Symbolic link
1
debian-qt6/libnymea-sunspec1.dirs.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/libnymea-sunspec1.dirs.in
|
||||
1
debian-qt6/libnymea-sunspec1.install.in
Symbolic link
1
debian-qt6/libnymea-sunspec1.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/libnymea-sunspec1.install.in
|
||||
1
debian-qt6/nymea-modbus-cli.install.in
Symbolic link
1
debian-qt6/nymea-modbus-cli.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-modbus-cli.install.in
|
||||
1
debian-qt6/nymea-plugin-alphainnotec.install.in
Symbolic link
1
debian-qt6/nymea-plugin-alphainnotec.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-alphainnotec.install.in
|
||||
1
debian-qt6/nymea-plugin-amperfied.install.in
Symbolic link
1
debian-qt6/nymea-plugin-amperfied.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-amperfied.install.in
|
||||
1
debian-qt6/nymea-plugin-bgetech.install.in
Symbolic link
1
debian-qt6/nymea-plugin-bgetech.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-bgetech.install.in
|
||||
1
debian-qt6/nymea-plugin-drexelundweiss.install.in
Symbolic link
1
debian-qt6/nymea-plugin-drexelundweiss.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-drexelundweiss.install.in
|
||||
1
debian-qt6/nymea-plugin-huawei.install.in
Symbolic link
1
debian-qt6/nymea-plugin-huawei.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-huawei.install.in
|
||||
1
debian-qt6/nymea-plugin-idm.install.in
Symbolic link
1
debian-qt6/nymea-plugin-idm.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-idm.install.in
|
||||
1
debian-qt6/nymea-plugin-inepro.install.in
Symbolic link
1
debian-qt6/nymea-plugin-inepro.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-inepro.install.in
|
||||
1
debian-qt6/nymea-plugin-inro.install.in
Symbolic link
1
debian-qt6/nymea-plugin-inro.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-inro.install.in
|
||||
1
debian-qt6/nymea-plugin-kostal.install.in
Symbolic link
1
debian-qt6/nymea-plugin-kostal.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-kostal.install.in
|
||||
1
debian-qt6/nymea-plugin-mennekes.install.in
Symbolic link
1
debian-qt6/nymea-plugin-mennekes.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-mennekes.install.in
|
||||
1
debian-qt6/nymea-plugin-modbuscommander.install.in
Symbolic link
1
debian-qt6/nymea-plugin-modbuscommander.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-modbuscommander.install.in
|
||||
1
debian-qt6/nymea-plugin-mtec.install.in
Symbolic link
1
debian-qt6/nymea-plugin-mtec.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-mtec.install.in
|
||||
1
debian-qt6/nymea-plugin-mypv.install.in
Symbolic link
1
debian-qt6/nymea-plugin-mypv.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-mypv.install.in
|
||||
1
debian-qt6/nymea-plugin-pcelectric.install.in
Symbolic link
1
debian-qt6/nymea-plugin-pcelectric.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-pcelectric.install.in
|
||||
1
debian-qt6/nymea-plugin-phoenixconnect.install.in
Symbolic link
1
debian-qt6/nymea-plugin-phoenixconnect.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-phoenixconnect.install.in
|
||||
1
debian-qt6/nymea-plugin-schrack.install.in
Symbolic link
1
debian-qt6/nymea-plugin-schrack.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-schrack.install.in
|
||||
1
debian-qt6/nymea-plugin-senseair.install.in
Symbolic link
1
debian-qt6/nymea-plugin-senseair.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-senseair.install.in
|
||||
1
debian-qt6/nymea-plugin-sma.install.in
Symbolic link
1
debian-qt6/nymea-plugin-sma.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-sma.install.in
|
||||
1
debian-qt6/nymea-plugin-solax.install.in
Symbolic link
1
debian-qt6/nymea-plugin-solax.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-solax.install.in
|
||||
1
debian-qt6/nymea-plugin-stiebeleltron.install.in
Symbolic link
1
debian-qt6/nymea-plugin-stiebeleltron.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-stiebeleltron.install.in
|
||||
1
debian-qt6/nymea-plugin-sungrow.install.in
Symbolic link
1
debian-qt6/nymea-plugin-sungrow.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-sungrow.install.in
|
||||
1
debian-qt6/nymea-plugin-sunspec.install.in
Symbolic link
1
debian-qt6/nymea-plugin-sunspec.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-sunspec.install.in
|
||||
1
debian-qt6/nymea-plugin-vestel.install.in
Symbolic link
1
debian-qt6/nymea-plugin-vestel.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-vestel.install.in
|
||||
1
debian-qt6/nymea-plugin-wattsonic.install.in
Symbolic link
1
debian-qt6/nymea-plugin-wattsonic.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-wattsonic.install.in
|
||||
1
debian-qt6/nymea-plugin-webasto.install.in
Symbolic link
1
debian-qt6/nymea-plugin-webasto.install.in
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/nymea-plugin-webasto.install.in
|
||||
26
debian-qt6/rules
Executable file
26
debian-qt6/rules
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
||||
|
||||
PREPROCESS_FILES := $(wildcard debian/*.in)
|
||||
|
||||
$(PREPROCESS_FILES:.in=): %: %.in
|
||||
sed 's,/@DEB_HOST_MULTIARCH@,$(DEB_HOST_MULTIARCH:%=/%),g' $< > $@
|
||||
|
||||
override_dh_auto_build:
|
||||
dh_auto_build
|
||||
make lrelease
|
||||
|
||||
override_dh_install: $(PREPROCESS_FILES:.in=)
|
||||
dh_install
|
||||
|
||||
override_dh_auto_clean:
|
||||
dh_auto_clean
|
||||
find -name *plugininfo.h -exec rm {} \;
|
||||
find -name *.qm -exec rm {} \;
|
||||
find -name "autogenerated" -type d -exec rm -rvf {} +
|
||||
rm -rf $(PREPROCESS_FILES:.in=)
|
||||
|
||||
%:
|
||||
dh $@ --buildsystem=qmake6 --parallel
|
||||
|
||||
1
debian-qt6/source
Symbolic link
1
debian-qt6/source
Symbolic link
@ -0,0 +1 @@
|
||||
../debian-qt5/source
|
||||
@ -132,7 +132,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter active power\" register" << 32080 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter active power\" register" << 32080 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -177,7 +177,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter input power\" register" << 32064 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter input power\" register" << 32064 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -222,7 +222,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter device status\" register" << 32089 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter device status\" register" << 32089 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 1)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 1 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -266,7 +266,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter energy produced\" register" << 32106 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Inverter energy produced\" register" << 32106 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -309,7 +309,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter active power\" register" << 37113 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter active power\" register" << 37113 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -353,7 +353,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter Positive active electricity\" register" << 37119 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter Positive active electricity\" register" << 37119 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -398,7 +398,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter Reverse active power\" register" << 37121 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Power meter Reverse active power\" register" << 37121 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -443,7 +443,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 status\" register" << 37000 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 status\" register" << 37000 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 1)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 1 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -499,7 +499,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 power\" register" << 37001 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 power\" register" << 37001 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -542,7 +542,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 state of charge\" register" << 37004 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 1 state of charge\" register" << 37004 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 1)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 1 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -586,7 +586,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 status\" register" << 37741 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 status\" register" << 37741 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 1)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values count. Requested" << 1 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -642,7 +642,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 power\" register" << 37743 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 power\" register" << 37743 << "size:" << 2 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 2)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values count. Requested" << 2 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -685,7 +685,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
handleModbusError(reply->error());
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 state of charge\" register" << 37738 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().count();
|
||||
qCDebug(dcHuaweiFusionSolar()) << "<-- Response from \"Luna 2000 Battery 2 state of charge\" register" << 37738 << "size:" << 1 << "valueCount:" << unit.valueCount() << unit.values() << unit.values().length();
|
||||
if (!valuesAreVaild(unit.values(), 1)) {
|
||||
qCWarning(dcHuaweiFusionSolar()) << "<-- Received invalid values. Requested" << 1 << "but received" << unit.values();
|
||||
} else {
|
||||
@ -712,7 +712,7 @@ void HuaweiFusionSolar::readNextRegister()
|
||||
|
||||
bool HuaweiFusionSolar::valuesAreVaild(const QVector<quint16> &values, int readSize)
|
||||
{
|
||||
if (values.count() != readSize) {
|
||||
if (values.length() != readSize) {
|
||||
qCDebug(dcHuaweiFusionSolar()) << "Invalid values. The received values count does not match the requested" << readSize << "registers.";
|
||||
return false;
|
||||
}
|
||||
@ -722,7 +722,7 @@ bool HuaweiFusionSolar::valuesAreVaild(const QVector<quint16> &values, int readS
|
||||
// 0xFFFF: invalid value of a type other than the floating point type returned by one register
|
||||
// 0xFFFFFFFF: invalid value returned by two registers
|
||||
|
||||
if (values.count() == 2) {
|
||||
if (values.length() == 2) {
|
||||
bool floatingPointValid = (values != QVector<quint16>() << 0x7fff << 0xffff);
|
||||
if (!floatingPointValid)
|
||||
qCDebug(dcHuaweiFusionSolar()) << "Invalid values. The received values match the invalid for floating pointer:" << values;
|
||||
@ -734,7 +734,7 @@ bool HuaweiFusionSolar::valuesAreVaild(const QVector<quint16> &values, int readS
|
||||
return floatingPointValid && otherTypesValid;
|
||||
}
|
||||
|
||||
if (values.count() == 1)
|
||||
if (values.length() == 1)
|
||||
return values.at(0) != 0x7fff && values.at(0) != 0xffff;
|
||||
|
||||
return true;
|
||||
|
||||
@ -153,14 +153,14 @@ void HuaweiFusionSolarDiscovery::finishDiscovery()
|
||||
qint64 durationMilliSeconds = QDateTime::currentMSecsSinceEpoch() - m_startDateTime.toMSecsSinceEpoch();
|
||||
|
||||
// Fill in finished network device information
|
||||
for (int i = 0; i < m_results.count(); i++)
|
||||
for (int i = 0; i < m_results.length(); i++)
|
||||
m_results[i].networkDeviceInfo = m_networkDeviceInfos.get(m_results.value(i).address);
|
||||
|
||||
// Cleanup any leftovers...we don't care any more
|
||||
foreach (HuaweiFusionSolar *connection, m_connections)
|
||||
cleanupConnection(connection);
|
||||
|
||||
qCInfo(dcHuawei()) << "Discovery: Finished the discovery process. Found" << m_results.count()
|
||||
qCInfo(dcHuawei()) << "Discovery: Finished the discovery process. Found" << m_results.length()
|
||||
<< "inverters in" << QTime::fromMSecsSinceStartOfDay(durationMilliSeconds).toString("mm:ss.zzz");
|
||||
|
||||
emit discoveryFinished();
|
||||
|
||||
@ -884,7 +884,7 @@ void IntegrationPluginHuawei::evaluateEnergyProducedValue(Thing *inverterThing,
|
||||
|
||||
int historyMaxSize = 3;
|
||||
int absurdlyHighValueLimit= 25000000;
|
||||
int historySize = m_inverterEnergyProducedHistory.value(inverterThing).count();
|
||||
int historySize = m_inverterEnergyProducedHistory.value(inverterThing).length();
|
||||
|
||||
if (historySize > historyMaxSize) {
|
||||
m_inverterEnergyProducedHistory[inverterThing].removeFirst();
|
||||
|
||||
@ -51,7 +51,7 @@ void IntegrationPluginIdm::discoverThings(ThingDiscoveryInfo *info)
|
||||
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, discoveryReply, &NetworkDeviceDiscoveryReply::deleteLater);
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [this, discoveryReply, info](){
|
||||
qCDebug(dcIdm()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
||||
qCDebug(dcIdm()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().length() << "devices";
|
||||
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
||||
qCDebug(dcIdm()) << networkDeviceInfo;
|
||||
QString title;
|
||||
|
||||
@ -53,7 +53,7 @@ void IntegrationPluginInro::discoverThings(ThingDiscoveryInfo *info)
|
||||
|
||||
// Check if we already have set up this device
|
||||
Things existingThings = myThings().filterByParam(pantaboxThingSerialNumberParamTypeId, result.deviceInfo.serialNumber);
|
||||
if (existingThings.count() == 1) {
|
||||
if (existingThings.length() == 1) {
|
||||
qCDebug(dcInro()) << "This PANTABOX already exists in the system:" << result.deviceInfo.serialNumber << result.deviceInfo.ipAddress.toString();
|
||||
descriptor.setThingId(existingThings.first()->id());
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ void PantaboxDiscovery::finishDiscovery()
|
||||
foreach (Pantabox *connection, m_connections)
|
||||
cleanupConnection(connection);
|
||||
|
||||
qCInfo(dcInro()) << "Discovery: Finished the discovery process. Found" << m_results.count()
|
||||
qCInfo(dcInro()) << "Discovery: Finished the discovery process. Found" << m_results.length()
|
||||
<< "PANTABOXE wallboxes in" << QTime::fromMSecsSinceStartOfDay(durationMilliSeconds).toString("mm:ss.zzz");
|
||||
|
||||
emit discoveryFinished();
|
||||
|
||||
@ -72,7 +72,7 @@ void IntegrationPluginKostal::discoverThings(ThingDiscoveryInfo *info)
|
||||
|
||||
// Note: we introduced the serial number later, if the current thing has no serialnumber, we use the mac
|
||||
Things existingThings = myThings().filterByParam(kostalInverterThingSerialNumberParamTypeId, result.serialNumber);
|
||||
if (existingThings.count() == 1) {
|
||||
if (existingThings.length() == 1) {
|
||||
qCDebug(dcKostal()) << "This Kostal inverter with this serial number already exists in the system:" << result.networkDeviceInfo;
|
||||
descriptor.setThingId(existingThings.first()->id());
|
||||
}
|
||||
@ -422,7 +422,7 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
|
||||
|
||||
// Update the battery if available
|
||||
Things batteryThings = myThings().filterByParentId(thing->id()).filterByThingClassId(kostalBatteryThingClassId);
|
||||
if (batteryThings.count() == 1) {
|
||||
if (batteryThings.length() == 1) {
|
||||
Thing *batteryThing = batteryThings.first();
|
||||
|
||||
batteryThing->setStateValue(kostalBatteryVoltageStateTypeId, kostalConnection->batteryVoltage());
|
||||
@ -446,7 +446,7 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
|
||||
|
||||
// Update the meter if available
|
||||
Things meterThings = myThings().filterByParentId(thing->id()).filterByThingClassId(kostalMeterThingClassId);
|
||||
if (meterThings.count() == 1) {
|
||||
if (meterThings.length() == 1) {
|
||||
Thing *meterThing = meterThings.first();
|
||||
|
||||
// Current
|
||||
|
||||
@ -52,7 +52,7 @@ void KostalDiscovery::startDiscovery()
|
||||
// Check what might be left on finished
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, discoveryReply, &NetworkDeviceDiscoveryReply::deleteLater);
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||
qCDebug(dcKostal()) << "Discovery: Network discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "network devices";
|
||||
qCDebug(dcKostal()) << "Discovery: Network discovery finished. Found" << discoveryReply->networkDeviceInfos().length() << "network devices";
|
||||
m_networkDeviceInfos = discoveryReply->networkDeviceInfos();
|
||||
|
||||
// Give the last connections added right before the network discovery finished a chance to check the device...
|
||||
@ -152,14 +152,14 @@ void KostalDiscovery::finishDiscovery()
|
||||
qint64 durationMilliSeconds = QDateTime::currentMSecsSinceEpoch() - m_startDateTime.toMSecsSinceEpoch();
|
||||
|
||||
// Fill in all network device infos we have
|
||||
for (int i = 0; i < m_discoveryResults.count(); i++)
|
||||
for (int i = 0; i < m_discoveryResults.length(); i++)
|
||||
m_discoveryResults[i].networkDeviceInfo = m_networkDeviceInfos.get(m_discoveryResults.at(i).address);
|
||||
|
||||
// Cleanup any leftovers...we don't care any more
|
||||
foreach (KostalModbusTcpConnection *connection, m_connections)
|
||||
cleanupConnection(connection);
|
||||
|
||||
qCInfo(dcKostal()) << "Discovery: Finished the discovery process. Found" << m_discoveryResults.count()
|
||||
qCInfo(dcKostal()) << "Discovery: Finished the discovery process. Found" << m_discoveryResults.length()
|
||||
<< "Kostal Inverters in" << QTime::fromMSecsSinceStartOfDay(durationMilliSeconds).toString("mm:ss.zzz");
|
||||
emit discoveryFinished();
|
||||
}
|
||||
|
||||
@ -1,8 +1,21 @@
|
||||
QMAKE_CXXFLAGS += -Werror -std=c++11 -z defs
|
||||
QMAKE_LFLAGS += -std=c++11 -z defs
|
||||
|
||||
QT += network serialbus
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
message("Building using Qt6 support")
|
||||
CONFIG *= c++17
|
||||
QMAKE_LFLAGS *= -std=c++17
|
||||
QMAKE_CXXFLAGS *= -std=c++17
|
||||
} else {
|
||||
message("Building using Qt5 support")
|
||||
CONFIG *= c++11
|
||||
QMAKE_LFLAGS *= -std=c++11
|
||||
QMAKE_CXXFLAGS *= -std=c++11
|
||||
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS += -Werror -z defs
|
||||
QMAKE_LFLAGS += -z defs
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += nymea
|
||||
|
||||
|
||||
@ -54,3 +54,15 @@ for(MODBUS_CONNECTION, MODBUS_CONNECTIONS_INCLUDES) {
|
||||
INCLUDEPATH += $${OUT_PWD}/autogenerated
|
||||
}
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
message("Building using Qt6 support")
|
||||
CONFIG *= c++17
|
||||
QMAKE_LFLAGS *= -std=c++17
|
||||
QMAKE_CXXFLAGS *= -std=c++17
|
||||
} else {
|
||||
message("Building using Qt5 support")
|
||||
CONFIG *= c++11
|
||||
QMAKE_LFLAGS *= -std=c++11
|
||||
QMAKE_CXXFLAGS *= -std=c++11
|
||||
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2021, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -39,21 +39,25 @@ ModbusDataUtils::ModbusDataUtils()
|
||||
|
||||
quint16 ModbusDataUtils::convertToUInt16(const QVector<quint16> ®isters)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 1, "ModbusDataUtils", "invalid raw data size for converting value to quint16");
|
||||
Q_ASSERT_X(registers.length() == 1, "ModbusDataUtils", "invalid raw data size for converting value to quint16");
|
||||
return registers.at(0);
|
||||
}
|
||||
|
||||
qint16 ModbusDataUtils::convertToInt16(const QVector<quint16> ®isters)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 1, "ModbusDataUtils", "invalid raw data size for converting value to qint16");
|
||||
Q_ASSERT_X(registers.length() == 1, "ModbusDataUtils", "invalid raw data size for converting value to qint16");
|
||||
return static_cast<qint16>(registers.at(0));
|
||||
}
|
||||
|
||||
quint32 ModbusDataUtils::convertToUInt32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "ModbusDataUtils", "invalid raw data size for converting value to quint32");
|
||||
Q_ASSERT_X(registers.length() == 2, "ModbusDataUtils", "invalid raw data size for converting value to quint32");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -62,7 +66,11 @@ quint32 ModbusDataUtils::convertToUInt32(const QVector<quint16> ®isters, Byte
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
quint32 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -70,9 +78,13 @@ quint32 ModbusDataUtils::convertToUInt32(const QVector<quint16> ®isters, Byte
|
||||
|
||||
qint32 ModbusDataUtils::convertToInt32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "ModbusDataUtils", "invalid raw data size for converting value to quint32");
|
||||
Q_ASSERT_X(registers.length() == 2, "ModbusDataUtils", "invalid raw data size for converting value to quint32");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -81,7 +93,11 @@ qint32 ModbusDataUtils::convertToInt32(const QVector<quint16> ®isters, ByteOr
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
qint32 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -89,9 +105,13 @@ qint32 ModbusDataUtils::convertToInt32(const QVector<quint16> ®isters, ByteOr
|
||||
|
||||
quint64 ModbusDataUtils::convertToUInt64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 4, "ModbusDataUtils", "invalid raw data size for converting value to quint64");
|
||||
Q_ASSERT_X(registers.length() == 4, "ModbusDataUtils", "invalid raw data size for converting value to quint64");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -104,7 +124,11 @@ quint64 ModbusDataUtils::convertToUInt64(const QVector<quint16> ®isters, Byte
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
quint64 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -112,9 +136,13 @@ quint64 ModbusDataUtils::convertToUInt64(const QVector<quint16> ®isters, Byte
|
||||
|
||||
qint64 ModbusDataUtils::convertToInt64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 4, "ModbusDataUtils", "invalid raw data size for converting value to qint64");
|
||||
Q_ASSERT_X(registers.length() == 4, "ModbusDataUtils", "invalid raw data size for converting value to qint64");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -127,7 +155,12 @@ qint64 ModbusDataUtils::convertToInt64(const QVector<quint16> ®isters, ByteOr
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
qint64 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -136,10 +169,14 @@ qint64 ModbusDataUtils::convertToInt64(const QVector<quint16> ®isters, ByteOr
|
||||
QString ModbusDataUtils::convertToString(const QVector<quint16> ®isters, ByteOrder characterByteOrder)
|
||||
{
|
||||
QByteArray bytes;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream stream(&bytes, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
#endif
|
||||
// Note: some devices use little endian within the register uint16 representation of the 2 characters.
|
||||
stream.setByteOrder(characterByteOrder == ByteOrderBigEndian ? QDataStream::BigEndian : QDataStream::LittleEndian);
|
||||
for (int i = 0; i < registers.count(); i++) {
|
||||
for (int i = 0; i < registers.length(); i++) {
|
||||
stream << registers.at(i);
|
||||
}
|
||||
|
||||
@ -149,8 +186,12 @@ QString ModbusDataUtils::convertToString(const QVector<quint16> ®isters, Byte
|
||||
QByteArray ModbusDataUtils::convertToByteArray(const QVector<quint16> ®isters)
|
||||
{
|
||||
QByteArray bytes;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream stream(&bytes, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
for (int i = 0; i < registers.count(); i++) {
|
||||
#endif
|
||||
for (int i = 0; i < registers.length(); i++) {
|
||||
stream << registers.at(i);
|
||||
}
|
||||
return bytes;
|
||||
@ -158,7 +199,7 @@ QByteArray ModbusDataUtils::convertToByteArray(const QVector<quint16> ®isters
|
||||
|
||||
float ModbusDataUtils::convertToFloat32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "ModbusDataUtils", "invalid raw data size for converting value to float32");
|
||||
Q_ASSERT_X(registers.length() == 2, "ModbusDataUtils", "invalid raw data size for converting value to float32");
|
||||
quint32 rawValue = ModbusDataUtils::convertToUInt32(registers, byteOrder);
|
||||
float value = 0;
|
||||
memcpy(&value, &rawValue, sizeof(quint32));
|
||||
@ -168,7 +209,7 @@ float ModbusDataUtils::convertToFloat32(const QVector<quint16> ®isters, ByteO
|
||||
double ModbusDataUtils::convertToFloat64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
|
||||
Q_ASSERT_X(registers.count() == 4, "ModbusDataUtils", "invalid raw data size for converting value to float64");
|
||||
Q_ASSERT_X(registers.length() == 4, "ModbusDataUtils", "invalid raw data size for converting value to float64");
|
||||
quint64 rawValue = ModbusDataUtils::convertToUInt64(registers, byteOrder);
|
||||
double value = 0;
|
||||
memcpy(&value, &rawValue, sizeof(quint64));
|
||||
@ -188,10 +229,18 @@ QVector<quint16> ModbusDataUtils::convertFromInt16(qint16 value)
|
||||
QVector<quint16> ModbusDataUtils::convertFromUInt32(quint32 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -214,10 +263,18 @@ QVector<quint16> ModbusDataUtils::convertFromInt32(qint32 value, ByteOrder byteO
|
||||
QVector<quint16> ModbusDataUtils::convertFromUInt64(quint64 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -234,10 +291,18 @@ QVector<quint16> ModbusDataUtils::convertFromUInt64(quint64 value, ByteOrder byt
|
||||
QVector<quint16> ModbusDataUtils::convertFromInt64(qint64 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -254,8 +319,12 @@ QVector<quint16> ModbusDataUtils::convertFromInt64(qint64 value, ByteOrder byteO
|
||||
QVector<quint16> ModbusDataUtils::convertFromString(const QString &value, quint16 stringLength, ByteOrder characterByteOrder)
|
||||
{
|
||||
Q_ASSERT_X(value.length() <= stringLength, "ModbusDataUtils", "cannot convert a string which is bigger than the desired register vector.");
|
||||
QByteArray data = value.toLatin1() + QByteArray('\0', stringLength - value.count());
|
||||
QByteArray data = value.toLatin1() + QByteArray('\0', stringLength - value.length());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream stream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream stream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
// Note: some devices use little endian within the register uint16 representation of the 2 characters.
|
||||
stream.setByteOrder(characterByteOrder == ByteOrderBigEndian ? QDataStream::BigEndian : QDataStream::LittleEndian);
|
||||
QVector<quint16> values;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2021, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -34,6 +34,7 @@
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
#include <QModbusPdu>
|
||||
#include <QMetaObject>
|
||||
#include <QModbusDataUnit>
|
||||
|
||||
class ModbusDataUtils
|
||||
|
||||
@ -44,7 +44,7 @@ ModbusTcpMaster::ModbusTcpMaster(const QHostAddress &hostAddress, uint port, QOb
|
||||
m_modbusTcpClient->setNumberOfRetries(m_numberOfRetries);
|
||||
|
||||
connect(m_modbusTcpClient, &QModbusTcpClient::stateChanged, this, &ModbusTcpMaster::onModbusStateChanged);
|
||||
connect(m_modbusTcpClient, &QModbusRtuSerialMaster::errorOccurred, this, &ModbusTcpMaster::onModbusErrorOccurred);
|
||||
connect(m_modbusTcpClient, &QModbusTcpClient::errorOccurred, this, &ModbusTcpMaster::onModbusErrorOccurred);
|
||||
|
||||
m_reconnectTimer = new QTimer(this);
|
||||
m_reconnectTimer->setSingleShot(true);
|
||||
|
||||
@ -80,9 +80,9 @@ def writePropertyGetSetDataUnitImplementationsTcp(fileDescriptor, className, reg
|
||||
|
||||
writeLine(fileDescriptor, ' QVector<quint16> values = %s;' % getConversionToValueMethod(registerDefinition))
|
||||
if registerDefinition['registerType'] == 'holdingRegister':
|
||||
writeLine(fileDescriptor, ' QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, %s, values.count());' % (registerDefinition['address']))
|
||||
writeLine(fileDescriptor, ' QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, %s, values.length());' % (registerDefinition['address']))
|
||||
elif registerDefinition['registerType'] == 'coils':
|
||||
writeLine(fileDescriptor, ' QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, %s, values.count());' % (registerDefinition['address']))
|
||||
writeLine(fileDescriptor, ' QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, %s, values.length());' % (registerDefinition['address']))
|
||||
else:
|
||||
logger.warning('Error: invalid register type for writing.')
|
||||
exit(1)
|
||||
@ -831,7 +831,7 @@ def writeUpdateMethodTcp(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor)
|
||||
|
||||
writeLine(fileDescriptor, ' if (!m_updateRequestQueue.isEmpty()) {')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Tried to update but there are still some update requests pending. Waiting for them to be finished..." << m_updateRequestQueue.count();' % className)
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Tried to update but there are still some update requests pending. Waiting for them to be finished..." << m_updateRequestQueue.length();' % className)
|
||||
writeLine(fileDescriptor, ' sendNextQueuedRequest();')
|
||||
writeLine(fileDescriptor, ' return true;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
|
||||
@ -1,8 +1,20 @@
|
||||
QMAKE_CXXFLAGS += -Werror -std=c++11 -z defs
|
||||
QMAKE_LFLAGS += -std=c++11
|
||||
|
||||
QT += network serialbus
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
message("Building using Qt6 support")
|
||||
CONFIG *= c++17
|
||||
QMAKE_LFLAGS *= -std=c++17
|
||||
QMAKE_CXXFLAGS *= -std=c++17
|
||||
} else {
|
||||
message("Building using Qt5 support")
|
||||
CONFIG *= c++11
|
||||
QMAKE_LFLAGS *= -std=c++11
|
||||
QMAKE_CXXFLAGS *= -std=c++11
|
||||
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS += -Werror -z defs
|
||||
|
||||
TARGET = nymea-sunspec1
|
||||
TEMPLATE = lib
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ void SunSpecConnection::processDiscoveryResult()
|
||||
qCDebug(dcSunSpec()) << "Sorted model list:";
|
||||
SunSpecCommonModel *currentCommonModel = nullptr;
|
||||
SunSpecModel::CommonModelInfo commonModelInfo;
|
||||
for (int i = 0; i < m_models.count(); i++) {
|
||||
for (int i = 0; i < m_models.length(); i++) {
|
||||
SunSpecModel *model = m_models.at(i);
|
||||
qCDebug(dcSunSpec()) << "-->" << model;
|
||||
if (model->modelId() == SunSpecModelFactory::ModelIdCommon) {
|
||||
@ -467,7 +467,7 @@ void SunSpecConnection::scanModelsOnBaseRegister(quint16 offset)
|
||||
} else {
|
||||
qCWarning(dcSunSpec()) << "Error occurred while reading model header from" << this << "using offset" << offset << m_modbusTcpClient->errorString();
|
||||
if (!m_modelDiscoveryResult.isEmpty()) {
|
||||
qCWarning(dcSunSpec()) << "Error occurred but already discovered" << m_modelDiscoveryResult.count() << "models. Continue with the discovered models, but the discovery may be incomplete due to header reading errors.";
|
||||
qCWarning(dcSunSpec()) << "Error occurred but already discovered" << m_modelDiscoveryResult.length() << "models. Continue with the discovered models, but the discovery may be incomplete due to header reading errors.";
|
||||
qCDebug(dcSunSpec()) << "Scan for SunSpec models on" << this << m_baseRegister << "finished successfully";
|
||||
processDiscoveryResult();
|
||||
} else {
|
||||
|
||||
@ -261,7 +261,7 @@ bool SunSpecDataPoint::isValid() const
|
||||
break;
|
||||
case DataType::String: {
|
||||
bool isNull = true;
|
||||
for (int i = 0; i < m_rawData.count(); i++) {
|
||||
for (int i = 0; i < m_rawData.length(); i++) {
|
||||
if (m_rawData.at(i) != 0x0000) {
|
||||
isNull = false;
|
||||
valid = true;
|
||||
@ -416,7 +416,7 @@ double SunSpecDataPoint::toDouble() const
|
||||
QString SunSpecDataPoint::registersToString(const QVector<quint16> ®isters)
|
||||
{
|
||||
QStringList valueStrings;
|
||||
for (int i = 0; i < registers.count(); i++) {
|
||||
for (int i = 0; i < registers.length(); i++) {
|
||||
QString hexString(QStringLiteral("0x%1"));
|
||||
valueStrings.append(hexString.arg(registers.at(i), 4, 16, QLatin1Char('0')));
|
||||
}
|
||||
@ -427,21 +427,25 @@ QString SunSpecDataPoint::registersToString(const QVector<quint16> ®isters)
|
||||
|
||||
quint16 SunSpecDataPoint::convertToUInt16(const QVector<quint16> ®isters)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 1, "SunSpecDataPoint", "invalid raw data size for converting value to quint16");
|
||||
Q_ASSERT_X(registers.length() == 1, "SunSpecDataPoint", "invalid raw data size for converting value to quint16");
|
||||
return registers.at(0);
|
||||
}
|
||||
|
||||
qint16 SunSpecDataPoint::convertToInt16(const QVector<quint16> ®isters)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 1, "SunSpecDataPoint", "invalid raw data size for converting value to qint16");
|
||||
Q_ASSERT_X(registers.length() == 1, "SunSpecDataPoint", "invalid raw data size for converting value to qint16");
|
||||
return static_cast<qint16>(registers.at(0));
|
||||
}
|
||||
|
||||
quint32 SunSpecDataPoint::convertToUInt32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to quint32");
|
||||
Q_ASSERT_X(registers.length() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to quint32");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -450,7 +454,11 @@ quint32 SunSpecDataPoint::convertToUInt32(const QVector<quint16> ®isters, Byt
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
quint32 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -458,9 +466,13 @@ quint32 SunSpecDataPoint::convertToUInt32(const QVector<quint16> ®isters, Byt
|
||||
|
||||
qint32 SunSpecDataPoint::convertToInt32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to quint32");
|
||||
Q_ASSERT_X(registers.length() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to quint32");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -469,7 +481,11 @@ qint32 SunSpecDataPoint::convertToInt32(const QVector<quint16> ®isters, ByteO
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
qint32 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -477,9 +493,13 @@ qint32 SunSpecDataPoint::convertToInt32(const QVector<quint16> ®isters, ByteO
|
||||
|
||||
quint64 SunSpecDataPoint::convertToUInt64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to quint64");
|
||||
Q_ASSERT_X(registers.length() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to quint64");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -492,7 +512,11 @@ quint64 SunSpecDataPoint::convertToUInt64(const QVector<quint16> ®isters, Byt
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
quint64 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -500,9 +524,13 @@ quint64 SunSpecDataPoint::convertToUInt64(const QVector<quint16> ®isters, Byt
|
||||
|
||||
qint64 SunSpecDataPoint::convertToInt64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to qint64");
|
||||
Q_ASSERT_X(registers.length() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to qint64");
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
if (byteOrder == ByteOrderBigEndian) {
|
||||
inputStream << registers.at(0);
|
||||
inputStream << registers.at(1);
|
||||
@ -515,7 +543,11 @@ qint64 SunSpecDataPoint::convertToInt64(const QVector<quint16> ®isters, ByteO
|
||||
inputStream << registers.at(0);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
qint64 result = 0;
|
||||
outputStream >> result;
|
||||
return result;
|
||||
@ -524,8 +556,12 @@ qint64 SunSpecDataPoint::convertToInt64(const QVector<quint16> ®isters, ByteO
|
||||
QString SunSpecDataPoint::convertToString(const QVector<quint16> ®isters)
|
||||
{
|
||||
QByteArray bytes;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream stream(&bytes, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
for (int i = 0; i < registers.count(); i++) {
|
||||
#endif
|
||||
for (int i = 0; i < registers.length(); i++) {
|
||||
stream << registers.at(i);
|
||||
}
|
||||
|
||||
@ -534,7 +570,7 @@ QString SunSpecDataPoint::convertToString(const QVector<quint16> ®isters)
|
||||
|
||||
float SunSpecDataPoint::convertToFloat32(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to float32");
|
||||
Q_ASSERT_X(registers.length() == 2, "SunSpecDataPoint", "invalid raw data size for converting value to float32");
|
||||
quint32 rawValue = SunSpecDataPoint::convertToUInt32(registers, byteOrder);
|
||||
float value = 0;
|
||||
memcpy(&value, &rawValue, sizeof(quint32));
|
||||
@ -543,7 +579,7 @@ float SunSpecDataPoint::convertToFloat32(const QVector<quint16> ®isters, Byte
|
||||
|
||||
double SunSpecDataPoint::convertToFloat64(const QVector<quint16> ®isters, ByteOrder byteOrder)
|
||||
{
|
||||
Q_ASSERT_X(registers.count() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to float64");
|
||||
Q_ASSERT_X(registers.length() == 4, "SunSpecDataPoint", "invalid raw data size for converting value to float64");
|
||||
quint64 rawValue = SunSpecDataPoint::convertToUInt64(registers, byteOrder);
|
||||
double value = 0;
|
||||
memcpy(&value, &rawValue, sizeof(quint64));
|
||||
@ -563,10 +599,18 @@ QVector<quint16> SunSpecDataPoint::convertFromInt16(qint16 value)
|
||||
QVector<quint16> SunSpecDataPoint::convertFromUInt32(quint32 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -588,10 +632,18 @@ QVector<quint16> SunSpecDataPoint::convertFromInt32(qint32 value, ByteOrder byte
|
||||
QVector<quint16> SunSpecDataPoint::convertFromUInt64(quint64 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -608,10 +660,18 @@ QVector<quint16> SunSpecDataPoint::convertFromUInt64(quint64 value, ByteOrder by
|
||||
QVector<quint16> SunSpecDataPoint::convertFromInt64(qint64 value, ByteOrder byteOrder)
|
||||
{
|
||||
QByteArray data;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream inputStream(&data, QDataStream::WriteOnly);
|
||||
#else
|
||||
QDataStream inputStream(&data, QIODevice::WriteOnly);
|
||||
#endif
|
||||
inputStream << value;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream outputStream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream outputStream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quint16 registerValue = 0;
|
||||
@ -628,8 +688,12 @@ QVector<quint16> SunSpecDataPoint::convertFromInt64(qint64 value, ByteOrder byte
|
||||
QVector<quint16> SunSpecDataPoint::convertFromString(const QString &value, quint16 stringLength)
|
||||
{
|
||||
Q_ASSERT_X(value.length() <= stringLength, "SunSpecDataPoint", "cannot convert a string which is bigger than the desired register vector.");
|
||||
QByteArray data = value.toLatin1() + QByteArray('\0', stringLength - value.count());
|
||||
QByteArray data = value.toLatin1() + QByteArray('\0', stringLength - value.length());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QDataStream stream(&data, QDataStream::ReadOnly);
|
||||
#else
|
||||
QDataStream stream(&data, QIODevice::ReadOnly);
|
||||
#endif
|
||||
QVector<quint16> values;
|
||||
for (int i = 0; i < stringLength; i++) {
|
||||
quint16 registerValue = 0;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2020, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -31,9 +31,10 @@
|
||||
#ifndef SUNSPECDATAPOINT_H
|
||||
#define SUNSPECDATAPOINT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QMetaObject>
|
||||
|
||||
class SunSpecDataPoint
|
||||
{
|
||||
|
||||
@ -126,12 +126,12 @@ void SunSpecModel::readBlockData()
|
||||
}
|
||||
|
||||
const QModbusDataUnit unit = reply->result();
|
||||
qCDebug(dcSunSpecModelData()) << "-->" << "Received block data" << this << unit.values().count() << SunSpecDataPoint::registersToString(unit.values());
|
||||
qCDebug(dcSunSpecModelData()) << "-->" << "Received block data" << this << unit.values().length() << SunSpecDataPoint::registersToString(unit.values());
|
||||
m_blockData = unit.values();
|
||||
emit blockDataChanged(m_blockData);
|
||||
|
||||
if (m_blockData.count() != m_modelLength + 2) {
|
||||
qCWarning(dcSunSpecModelData()) << "Received invalid block data count from read block data request. Model lenght:" << m_modelLength << "Response block count:" << m_blockData.count();
|
||||
if (m_blockData.length() != m_modelLength + 2) {
|
||||
qCWarning(dcSunSpecModelData()) << "Received invalid block data count from read block data request. Model lenght:" << m_modelLength << "Response block count:" << m_blockData.length();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2023, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
#include <modbusdatautils.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
QList<int> slaveIdCandidates = {50, 11, 12, 13, 14};
|
||||
|
||||
AmtronCompact20Discovery::AmtronCompact20Discovery(ModbusRtuHardwareResource *modbusRtuResource, QObject *parent):
|
||||
@ -83,7 +85,7 @@ void AmtronCompact20Discovery::tryConnect(ModbusRtuMaster *master, quint16 slave
|
||||
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
|
||||
QString serialNumber = ModbusDataUtils::convertToString(reply->result(), ModbusDataUtils::ByteOrderBigEndian).remove(QRegExp("^_*"));
|
||||
QString serialNumber = ModbusDataUtils::convertToString(reply->result(), ModbusDataUtils::ByteOrderBigEndian).remove(QRegularExpression("^_*"));
|
||||
qCDebug(dcMennekes()) << "Test reply finished!" << reply->error() << serialNumber;
|
||||
|
||||
Result result {master->modbusUuid(), serialNumber, slaveId};
|
||||
@ -91,7 +93,7 @@ void AmtronCompact20Discovery::tryConnect(ModbusRtuMaster *master, quint16 slave
|
||||
|
||||
}
|
||||
|
||||
if (slaveIdIndex < slaveIdCandidates.count() - 1) {
|
||||
if (slaveIdIndex < slaveIdCandidates.length() - 1) {
|
||||
tryConnect(master, slaveIdIndex+1);
|
||||
} else {
|
||||
emit discoveryFinished(true);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user