fixed Fronius plug-in
This commit is contained in:
parent
89df596427
commit
68e38a1eaf
@ -56,7 +56,7 @@ QUrl FroniusInverter::updateUrl()
|
|||||||
requestUrl.setHost(hostAddress());
|
requestUrl.setHost(hostAddress());
|
||||||
requestUrl.setPath(baseUrl() + "GetInverterRealtimeData.cgi");
|
requestUrl.setPath(baseUrl() + "GetInverterRealtimeData.cgi");
|
||||||
query.addQueryItem("Scope", "Device");
|
query.addQueryItem("Scope", "Device");
|
||||||
query.addQueryItem("DeviceId", thingId());
|
query.addQueryItem("DeviceId", deviceId());
|
||||||
query.addQueryItem("DataCollection", "CommonInverterData");
|
query.addQueryItem("DataCollection", "CommonInverterData");
|
||||||
requestUrl.setQuery(query);
|
requestUrl.setQuery(query);
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ QUrl FroniusMeter::updateUrl()
|
|||||||
requestUrl.setHost(hostAddress());
|
requestUrl.setHost(hostAddress());
|
||||||
requestUrl.setPath(baseUrl() + "GetMeterRealtimeData.cgi");
|
requestUrl.setPath(baseUrl() + "GetMeterRealtimeData.cgi");
|
||||||
query.addQueryItem("Scope", "Device");
|
query.addQueryItem("Scope", "Device");
|
||||||
query.addQueryItem("DeviceId", thingId());
|
query.addQueryItem("DeviceId", deviceId());
|
||||||
requestUrl.setQuery(query);
|
requestUrl.setQuery(query);
|
||||||
return requestUrl;
|
return requestUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ QUrl FroniusStorage::updateUrl()
|
|||||||
requestUrl.setHost(hostAddress());
|
requestUrl.setHost(hostAddress());
|
||||||
requestUrl.setPath(baseUrl() + "GetStorageRealtimeData.cgi");
|
requestUrl.setPath(baseUrl() + "GetStorageRealtimeData.cgi");
|
||||||
query.addQueryItem("Scope", "Device");
|
query.addQueryItem("Scope", "Device");
|
||||||
query.addQueryItem("DeviceId", thingId());
|
query.addQueryItem("DeviceId", deviceId());
|
||||||
requestUrl.setQuery(query);
|
requestUrl.setQuery(query);
|
||||||
|
|
||||||
return requestUrl;
|
return requestUrl;
|
||||||
|
|||||||
@ -1,22 +1,32 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
*
|
||||||
* Copyright (C) 2016 Christian Stachowitz *
|
* Copyright 2013 - 2020, nymea GmbH
|
||||||
* *
|
* Contact: contact@nymea.io
|
||||||
* This file is part of guh. *
|
*
|
||||||
* *
|
* This file is part of nymea.
|
||||||
* Guh is free software: you can redistribute it and/or modify *
|
* This project including source code and documentation is protected by
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* copyright law, and remains the property of nymea GmbH. All rights, including
|
||||||
* the Free Software Foundation, version 2 of the License. *
|
* reproduction, publication, editing and translation, are reserved. The use of
|
||||||
* *
|
* this project is subject to the terms of a license agreement to be concluded
|
||||||
* Guh is distributed in the hope that it will be useful, *
|
* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* under https://nymea.io/license
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
*
|
||||||
* GNU General Public License for more details. *
|
* GNU Lesser General Public License Usage
|
||||||
* *
|
* Alternatively, this project may be redistributed and/or modified under the
|
||||||
* You should have received a copy of the GNU General Public License *
|
* terms of the GNU Lesser General Public License as published by the Free
|
||||||
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
|
* Software Foundation; version 3. This project is distributed in the hope that
|
||||||
* *
|
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this project. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* For any further details and any questions please contact us under
|
||||||
|
* contact@nymea.io or see our FAQ/Licensing Information on
|
||||||
|
* https://nymea.io/license/faq
|
||||||
|
*
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "froniusthing.h"
|
#include "froniusthing.h"
|
||||||
|
|
||||||
@ -76,12 +86,12 @@ void FroniusThing::setUniqueId(const QString &uniqueId)
|
|||||||
m_uniqueId = uniqueId;
|
m_uniqueId = uniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FroniusThing::thingId() const
|
QString FroniusThing::deviceId() const
|
||||||
{
|
{
|
||||||
return m_thingId;
|
return m_thingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FroniusThing::setThingId(const QString &thingId)
|
void FroniusThing::setDeviceId(const QString &thingId)
|
||||||
{
|
{
|
||||||
m_thingId = thingId;
|
m_thingId = thingId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,8 +60,8 @@ public:
|
|||||||
QString uniqueId() const;
|
QString uniqueId() const;
|
||||||
void setUniqueId(const QString &uniqueId);
|
void setUniqueId(const QString &uniqueId);
|
||||||
|
|
||||||
QString thingId() const;
|
QString deviceId() const;
|
||||||
void setThingId(const QString &thingId);
|
void setDeviceId(const QString &deviceId);
|
||||||
|
|
||||||
Thing* pluginThing() const;
|
Thing* pluginThing() const;
|
||||||
|
|
||||||
|
|||||||
@ -63,10 +63,14 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform a HTTP request on the given IPv4Address to find things
|
// Perform a HTTP request on the given IPv4Address to find things
|
||||||
QUrl url(QString("http://%1/solar_api/GetAPIVersion.cgi").arg(thing->paramValue(dataloggerThingLoggerHostParamTypeId).toString()));
|
QUrl requestUrl;
|
||||||
qCDebug(dcFronius()) << "Search at address" << url.toString();
|
requestUrl.setScheme("http");
|
||||||
|
requestUrl.setHost(thing->paramValue(dataloggerThingLoggerHostParamTypeId).toString());
|
||||||
|
requestUrl.setPath("/solar_api/GetAPIVersion.cgi");
|
||||||
|
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(url));
|
qCDebug(dcFronius()) << "Search at address" << requestUrl.toString();
|
||||||
|
|
||||||
|
QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(requestUrl));
|
||||||
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
||||||
connect(reply, &QNetworkReply::finished, [this, info, thing, reply]() {
|
connect(reply, &QNetworkReply::finished, [this, info, thing, reply]() {
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
@ -92,18 +96,14 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
m_froniusLoggers.insert(newLogger, thing);
|
m_froniusLoggers.insert(newLogger, thing);
|
||||||
|
|
||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
// FIX ME: remove after testing
|
|
||||||
//searchNewThings(m_froniusLoggers.key(thing));
|
|
||||||
//updateThingStates(thing);
|
|
||||||
});
|
});
|
||||||
//Async Setup
|
//Async Setup
|
||||||
} else if (thing->thingClassId() == inverterThingClassId) {
|
} else if (thing->thingClassId() == inverterThingClassId) {
|
||||||
|
|
||||||
FroniusInverter *newInverter = new FroniusInverter(thing,this);
|
FroniusInverter *newInverter = new FroniusInverter(thing,this);
|
||||||
newInverter->setThingId(thing->paramValue(inverterThingIdParamTypeId).toString());
|
newInverter->setDeviceId(thing->paramValue(inverterThingIdParamTypeId).toString());
|
||||||
newInverter->setName(thing->paramValue(inverterThingNameParamTypeId).toString());
|
newInverter->setName(thing->paramValue(inverterThingNameParamTypeId).toString());
|
||||||
newInverter->setBaseUrl(thing->paramValue(inverterThingBaseParamTypeId).toString());
|
newInverter->setBaseUrl(thing->paramValue(inverterThingBaseParamTypeId).toString());
|
||||||
newInverter->setHostId(thing->paramValue(inverterThingHostIdParamTypeId).toString());
|
|
||||||
newInverter->setHostAddress(thing->paramValue(inverterThingHostParamTypeId).toString());
|
newInverter->setHostAddress(thing->paramValue(inverterThingHostParamTypeId).toString());
|
||||||
|
|
||||||
m_froniusInverters.insert(newInverter,thing);
|
m_froniusInverters.insert(newInverter,thing);
|
||||||
@ -141,9 +141,9 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
// Check reply information
|
// Check reply information
|
||||||
QVariantMap dataMap = jsonDoc.toVariant().toMap().value("Body").toMap().value("Data").toMap();
|
QVariantMap dataMap = jsonDoc.toVariant().toMap().value("Body").toMap().value("Data").toMap();
|
||||||
// check for thing id in reply
|
// check for thing id in reply
|
||||||
if (dataMap.contains(newInverter->thingId())) {
|
if (dataMap.contains(newInverter->deviceId())) {
|
||||||
qCDebug(dcFronius()) << "Found Thing with unique:" << dataMap.value(newInverter->thingId()).toMap().value("UniqueID").toString();
|
qCDebug(dcFronius()) << "Found Thing with unique:" << dataMap.value(newInverter->deviceId()).toMap().value("UniqueID").toString();
|
||||||
newInverter->setUniqueId(dataMap.value(newInverter->thingId()).toMap().value("UniqueID").toString());
|
newInverter->setUniqueId(dataMap.value(newInverter->deviceId()).toMap().value("UniqueID").toString());
|
||||||
newInverter->pluginThing()->setParamValue(inverterThingUniqueIdParamTypeId,newInverter->uniqueId());
|
newInverter->pluginThing()->setParamValue(inverterThingUniqueIdParamTypeId,newInverter->uniqueId());
|
||||||
qCDebug(dcFronius()) << "Stored unique ID:" << newInverter->uniqueId();
|
qCDebug(dcFronius()) << "Stored unique ID:" << newInverter->uniqueId();
|
||||||
}
|
}
|
||||||
@ -153,10 +153,9 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
} else if (thing->thingClassId() == storageThingClassId) {
|
} else if (thing->thingClassId() == storageThingClassId) {
|
||||||
|
|
||||||
FroniusStorage *newStorage = new FroniusStorage(thing, this);
|
FroniusStorage *newStorage = new FroniusStorage(thing, this);
|
||||||
newStorage->setThingId(thing->paramValue(storageThingIdParamTypeId).toString());
|
newStorage->setDeviceId(thing->paramValue(storageThingIdParamTypeId).toString());
|
||||||
newStorage->setName(thing->paramValue(storageThingNameParamTypeId).toString());
|
newStorage->setName(thing->paramValue(storageThingNameParamTypeId).toString());
|
||||||
newStorage->setBaseUrl(thing->paramValue(storageThingBaseParamTypeId).toString());
|
newStorage->setBaseUrl(thing->paramValue(storageThingBaseParamTypeId).toString());
|
||||||
newStorage->setHostId(thing->paramValue(storageThingHostIdParamTypeId).toString());
|
|
||||||
newStorage->setHostAddress(thing->paramValue(storageThingHostParamTypeId).toString());
|
newStorage->setHostAddress(thing->paramValue(storageThingHostParamTypeId).toString());
|
||||||
|
|
||||||
m_froniusStorages.insert(newStorage,thing);
|
m_froniusStorages.insert(newStorage,thing);
|
||||||
@ -170,8 +169,8 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
requestUrl.setScheme("http");
|
requestUrl.setScheme("http");
|
||||||
requestUrl.setHost(newStorage->hostAddress());
|
requestUrl.setHost(newStorage->hostAddress());
|
||||||
requestUrl.setPath(newStorage->baseUrl() + "GetStorageRealtimeData.cgi");
|
requestUrl.setPath(newStorage->baseUrl() + "GetStorageRealtimeData.cgi");
|
||||||
query.addQueryItem("Scope","Thing");
|
query.addQueryItem("Scope","Device");
|
||||||
query.addQueryItem("ThingId",newStorage->thingId());
|
query.addQueryItem("DeviceId", newStorage->deviceId());
|
||||||
requestUrl.setQuery(query);
|
requestUrl.setQuery(query);
|
||||||
qCDebug(dcFronius()) << "Get Storage Data at address" << requestUrl.toString();
|
qCDebug(dcFronius()) << "Get Storage Data at address" << requestUrl.toString();
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(requestUrl));
|
QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(requestUrl));
|
||||||
@ -205,10 +204,9 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
} else if (thing->thingClassId() == meterThingClassId) {
|
} else if (thing->thingClassId() == meterThingClassId) {
|
||||||
|
|
||||||
FroniusMeter *newMeter = new FroniusMeter(thing, this);;
|
FroniusMeter *newMeter = new FroniusMeter(thing, this);;
|
||||||
newMeter->setThingId(thing->paramValue(meterThingIdParamTypeId).toString());
|
newMeter->setDeviceId(thing->paramValue(meterThingIdParamTypeId).toString());
|
||||||
newMeter->setName(thing->paramValue(meterThingNameParamTypeId).toString());
|
newMeter->setName(thing->paramValue(meterThingNameParamTypeId).toString());
|
||||||
newMeter->setBaseUrl(thing->paramValue(meterThingBaseParamTypeId).toString());
|
newMeter->setBaseUrl(thing->paramValue(meterThingBaseParamTypeId).toString());
|
||||||
newMeter->setHostId(thing->paramValue(meterThingHostIdParamTypeId).toString());
|
|
||||||
newMeter->setHostAddress(thing->paramValue(meterThingHostParamTypeId).toString());
|
newMeter->setHostAddress(thing->paramValue(meterThingHostParamTypeId).toString());
|
||||||
|
|
||||||
m_froniusMeters.insert(newMeter,thing);
|
m_froniusMeters.insert(newMeter,thing);
|
||||||
@ -227,31 +225,30 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginFronius::init()
|
|
||||||
{
|
|
||||||
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(30);
|
|
||||||
connect(m_pluginTimer, &PluginTimer::timeout, this, [this]() {
|
|
||||||
foreach (Thing *logger, m_froniusLoggers)
|
|
||||||
updateThingStates(logger);
|
|
||||||
|
|
||||||
foreach (Thing *inverter, m_froniusInverters)
|
|
||||||
updateThingStates(inverter);
|
|
||||||
|
|
||||||
foreach (Thing *meter, m_froniusMeters)
|
|
||||||
updateThingStates(meter);
|
|
||||||
|
|
||||||
foreach (Thing *storage, m_froniusStorages)
|
|
||||||
updateThingStates(storage);
|
|
||||||
|
|
||||||
foreach (SunspecThing *sunspecThing, m_sunspecThings.keys())
|
|
||||||
sunspecThing->update();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntegrationPluginFronius::postSetupThing(Thing *thing)
|
void IntegrationPluginFronius::postSetupThing(Thing *thing)
|
||||||
{
|
{
|
||||||
qCDebug(dcFronius()) << "Post setup" << thing->name();
|
qCDebug(dcFronius()) << "Post setup" << thing->name();
|
||||||
|
|
||||||
|
if (!m_pluginTimer) {
|
||||||
|
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(30);
|
||||||
|
connect(m_pluginTimer, &PluginTimer::timeout, this, [this]() {
|
||||||
|
foreach (Thing *logger, m_froniusLoggers)
|
||||||
|
updateThingStates(logger);
|
||||||
|
|
||||||
|
foreach (Thing *inverter, m_froniusInverters)
|
||||||
|
updateThingStates(inverter);
|
||||||
|
|
||||||
|
foreach (Thing *meter, m_froniusMeters)
|
||||||
|
updateThingStates(meter);
|
||||||
|
|
||||||
|
foreach (Thing *storage, m_froniusStorages)
|
||||||
|
updateThingStates(storage);
|
||||||
|
|
||||||
|
foreach (SunspecThing *sunspecThing, m_sunspecThings.keys())
|
||||||
|
sunspecThing->update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (thing->thingClassId() == dataloggerThingClassId) {
|
if (thing->thingClassId() == dataloggerThingClassId) {
|
||||||
searchNewThings(m_froniusLoggers.key(thing));
|
searchNewThings(m_froniusLoggers.key(thing));
|
||||||
updateThingStates(thing);
|
updateThingStates(thing);
|
||||||
@ -271,9 +268,6 @@ void IntegrationPluginFronius::postSetupThing(Thing *thing)
|
|||||||
|
|
||||||
void IntegrationPluginFronius::thingRemoved(Thing *thing)
|
void IntegrationPluginFronius::thingRemoved(Thing *thing)
|
||||||
{
|
{
|
||||||
// Remove things
|
|
||||||
|
|
||||||
// Data Logger
|
|
||||||
if (thing->thingClassId() == dataloggerThingClassId) {
|
if (thing->thingClassId() == dataloggerThingClassId) {
|
||||||
FroniusLogger *logger = m_froniusLoggers.key(thing);
|
FroniusLogger *logger = m_froniusLoggers.key(thing);
|
||||||
m_froniusLoggers.remove(logger);
|
m_froniusLoggers.remove(logger);
|
||||||
@ -500,26 +494,27 @@ void IntegrationPluginFronius::updateThingStates(Thing *thing)
|
|||||||
void IntegrationPluginFronius::searchNewThings(FroniusLogger *logger)
|
void IntegrationPluginFronius::searchNewThings(FroniusLogger *logger)
|
||||||
{
|
{
|
||||||
QUrl url; QUrlQuery query;
|
QUrl url; QUrlQuery query;
|
||||||
query.addQueryItem("ThingClass", "System");
|
query.addQueryItem("DeviceClass", "System");
|
||||||
url.setScheme("http");
|
url.setScheme("http");
|
||||||
url.setHost(logger->hostAddress());
|
url.setHost(logger->hostAddress());
|
||||||
url.setPath(logger->baseUrl() + "GetActiveThingInfo.cgi");
|
url.setPath(logger->baseUrl() + "GetActiveDeviceInfo.cgi");
|
||||||
url.setQuery(query);
|
url.setQuery(query);
|
||||||
|
|
||||||
qCDebug(dcFronius()) << "Search Things at address" << url.toString();
|
qCDebug(dcFronius()) << "Search Things at address" << url.toString();
|
||||||
|
QNetworkRequest request = QNetworkRequest(url);
|
||||||
|
request.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(url));
|
QNetworkReply *reply = hardwareManager()->networkManager()->get(request);
|
||||||
|
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
||||||
connect(reply, &QNetworkReply::finished, [this, logger, reply]() {
|
connect(reply, &QNetworkReply::finished, [this, logger, reply]() {
|
||||||
|
|
||||||
reply->deleteLater();
|
|
||||||
|
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
qCWarning(dcFronius()) << "Network request error:" << reply->error() << reply->errorString();
|
qCWarning(dcFronius()) << "Network request error:" << reply->error() << reply->errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thing *thing = m_froniusLoggers.value(logger);
|
Thing *loggerThing = m_froniusLoggers.value(logger);
|
||||||
if (!thing)
|
if (!loggerThing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
@ -543,68 +538,52 @@ void IntegrationPluginFronius::searchNewThings(FroniusLogger *logger)
|
|||||||
foreach (QString inverterId, inverterMap.keys()) {
|
foreach (QString inverterId, inverterMap.keys()) {
|
||||||
//check if thing already connected to logger
|
//check if thing already connected to logger
|
||||||
if(!existingThing(inverterThingIdParamTypeId,inverterId)) {
|
if(!existingThing(inverterThingIdParamTypeId,inverterId)) {
|
||||||
QString thingName = thing->name() + " Inverter " + inverterId;
|
QString thingName = loggerThing->name() + " Inverter " + inverterId;
|
||||||
ThingDescriptor descriptor(inverterThingClassId, thingName, "Fronius Solar Inverter");
|
ThingDescriptor descriptor(inverterThingClassId, thingName, "Fronius Solar Inverter", loggerThing->id());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params.append(Param(inverterThingNameParamTypeId, thingName));
|
params.append(Param(inverterThingNameParamTypeId, thingName));
|
||||||
params.append(Param(inverterThingHostParamTypeId, m_froniusLoggers.key(thing)->hostAddress()));
|
params.append(Param(inverterThingHostParamTypeId, m_froniusLoggers.key(loggerThing)->hostAddress()));
|
||||||
params.append(Param(inverterThingBaseParamTypeId, m_froniusLoggers.key(thing)->baseUrl()));
|
params.append(Param(inverterThingBaseParamTypeId, m_froniusLoggers.key(loggerThing)->baseUrl()));
|
||||||
params.append(Param(inverterThingIdParamTypeId, inverterId));
|
params.append(Param(inverterThingIdParamTypeId, inverterId));
|
||||||
params.append(Param(inverterThingUniqueIdParamTypeId, ""));
|
params.append(Param(inverterThingUniqueIdParamTypeId, ""));
|
||||||
params.append(Param(inverterThingHostIdParamTypeId, thing->id()));
|
|
||||||
descriptor.setParams(params);
|
descriptor.setParams(params);
|
||||||
thingDescriptors.append(descriptor);
|
thingDescriptors.append(descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!thingDescriptors.empty()) {
|
|
||||||
emit autoThingsAppeared(thingDescriptors);
|
|
||||||
thingDescriptors.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse reply for meter things at the host address
|
// parse reply for meter things at the host address
|
||||||
QVariantMap meterMap = bodyMap.value("Data").toMap().value("Meter").toMap();
|
QVariantMap meterMap = bodyMap.value("Data").toMap().value("Meter").toMap();
|
||||||
foreach (QString meterId, meterMap.keys()) {
|
foreach (QString meterId, meterMap.keys()) {
|
||||||
//check if thing already connected to logger
|
//check if thing already connected to logger
|
||||||
if(!existingThing(meterThingIdParamTypeId,meterId)) {
|
if(!existingThing(meterThingIdParamTypeId, meterId)) {
|
||||||
QString thingName = thing->name() + " Meter " + meterId;
|
QString thingName = loggerThing->name() + " Meter " + meterId;
|
||||||
ThingDescriptor descriptor(meterThingClassId, thingName, "Fronius Solar Meter");
|
ThingDescriptor descriptor(meterThingClassId, thingName, "Fronius Solar Meter", loggerThing->id());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params.append(Param(meterThingNameParamTypeId, thingName));
|
params.append(Param(meterThingNameParamTypeId, thingName));
|
||||||
//params.append(Param(meterThingManufParamTypeId, ""));
|
params.append(Param(meterThingHostParamTypeId, m_froniusLoggers.key(loggerThing)->hostAddress()));
|
||||||
//params.append(Param(meterThingCapacityParamTypeId, ""));
|
params.append(Param(meterThingBaseParamTypeId, m_froniusLoggers.key(loggerThing)->baseUrl()));
|
||||||
params.append(Param(meterThingHostParamTypeId, m_froniusLoggers.key(thing)->hostAddress()));
|
|
||||||
params.append(Param(meterThingBaseParamTypeId, m_froniusLoggers.key(thing)->baseUrl()));
|
|
||||||
params.append(Param(meterThingIdParamTypeId, meterId));
|
params.append(Param(meterThingIdParamTypeId, meterId));
|
||||||
params.append(Param(meterThingUniqueIdParamTypeId, meterMap.value(meterId).toMap().value("Serial").toString()));
|
params.append(Param(meterThingUniqueIdParamTypeId, meterMap.value(meterId).toMap().value("Serial").toString()));
|
||||||
params.append(Param(meterThingHostIdParamTypeId, thing->id()));
|
|
||||||
descriptor.setParams(params);
|
descriptor.setParams(params);
|
||||||
thingDescriptors.append(descriptor);
|
thingDescriptors.append(descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!thingDescriptors.empty()) {
|
|
||||||
emit autoThingsAppeared(thingDescriptors);
|
|
||||||
thingDescriptors.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// parse reply for storage things at the host address
|
// parse reply for storage things at the host address
|
||||||
QVariantMap storageMap = bodyMap.value("Data").toMap().value("Storage").toMap();
|
QVariantMap storageMap = bodyMap.value("Data").toMap().value("Storage").toMap();
|
||||||
foreach (QString storageId, storageMap.keys()) {
|
foreach (QString storageId, storageMap.keys()) {
|
||||||
//check if thing already connected to logger
|
//check if thing already connected to logger
|
||||||
if(!existingThing(storageThingIdParamTypeId,storageId)) {
|
if(!existingThing(storageThingIdParamTypeId,storageId)) {
|
||||||
QString thingName = thing->name() + " Storage " + storageId;
|
QString thingName = loggerThing->name() + " Storage " + storageId;
|
||||||
ThingDescriptor descriptor(storageThingClassId, thingName, "Fronius Solar Storage");
|
ThingDescriptor descriptor(storageThingClassId, thingName, "Fronius Solar Storage", loggerThing->id());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params.append(Param(storageThingNameParamTypeId, thingName));
|
params.append(Param(storageThingNameParamTypeId, thingName));
|
||||||
params.append(Param(storageThingManufacturerParamTypeId, ""));
|
params.append(Param(storageThingManufacturerParamTypeId, ""));
|
||||||
params.append(Param(storageThingCapacityParamTypeId, ""));
|
params.append(Param(storageThingCapacityParamTypeId, ""));
|
||||||
params.append(Param(storageThingHostParamTypeId, m_froniusLoggers.key(thing)->hostAddress()));
|
params.append(Param(storageThingHostParamTypeId, m_froniusLoggers.key(loggerThing)->hostAddress()));
|
||||||
params.append(Param(storageThingBaseParamTypeId, m_froniusLoggers.key(thing)->baseUrl()));
|
params.append(Param(storageThingBaseParamTypeId, m_froniusLoggers.key(loggerThing)->baseUrl()));
|
||||||
params.append(Param(storageThingIdParamTypeId, storageId));
|
params.append(Param(storageThingIdParamTypeId, storageId));
|
||||||
params.append(Param(storageThingUniqueIdParamTypeId, storageMap.value(storageId).toMap().value("Serial").toString()));
|
params.append(Param(storageThingUniqueIdParamTypeId, storageMap.value(storageId).toMap().value("Serial").toString()));
|
||||||
params.append(Param(storageThingHostIdParamTypeId, thing->id()));
|
|
||||||
descriptor.setParams(params);
|
descriptor.setParams(params);
|
||||||
thingDescriptors.append(descriptor);
|
thingDescriptors.append(descriptor);
|
||||||
}
|
}
|
||||||
@ -614,9 +593,7 @@ void IntegrationPluginFronius::searchNewThings(FroniusLogger *logger)
|
|||||||
emit autoThingsAppeared(thingDescriptors);
|
emit autoThingsAppeared(thingDescriptors);
|
||||||
thingDescriptors.clear();
|
thingDescriptors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntegrationPluginFronius::existingThing(ParamTypeId thingParamId, QString thingId)
|
bool IntegrationPluginFronius::existingThing(ParamTypeId thingParamId, QString thingId)
|
||||||
|
|||||||
@ -51,14 +51,11 @@ class IntegrationPluginFronius : public IntegrationPlugin
|
|||||||
public:
|
public:
|
||||||
explicit IntegrationPluginFronius(QObject *parent = nullptr);
|
explicit IntegrationPluginFronius(QObject *parent = nullptr);
|
||||||
|
|
||||||
void init() override;
|
|
||||||
void setupThing(ThingSetupInfo *thing) override;
|
void setupThing(ThingSetupInfo *thing) override;
|
||||||
void postSetupThing(Thing* thing) override;
|
void postSetupThing(Thing* thing) override;
|
||||||
void executeAction(ThingActionInfo *info) override;
|
void executeAction(ThingActionInfo *info) override;
|
||||||
void thingRemoved(Thing* thing) override;
|
void thingRemoved(Thing* thing) override;
|
||||||
|
|
||||||
void startMonitoringAutoThings() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PluginTimer *m_pluginTimer = nullptr;
|
PluginTimer *m_pluginTimer = nullptr;
|
||||||
|
|
||||||
|
|||||||
@ -187,13 +187,6 @@
|
|||||||
"displayName": "Uique id",
|
"displayName": "Uique id",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "TextLine"
|
"inputType": "TextLine"
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "e329ecd2-6893-432f-9f14-069593c996e9",
|
|
||||||
"name": "hostId",
|
|
||||||
"displayName": "host id",
|
|
||||||
"type": "QString",
|
|
||||||
"inputType": "TextLine"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
@ -292,13 +285,6 @@
|
|||||||
"displayName": "uique id",
|
"displayName": "uique id",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "TextLine"
|
"inputType": "TextLine"
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "b4b86bfc-598a-4b5c-9350-52b944556ccc",
|
|
||||||
"name": "hostId",
|
|
||||||
"displayName": "host id",
|
|
||||||
"type": "QString",
|
|
||||||
"inputType": "TextLine"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
@ -394,13 +380,6 @@
|
|||||||
"displayName": "unique id",
|
"displayName": "unique id",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "TextLine"
|
"inputType": "TextLine"
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "79daa7f4-2551-4b89-b34a-2d75d1441a55",
|
|
||||||
"name": "hostId",
|
|
||||||
"displayName": "Host ID",
|
|
||||||
"type": "QString",
|
|
||||||
"inputType": "TextLine"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
|
|||||||
@ -76,6 +76,16 @@ bool ModbusRTUMaster::connectDevice()
|
|||||||
return m_modbusRtuSerialMaster->connectDevice();
|
return m_modbusRtuSerialMaster->connectDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModbusRTUMaster::setNumberOfRetries(int number)
|
||||||
|
{
|
||||||
|
m_modbusRtuSerialMaster->setNumberOfRetries(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModbusRTUMaster::setTimeout(int timeout)
|
||||||
|
{
|
||||||
|
m_modbusRtuSerialMaster->setTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
QString ModbusRTUMaster::serialPort()
|
QString ModbusRTUMaster::serialPort()
|
||||||
{
|
{
|
||||||
return m_modbusRtuSerialMaster->connectionParameter(QModbusDevice::SerialPortNameParameter).toString();
|
return m_modbusRtuSerialMaster->connectionParameter(QModbusDevice::SerialPortNameParameter).toString();
|
||||||
@ -88,14 +98,14 @@ void ModbusRTUMaster::onReconnectTimer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::readCoil(uint slaveAddress, uint registerAddress)
|
QUuid ModbusRTUMaster::readCoil(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -106,7 +116,7 @@ QUuid ModbusRTUMaster::readCoil(uint slaveAddress, uint registerAddress)
|
|||||||
requestExecuted(requestId, true);
|
requestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
requestExecuted(requestId, false);
|
requestExecuted(requestId, false);
|
||||||
@ -133,14 +143,20 @@ QUuid ModbusRTUMaster::readCoil(uint slaveAddress, uint registerAddress)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::writeCoil(uint slaveAddress, uint registerAddress, bool value)
|
QUuid ModbusRTUMaster::writeCoil(uint slaveAddress, uint registerAddress, bool value)
|
||||||
|
{
|
||||||
|
return writeCoils(slaveAddress, registerAddress, QVector<quint16>() << static_cast<quint16>(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QUuid ModbusRTUMaster::writeCoils(uint slaveAddress, uint registerAddress, const QVector<quint16> &values)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, values.length());
|
||||||
request.setValue(0, static_cast<uint16_t>(value));
|
request.setValues(values);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendWriteRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendWriteRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -151,7 +167,7 @@ QUuid ModbusRTUMaster::writeCoil(uint slaveAddress, uint registerAddress, bool v
|
|||||||
requestExecuted(requestId, true);
|
requestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
requestExecuted(requestId, false);
|
requestExecuted(requestId, false);
|
||||||
@ -176,15 +192,20 @@ QUuid ModbusRTUMaster::writeCoil(uint slaveAddress, uint registerAddress, bool v
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::writeHoldingRegister(uint slaveAddress, uint registerAddress, uint value)
|
QUuid ModbusRTUMaster::writeHoldingRegister(uint slaveAddress, uint registerAddress, quint16 value)
|
||||||
|
{
|
||||||
|
return writeHoldingRegisters(slaveAddress, registerAddress, QVector<quint16>() << value);
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid ModbusRTUMaster::writeHoldingRegisters(uint slaveAddress, uint registerAddress, const QVector<quint16> &values)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, registerAddress, values.length());
|
||||||
request.setValue(0, static_cast<uint16_t>(value));
|
request.setValues(values);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendWriteRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendWriteRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -220,14 +241,14 @@ QUuid ModbusRTUMaster::writeHoldingRegister(uint slaveAddress, uint registerAddr
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::readDiscreteInput(uint slaveAddress, uint registerAddress)
|
QUuid ModbusRTUMaster::readDiscreteInput(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::DiscreteInputs, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::DiscreteInputs, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -238,7 +259,7 @@ QUuid ModbusRTUMaster::readDiscreteInput(uint slaveAddress, uint registerAddress
|
|||||||
requestExecuted(requestId, true);
|
requestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedDiscreteInput(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedDiscreteInput(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
requestExecuted(requestId, false);
|
requestExecuted(requestId, false);
|
||||||
@ -264,14 +285,14 @@ QUuid ModbusRTUMaster::readDiscreteInput(uint slaveAddress, uint registerAddress
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::readInputRegister(uint slaveAddress, uint registerAddress)
|
QUuid ModbusRTUMaster::readInputRegister(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::InputRegisters, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::InputRegisters, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -283,7 +304,7 @@ QUuid ModbusRTUMaster::readInputRegister(uint slaveAddress, uint registerAddress
|
|||||||
requestExecuted(requestId, true);
|
requestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedInputRegister(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedInputRegister(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
requestExecuted(requestId, false);
|
requestExecuted(requestId, false);
|
||||||
@ -309,14 +330,14 @@ QUuid ModbusRTUMaster::readInputRegister(uint slaveAddress, uint registerAddress
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusRTUMaster::readHoldingRegister(uint slaveAddress, uint registerAddress)
|
QUuid ModbusRTUMaster::readHoldingRegister(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusRtuSerialMaster) {
|
if (!m_modbusRtuSerialMaster) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::HoldingRegisters, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusRtuSerialMaster->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
|
|||||||
@ -45,14 +45,19 @@ public:
|
|||||||
~ModbusRTUMaster();
|
~ModbusRTUMaster();
|
||||||
|
|
||||||
bool connectDevice();
|
bool connectDevice();
|
||||||
|
void setNumberOfRetries(int number);
|
||||||
|
void setTimeout(int timeout);
|
||||||
|
|
||||||
QUuid readCoil(uint slaveAddress, uint registerAddress);
|
QUuid readCoil(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readDiscreteInput(uint slaveAddress, uint registerAddress);
|
QUuid readDiscreteInput(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readInputRegister(uint slaveAddress, uint registerAddress);
|
QUuid readInputRegister(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readHoldingRegister(uint slaveAddress, uint registerAddress);
|
QUuid readHoldingRegister(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
|
|
||||||
QUuid writeCoil(uint slaveAddress, uint registerAddress, bool status);
|
QUuid writeCoil(uint slaveAddress, uint registerAddress, bool status);
|
||||||
QUuid writeHoldingRegister(uint slaveAddress, uint registerAddress, uint data);
|
QUuid writeCoils(uint slaveAddress, uint registerAddress, const QVector<quint16> &values);
|
||||||
|
|
||||||
|
QUuid writeHoldingRegister(uint slaveAddress, uint registerAddress, quint16 value);
|
||||||
|
QUuid writeHoldingRegisters(uint slaveAddress, uint registerAddress, const QVector<quint16> &values);
|
||||||
|
|
||||||
QString serialPort();
|
QString serialPort();
|
||||||
|
|
||||||
@ -72,10 +77,10 @@ signals:
|
|||||||
void requestExecuted(QUuid requestId, bool success);
|
void requestExecuted(QUuid requestId, bool success);
|
||||||
void requestError(QUuid requestId, const QString &error);
|
void requestError(QUuid requestId, const QString &error);
|
||||||
|
|
||||||
void receivedCoil(uint slaveAddress, uint modbusRegister, bool value);
|
void receivedCoil(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedDiscreteInput(uint slaveAddress, uint modbusRegister, bool value);
|
void receivedDiscreteInput(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
void receivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedInputRegister(uint slaveAddress, uint modbusRegister, uint value);
|
void receivedInputRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODBUSRTUMASTER_H
|
#endif // MODBUSRTUMASTER_H
|
||||||
|
|||||||
@ -110,14 +110,14 @@ QHostAddress ModbusTCPMaster::hostAddress()
|
|||||||
return QHostAddress(m_modbusTcpClient->connectionParameter(QModbusDevice::NetworkAddressParameter).toString());
|
return QHostAddress(m_modbusTcpClient->connectionParameter(QModbusDevice::NetworkAddressParameter).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusTCPMaster::readCoil(uint slaveAddress, uint registerAddress)
|
QUuid ModbusTCPMaster::readCoil(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusTcpClient) {
|
if (!m_modbusTcpClient) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -128,7 +128,7 @@ QUuid ModbusTCPMaster::readCoil(uint slaveAddress, uint registerAddress)
|
|||||||
writeRequestExecuted(requestId, true);
|
writeRequestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
writeRequestExecuted(requestId, false);
|
writeRequestExecuted(requestId, false);
|
||||||
@ -197,14 +197,14 @@ QUuid ModbusTCPMaster::writeHoldingRegisters(uint slaveAddress, uint registerAdd
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusTCPMaster::readDiscreteInput(uint slaveAddress, uint registerAddress)
|
QUuid ModbusTCPMaster::readDiscreteInput(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusTcpClient) {
|
if (!m_modbusTcpClient) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::DiscreteInputs, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::DiscreteInputs, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -215,7 +215,7 @@ QUuid ModbusTCPMaster::readDiscreteInput(uint slaveAddress, uint registerAddress
|
|||||||
writeRequestExecuted(requestId, true);
|
writeRequestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedDiscreteInput(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedDiscreteInput(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
writeRequestExecuted(requestId, false);
|
writeRequestExecuted(requestId, false);
|
||||||
@ -241,14 +241,14 @@ QUuid ModbusTCPMaster::readDiscreteInput(uint slaveAddress, uint registerAddress
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid ModbusTCPMaster::readInputRegister(uint slaveAddress, uint registerAddress)
|
QUuid ModbusTCPMaster::readInputRegister(uint slaveAddress, uint registerAddress, uint size)
|
||||||
{
|
{
|
||||||
if (!m_modbusTcpClient) {
|
if (!m_modbusTcpClient) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::InputRegisters, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::InputRegisters, registerAddress, size);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusTcpClient->sendReadRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -259,7 +259,7 @@ QUuid ModbusTCPMaster::readInputRegister(uint slaveAddress, uint registerAddress
|
|||||||
writeRequestExecuted(requestId, true);
|
writeRequestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedInputRegister(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedInputRegister(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
writeRequestExecuted(requestId, false);
|
writeRequestExecuted(requestId, false);
|
||||||
@ -330,13 +330,18 @@ QUuid ModbusTCPMaster::readHoldingRegister(uint slaveAddress, uint registerAddre
|
|||||||
|
|
||||||
QUuid ModbusTCPMaster::writeCoil(uint slaveAddress, uint registerAddress, bool value)
|
QUuid ModbusTCPMaster::writeCoil(uint slaveAddress, uint registerAddress, bool value)
|
||||||
{
|
{
|
||||||
|
return writeCoils(slaveAddress, registerAddress, QVector<quint16>() << static_cast<quint16>(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid ModbusTCPMaster::writeCoils(uint slaveAddress, uint registerAddress, const QVector<quint16> &values)
|
||||||
|
{
|
||||||
if (!m_modbusTcpClient) {
|
if (!m_modbusTcpClient) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
QUuid requestId = QUuid::createUuid();
|
QUuid requestId = QUuid::createUuid();
|
||||||
|
|
||||||
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, 1);
|
QModbusDataUnit request = QModbusDataUnit(QModbusDataUnit::RegisterType::Coils, registerAddress, values.length());
|
||||||
request.setValue(0, static_cast<uint16_t>(value));
|
request.setValues(values);
|
||||||
|
|
||||||
if (QModbusReply *reply = m_modbusTcpClient->sendWriteRequest(request, slaveAddress)) {
|
if (QModbusReply *reply = m_modbusTcpClient->sendWriteRequest(request, slaveAddress)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@ -347,7 +352,7 @@ QUuid ModbusTCPMaster::writeCoil(uint slaveAddress, uint registerAddress, bool v
|
|||||||
writeRequestExecuted(requestId, true);
|
writeRequestExecuted(requestId, true);
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
uint modbusAddress = unit.startAddress();
|
uint modbusAddress = unit.startAddress();
|
||||||
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.value(0));
|
emit receivedCoil(reply->serverAddress(), modbusAddress, unit.values());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
writeRequestExecuted(requestId, false);
|
writeRequestExecuted(requestId, false);
|
||||||
|
|||||||
@ -48,12 +48,13 @@ public:
|
|||||||
void setNumberOfRetries(int number);
|
void setNumberOfRetries(int number);
|
||||||
void setTimeout(int timeout);
|
void setTimeout(int timeout);
|
||||||
|
|
||||||
QUuid readCoil(uint slaveAddress, uint registerAddress);
|
QUuid readCoil(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readDiscreteInput(uint slaveAddress, uint registerAddress);
|
QUuid readDiscreteInput(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readInputRegister(uint slaveAddress, uint registerAddress);
|
QUuid readInputRegister(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
QUuid readHoldingRegister(uint slaveAddress, uint registerAddress, uint size = 1);
|
QUuid readHoldingRegister(uint slaveAddress, uint registerAddress, uint size = 1);
|
||||||
|
|
||||||
QUuid writeCoil(uint slaveAddress, uint registerAddress, bool status);
|
QUuid writeCoil(uint slaveAddress, uint registerAddress, bool status);
|
||||||
|
QUuid writeCoils(uint slaveAddress, uint registerAddress, const QVector<quint16> &values);
|
||||||
|
|
||||||
QUuid writeHoldingRegister(uint slaveAddress, uint registerAddress, quint16 value);
|
QUuid writeHoldingRegister(uint slaveAddress, uint registerAddress, quint16 value);
|
||||||
QUuid writeHoldingRegisters(uint slaveAddress, uint registerAddress, const QVector<quint16> &values);
|
QUuid writeHoldingRegisters(uint slaveAddress, uint registerAddress, const QVector<quint16> &values);
|
||||||
@ -63,7 +64,6 @@ public:
|
|||||||
bool setHostAddress(const QHostAddress &hostAddress);
|
bool setHostAddress(const QHostAddress &hostAddress);
|
||||||
bool setPort(uint port);
|
bool setPort(uint port);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer *m_reconnectTimer = nullptr;
|
QTimer *m_reconnectTimer = nullptr;
|
||||||
QModbusTcpClient *m_modbusTcpClient;
|
QModbusTcpClient *m_modbusTcpClient;
|
||||||
@ -80,10 +80,10 @@ signals:
|
|||||||
void writeRequestExecuted(const QUuid &requestId, bool success);
|
void writeRequestExecuted(const QUuid &requestId, bool success);
|
||||||
void writeRequestError(const QUuid &requestId, const QString &error);
|
void writeRequestError(const QUuid &requestId, const QString &error);
|
||||||
|
|
||||||
void receivedCoil(uint slaveAddress, uint modbusRegister, bool value);
|
void receivedCoil(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedDiscreteInput(uint slaveAddress, uint modbusRegister, bool value);
|
void receivedDiscreteInput(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
void receivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void receivedInputRegister(uint slaveAddress, uint modbusRegister, uint value);
|
void receivedInputRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODBUSTCPMASTER_H
|
#endif // MODBUSTCPMASTER_H
|
||||||
|
|||||||
@ -358,7 +358,7 @@ void IntegrationPluginModbusCommander::onRequestError(QUuid requestId, const QSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginModbusCommander::onReceivedCoil(quint32 slaveAddress, quint32 modbusRegister, bool value)
|
void IntegrationPluginModbusCommander::onReceivedCoil(quint32 slaveAddress, quint32 modbusRegister, const QVector<quint16> &values)
|
||||||
{
|
{
|
||||||
auto modbus = sender();
|
auto modbus = sender();
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ void IntegrationPluginModbusCommander::onReceivedCoil(quint32 slaveAddress, quin
|
|||||||
if (thing->thingClassId() == coilThingClassId) {
|
if (thing->thingClassId() == coilThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ void IntegrationPluginModbusCommander::onReceivedCoil(quint32 slaveAddress, quin
|
|||||||
if (thing->thingClassId() == coilThingClassId) {
|
if (thing->thingClassId() == coilThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ void IntegrationPluginModbusCommander::onReceivedCoil(quint32 slaveAddress, quin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginModbusCommander::onReceivedDiscreteInput(quint32 slaveAddress, quint32 modbusRegister, bool value)
|
void IntegrationPluginModbusCommander::onReceivedDiscreteInput(quint32 slaveAddress, quint32 modbusRegister, const QVector<quint16> &values)
|
||||||
{
|
{
|
||||||
auto modbus = sender();
|
auto modbus = sender();
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ void IntegrationPluginModbusCommander::onReceivedDiscreteInput(quint32 slaveAddr
|
|||||||
if (thing->thingClassId() == discreteInputThingClassId) {
|
if (thing->thingClassId() == discreteInputThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ void IntegrationPluginModbusCommander::onReceivedDiscreteInput(quint32 slaveAddr
|
|||||||
if (thing->thingClassId() == discreteInputThingClassId) {
|
if (thing->thingClassId() == discreteInputThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -451,7 +451,7 @@ void IntegrationPluginModbusCommander::onReceivedHoldingRegister(uint slaveAddre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginModbusCommander::onReceivedInputRegister(uint slaveAddress, uint modbusRegister, int value)
|
void IntegrationPluginModbusCommander::onReceivedInputRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values)
|
||||||
{
|
{
|
||||||
auto modbus = sender();
|
auto modbus = sender();
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ void IntegrationPluginModbusCommander::onReceivedInputRegister(uint slaveAddress
|
|||||||
if (thing->thingClassId() == inputRegisterThingClassId) {
|
if (thing->thingClassId() == inputRegisterThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -473,7 +473,7 @@ void IntegrationPluginModbusCommander::onReceivedInputRegister(uint slaveAddress
|
|||||||
if (thing->thingClassId() == inputRegisterThingClassId) {
|
if (thing->thingClassId() == inputRegisterThingClassId) {
|
||||||
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
if ((thing->paramValue(m_slaveAddressParamTypeId.value(thing->thingClassId())) == slaveAddress)
|
||||||
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
&& (thing->paramValue(m_registerAddressParamTypeId.value(thing->thingClassId())) == modbusRegister)) {
|
||||||
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), value);
|
thing->setStateValue(m_valueStateTypeId.value(thing->thingClassId()), values[0]);
|
||||||
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
thing->setStateValue(m_connectedStateTypeId.value(thing->thingClassId()), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,10 +84,11 @@ private slots:
|
|||||||
void onConnectionStateChanged(bool status);
|
void onConnectionStateChanged(bool status);
|
||||||
void onRequestExecuted(QUuid requestId, bool success);
|
void onRequestExecuted(QUuid requestId, bool success);
|
||||||
void onRequestError(QUuid requestId, const QString &error);
|
void onRequestError(QUuid requestId, const QString &error);
|
||||||
void onReceivedCoil(quint32 slaveAddress, quint32 modbusRegister, bool value);
|
|
||||||
void onReceivedDiscreteInput(quint32 slaveAddress, quint32 modbusRegister, bool value);
|
void onReceivedCoil(quint32 slaveAddress, quint32 modbusRegister, const QVector<quint16> &values);
|
||||||
|
void onReceivedDiscreteInput(quint32 slaveAddress, quint32 modbusRegister, const QVector<quint16> &values);
|
||||||
void onReceivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
void onReceivedHoldingRegister(uint slaveAddress, uint modbusRegister, const QVector<quint16> &values);
|
||||||
void onReceivedInputRegister(quint32 slaveAddress, quint32 modbusRegister, int value);
|
void onReceivedInputRegister(quint32 slaveAddress, quint32 modbusRegister, const QVector<quint16> &values);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTEGRATIONPLUGINMODBUSCOMMANDER_H
|
#endif // INTEGRATIONPLUGINMODBUSCOMMANDER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user