dweetio: Add Qt6 support
This commit is contained in:
parent
8809ca8d90
commit
f20a3eca83
@ -1,11 +1,9 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
QT += network
|
QT *= network
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationplugindweetio)
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationplugindweetio.cpp \
|
integrationplugindweetio.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationplugindweetio.h \
|
integrationplugindweetio.h
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -30,8 +30,9 @@
|
|||||||
|
|
||||||
#include "integrationplugindweetio.h"
|
#include "integrationplugindweetio.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
#include "hardwaremanager.h"
|
|
||||||
#include "network/networkaccessmanager.h"
|
#include <hardwaremanager.h>
|
||||||
|
#include <network/networkaccessmanager.h>
|
||||||
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
@ -60,7 +61,7 @@ void IntegrationPluginDweetio::setupThing(ThingSetupInfo *info)
|
|||||||
if (info->thing()->thingClassId() == postThingClassId) {
|
if (info->thing()->thingClassId() == postThingClassId) {
|
||||||
QString thing = info->thing()->paramValue(postThingThingParamTypeId).toString();
|
QString thing = info->thing()->paramValue(postThingThingParamTypeId).toString();
|
||||||
if (thing.isEmpty()){
|
if (thing.isEmpty()){
|
||||||
qDebug(dcDweetio) << "No thing name given, creating one";
|
qCDebug(dcDweetio()) << "No thing name given, creating one";
|
||||||
thing = QUuid::createUuid().toString();
|
thing = QUuid::createUuid().toString();
|
||||||
}
|
}
|
||||||
return info->finish(Thing::ThingErrorNoError);
|
return info->finish(Thing::ThingErrorNoError);
|
||||||
@ -135,7 +136,7 @@ void IntegrationPluginDweetio::postContent(const QString &content, Thing *thing,
|
|||||||
contentMap.insert(thing->paramValue(postThingContentNameParamTypeId).toString(), content);
|
contentMap.insert(thing->paramValue(postThingContentNameParamTypeId).toString(), content);
|
||||||
|
|
||||||
QByteArray data = QJsonDocument::fromVariant(contentMap).toJson(QJsonDocument::Compact);
|
QByteArray data = QJsonDocument::fromVariant(contentMap).toJson(QJsonDocument::Compact);
|
||||||
qDebug(dcDweetio) << "Dweet: " << data << "Url: " << url;
|
qCDebug(dcDweetio()) << "Dweet: " << data << "Url: " << url;
|
||||||
|
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->post(request, data);
|
QNetworkReply *reply = hardwareManager()->networkManager()->post(request, data);
|
||||||
m_asyncActions.insert(reply, info);
|
m_asyncActions.insert(reply, info);
|
||||||
@ -155,7 +156,7 @@ void IntegrationPluginDweetio::setConnectionStatus(bool status, Thing *thing)
|
|||||||
void IntegrationPluginDweetio::processPostReply(const QVariantMap &data, Thing *thing)
|
void IntegrationPluginDweetio::processPostReply(const QVariantMap &data, Thing *thing)
|
||||||
{
|
{
|
||||||
QString message = data.value("this").toString();
|
QString message = data.value("this").toString();
|
||||||
qDebug(dcDweetio) << "Access Reply: " << message << "Device: " << thing->name();
|
qCDebug(dcDweetio()) << "Access Reply: " << message << "Device: " << thing->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginDweetio::processGetReply(const QVariantMap &data, Thing *thing)
|
void IntegrationPluginDweetio::processGetReply(const QVariantMap &data, Thing *thing)
|
||||||
@ -165,7 +166,7 @@ void IntegrationPluginDweetio::processGetReply(const QVariantMap &data, Thing *t
|
|||||||
QString content = contentMap.value(thing->paramValue(getThingContentNameParamTypeId).toString()).toString();
|
QString content = contentMap.value(thing->paramValue(getThingContentNameParamTypeId).toString()).toString();
|
||||||
thing->setStateValue(getContentStateTypeId, content);
|
thing->setStateValue(getContentStateTypeId, content);
|
||||||
|
|
||||||
qDebug(dcDweetio) << "Data: " << data << "Device: " << thing->name();
|
qCDebug(dcDweetio()) << "Data: " << data << "Device: " << thing->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginDweetio::onNetworkReplyFinished()
|
void IntegrationPluginDweetio::onNetworkReplyFinished()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef INTEGRATIONPLUGINDWEETIO_H
|
#ifndef INTEGRATIONPLUGINDWEETIO_H
|
||||||
#define INTEGRATIONPLUGINDWEETIO_H
|
#define INTEGRATIONPLUGINDWEETIO_H
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user