Migrate to interfaces and hardwaremanager
parent
fbe234986a
commit
48496e8b36
|
|
@ -1,6 +1,7 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
|
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
|
||||||
|
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
|
||||||
* *
|
* *
|
||||||
* This file is part of guh. *
|
* This file is part of guh. *
|
||||||
* *
|
* *
|
||||||
|
|
@ -19,6 +20,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "devicepluginhttpcommander.h"
|
#include "devicepluginhttpcommander.h"
|
||||||
|
#include "network/networkaccessmanager.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,18 +28,49 @@ DevicePluginHttpCommander::DevicePluginHttpCommander()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceManager::HardwareResources DevicePluginHttpCommander::requiredHardware() const
|
DevicePluginHttpCommander::~DevicePluginHttpCommander()
|
||||||
{
|
{
|
||||||
return DeviceManager::HardwareResourceNetworkManager | DeviceManager::HardwareResourceTimer;
|
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::init()
|
||||||
|
{
|
||||||
|
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10);
|
||||||
|
connect(m_pluginTimer, &PluginTimer::timeout, this, &DevicePluginHttpCommander::onPluginTimer);
|
||||||
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceSetupStatus DevicePluginHttpCommander::setupDevice(Device *device)
|
DeviceManager::DeviceSetupStatus DevicePluginHttpCommander::setupDevice(Device *device)
|
||||||
{
|
{
|
||||||
if ((device->deviceClassId() == httpGetDeviceClassId) || (device->deviceClassId() == httpPostDeviceClassId) || (device->deviceClassId() == httpPutDeviceClassId)) {
|
qDebug(dcHttpCommander()) << "Setup device" << device->name() << device->params();
|
||||||
QUrl url = device->paramValue(urlParamTypeId).toUrl();
|
|
||||||
|
// Get
|
||||||
|
if (device->deviceClassId() == httpGetCommanderDeviceClassId) {
|
||||||
|
QUrl url = device->paramValue(httpGetCommanderUrlParamTypeId).toUrl();
|
||||||
if (!url.isValid()) {
|
if (!url.isValid()) {
|
||||||
qDebug(dcHttpCommander()) << "Given URL is not valid";
|
qDebug(dcHttpCommander()) << "Given URL is not valid";
|
||||||
|
return DeviceManager::DeviceSetupStatusFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put
|
||||||
|
if (device->deviceClassId() == httpPutCommanderDeviceClassId) {
|
||||||
|
QUrl url = device->paramValue(httpPutCommanderUrlParamTypeId).toUrl();
|
||||||
|
if (!url.isValid()) {
|
||||||
|
qDebug(dcHttpCommander()) << "Given URL is not valid";
|
||||||
|
return DeviceManager::DeviceSetupStatusFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post
|
||||||
|
if (device->deviceClassId() == httpPostCommanderDeviceClassId) {
|
||||||
|
QUrl url = device->paramValue(httpPostCommanderUrlParamTypeId).toUrl();
|
||||||
|
if (!url.isValid()) {
|
||||||
|
qDebug(dcHttpCommander()) << "Given URL is not valid";
|
||||||
|
return DeviceManager::DeviceSetupStatusFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeviceManager::DeviceSetupStatusSuccess;
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
|
|
@ -49,33 +82,34 @@ DeviceManager::DeviceSetupStatus DevicePluginHttpCommander::setupDevice(Device *
|
||||||
|
|
||||||
void DevicePluginHttpCommander::postSetupDevice(Device *device)
|
void DevicePluginHttpCommander::postSetupDevice(Device *device)
|
||||||
{
|
{
|
||||||
if (device->deviceClassId() == httpGetDeviceClassId) {
|
if (device->deviceClassId() == httpGetCommanderDeviceClassId) {
|
||||||
QUrl url = device->paramValue(urlParamTypeId).toUrl();
|
makeGetCall(device);
|
||||||
url.setPort(device->paramValue(portParamTypeId).toInt());
|
|
||||||
QNetworkRequest request;
|
|
||||||
request.setUrl(url);
|
|
||||||
request.setRawHeader("User-Agent", "guhIO 1.0");
|
|
||||||
QNetworkReply *reply = networkManagerGet(request);;
|
|
||||||
m_httpRequests.insert(reply, device);
|
|
||||||
}
|
}
|
||||||
if ((device->deviceClassId() == httpPostDeviceClassId) || (device->deviceClassId() == httpPutDeviceClassId)) {
|
|
||||||
|
if (device->deviceClassId() == httpPostCommanderDeviceClassId) {
|
||||||
//TODO find a way to check it the URL is reachable
|
//TODO find a way to check it the URL is reachable
|
||||||
device->setStateValue(reachableStateTypeId, true);
|
device->setStateValue(httpPostCommanderConnectedStateTypeId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device->deviceClassId() == httpPutCommanderDeviceClassId) {
|
||||||
|
//TODO find a way to check it the URL is reachable
|
||||||
|
device->setStateValue(httpPutCommanderConnectedStateTypeId, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DeviceManager::DeviceError DevicePluginHttpCommander::executeAction(Device *device, const Action &action)
|
DeviceManager::DeviceError DevicePluginHttpCommander::executeAction(Device *device, const Action &action)
|
||||||
{
|
{
|
||||||
if (device->deviceClassId() == httpPostDeviceClassId) {
|
if (device->deviceClassId() == httpPostCommanderDeviceClassId) {
|
||||||
|
|
||||||
// check if this is the "press" action
|
if (action.actionTypeId() == httpPostCommanderPostActionTypeId) {
|
||||||
if (action.actionTypeId() == postActionTypeId) {
|
QUrl url = device->paramValue(httpPostCommanderUrlParamTypeId).toUrl();
|
||||||
|
url.setPort(device->paramValue(httpPostCommanderPortParamTypeId).toInt());
|
||||||
|
QByteArray payload = action.param(httpPostCommanderDataParamTypeId).value().toByteArray();
|
||||||
|
|
||||||
|
QNetworkReply *reply = hardwareManager()->networkManager()->post(QNetworkRequest(url), payload);
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginHttpCommander::onPostRequestFinished);
|
||||||
|
|
||||||
QUrl url = device->paramValue(urlParamTypeId).toUrl();
|
|
||||||
url.setPort(device->paramValue(portParamTypeId).toInt());
|
|
||||||
QByteArray payload = action.param(postDataParamTypeId).value().toByteArray();
|
|
||||||
QNetworkReply *reply = networkManagerPost(QNetworkRequest(url), payload);
|
|
||||||
m_httpRequests.insert(reply, device);
|
m_httpRequests.insert(reply, device);
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|
@ -83,15 +117,18 @@ DeviceManager::DeviceError DevicePluginHttpCommander::executeAction(Device *devi
|
||||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (device->deviceClassId() == httpPutDeviceClassId) {
|
|
||||||
|
if (device->deviceClassId() == httpPutCommanderDeviceClassId) {
|
||||||
|
|
||||||
// check if this is the "press" action
|
// check if this is the "press" action
|
||||||
if (action.actionTypeId() == putActionTypeId) {
|
if (action.actionTypeId() == httpPutCommanderPutActionTypeId) {
|
||||||
|
|
||||||
|
QUrl url = device->paramValue(httpPutCommanderUrlParamTypeId).toUrl();
|
||||||
|
url.setPort(device->paramValue(httpPutCommanderPortParamTypeId).toInt());
|
||||||
|
QByteArray payload = action.param(httpPutCommanderDataParamTypeId).value().toByteArray();
|
||||||
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(QNetworkRequest(url), payload);
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginHttpCommander::onPutRequestFinished);
|
||||||
|
|
||||||
QUrl url = device->paramValue(urlParamTypeId).toUrl();
|
|
||||||
url.setPort(device->paramValue(portParamTypeId).toInt());
|
|
||||||
QByteArray payload = action.param(putDataParamTypeId).value().toByteArray();
|
|
||||||
QNetworkReply *reply = networkManagerPut(QNetworkRequest(url), payload);
|
|
||||||
m_httpRequests.insert(reply, device);
|
m_httpRequests.insert(reply, device);
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|
@ -100,63 +137,117 @@ DeviceManager::DeviceError DevicePluginHttpCommander::executeAction(Device *devi
|
||||||
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::makeGetCall(Device *device)
|
||||||
void DevicePluginHttpCommander::deviceRemoved(Device *device)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(device);
|
QUrl url = device->paramValue(httpGetCommanderUrlParamTypeId).toUrl();
|
||||||
|
url.setPort(device->paramValue(httpGetCommanderPortParamTypeId).toInt());
|
||||||
|
QNetworkRequest request;
|
||||||
|
request.setUrl(url);
|
||||||
|
request.setRawHeader("User-Agent", "guhIO 1.0");
|
||||||
|
|
||||||
|
QNetworkReply *reply = hardwareManager()->networkManager()->get(request);
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginHttpCommander::onGetRequestFinished);
|
||||||
|
|
||||||
|
m_httpRequests.insert(reply, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::onPluginTimer()
|
||||||
void DevicePluginHttpCommander::guhTimer()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (Device *device, myDevices()) {
|
foreach (Device *device, myDevices()) {
|
||||||
|
if (device->deviceClassId() == httpGetCommanderDeviceClassId) {
|
||||||
if (device->deviceClassId() == httpGetDeviceClassId) {
|
makeGetCall(device);
|
||||||
QUrl url = device->paramValue(urlParamTypeId).toUrl();
|
|
||||||
url.setPort(device->paramValue(portParamTypeId).toInt());
|
|
||||||
QNetworkRequest request;
|
|
||||||
request.setUrl(url);
|
|
||||||
request.setRawHeader("User-Agent", "guhIO 1.0");
|
|
||||||
QNetworkReply *reply = networkManagerGet(request);;
|
|
||||||
m_httpRequests.insert(reply, device);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::onGetRequestFinished()
|
||||||
void DevicePluginHttpCommander::networkManagerReplyReady(QNetworkReply *reply)
|
|
||||||
{
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
|
||||||
|
qDebug(dcHttpCommander()) << "GET reply finished";
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
qDebug(dcHttpCommander()) << "Reply received";
|
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
if (m_httpRequests.contains(reply)) {
|
if (!m_httpRequests.contains(reply)) {
|
||||||
Device *device = m_httpRequests.take(reply);
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
if (device->deviceClassId() == httpGetDeviceClassId) {
|
|
||||||
device->setStateValue(getDataStateTypeId, data);
|
|
||||||
// check HTTP status code
|
|
||||||
if (status != 200 || reply->error() != QNetworkReply::NoError) {
|
|
||||||
qCWarning(dcHttpCommander()) << "Request error:" << status << reply->errorString();
|
|
||||||
device->setStateValue(reachableStateTypeId, false);
|
|
||||||
reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
device->setStateValue(reachableStateTypeId, true);
|
|
||||||
} else if ((device->deviceClassId() == httpPostDeviceClassId) || (device->deviceClassId() == httpPutDeviceClassId) ) {
|
|
||||||
device->setStateValue(httpResponseStateTypeId, data);
|
|
||||||
// check HTTP status code
|
|
||||||
if (status != 200 || reply->error() != QNetworkReply::NoError) {
|
|
||||||
qCWarning(dcHttpCommander()) << "Request error:" << status << reply->errorString();
|
|
||||||
device->setStateValue(reachableStateTypeId, false);
|
|
||||||
reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
device->setStateValue(reachableStateTypeId, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Device *device = m_httpRequests.take(reply);
|
||||||
|
device->setStateValue(httpGetCommanderResponseStateTypeId, data);
|
||||||
|
|
||||||
|
// Check HTTP status code
|
||||||
|
if (status != 200 || reply->error() != QNetworkReply::NoError) {
|
||||||
|
qCWarning(dcHttpCommander()) << "Request error:" << status << reply->errorString();
|
||||||
|
device->setStateValue(httpGetCommanderConnectedStateTypeId, false);
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->setStateValue(httpGetCommanderConnectedStateTypeId, true);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::onPostRequestFinished()
|
||||||
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
|
||||||
|
qDebug(dcHttpCommander()) << "POST reply finished";
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
|
if (!m_httpRequests.contains(reply)) {
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Device *device = m_httpRequests.take(reply);
|
||||||
|
device->setStateValue(httpPostCommanderResponseStateTypeId, data);
|
||||||
|
|
||||||
|
// Check HTTP status code
|
||||||
|
if (status != 200 || reply->error() != QNetworkReply::NoError) {
|
||||||
|
qCWarning(dcHttpCommander()) << "Request error:" << status << reply->errorString();
|
||||||
|
device->setStateValue(httpPostCommanderConnectedStateTypeId, false);
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->setStateValue(httpPostCommanderConnectedStateTypeId, true);
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::onPutRequestFinished()
|
||||||
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
|
||||||
|
qDebug(dcHttpCommander()) << "PUT reply finished";
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
|
if (!m_httpRequests.contains(reply)) {
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Device *device = m_httpRequests.take(reply);
|
||||||
|
device->setStateValue(httpPutCommanderResponseStateTypeId, data);
|
||||||
|
|
||||||
|
// Check HTTP status code
|
||||||
|
if (status != 200 || reply->error() != QNetworkReply::NoError) {
|
||||||
|
qCWarning(dcHttpCommander()) << "Request error:" << status << reply->errorString();
|
||||||
|
device->setStateValue(httpPutCommanderConnectedStateTypeId, false);
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->setStateValue(httpPutCommanderConnectedStateTypeId, true);
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DevicePluginHttpCommander::deviceRemoved(Device *device)
|
||||||
|
{
|
||||||
|
if (m_httpRequests.values().contains(device)) {
|
||||||
|
QNetworkReply *reply = m_httpRequests.key(device);
|
||||||
|
m_httpRequests.remove(reply);
|
||||||
|
// Note: will be deleted once finished
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
|
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
|
||||||
|
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
|
||||||
* *
|
* *
|
||||||
* This file is part of guh. *
|
* This file is part of guh. *
|
||||||
* *
|
* *
|
||||||
|
|
@ -23,6 +24,9 @@
|
||||||
|
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
|
#include "plugintimer.h"
|
||||||
|
|
||||||
|
#include <QNetworkReply>
|
||||||
|
|
||||||
class DevicePluginHttpCommander : public DevicePlugin
|
class DevicePluginHttpCommander : public DevicePlugin
|
||||||
{
|
{
|
||||||
|
|
@ -33,18 +37,26 @@ class DevicePluginHttpCommander : public DevicePlugin
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DevicePluginHttpCommander();
|
explicit DevicePluginHttpCommander();
|
||||||
|
~DevicePluginHttpCommander();
|
||||||
|
|
||||||
DeviceManager::HardwareResources requiredHardware() const override;
|
void init() override;
|
||||||
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
||||||
void postSetupDevice(Device *device) override;
|
void postSetupDevice(Device *device) override;
|
||||||
void deviceRemoved(Device *device) override;
|
void deviceRemoved(Device *device) override;
|
||||||
void networkManagerReplyReady(QNetworkReply *reply) override;
|
|
||||||
void guhTimer() override;
|
|
||||||
|
|
||||||
DeviceManager::DeviceError executeAction(Device *device, const Action &action) override;
|
DeviceManager::DeviceError executeAction(Device *device, const Action &action) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
PluginTimer *m_pluginTimer = nullptr;
|
||||||
QHash<QNetworkReply *, Device *> m_httpRequests;
|
QHash<QNetworkReply *, Device *> m_httpRequests;
|
||||||
|
|
||||||
|
void makeGetCall(Device *device);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onPluginTimer();
|
||||||
|
|
||||||
|
void onGetRequestFinished();
|
||||||
|
void onPostRequestFinished();
|
||||||
|
void onPutRequestFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEVICEPLUGINHTTPCOMMANDER_H
|
#endif // DEVICEPLUGINHTTPCOMMANDER_H
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,70 @@
|
||||||
{
|
{
|
||||||
"name": "http commander",
|
"name": "HttpCommander",
|
||||||
"idName": "HttpCommander",
|
"displayName": "Http Commander",
|
||||||
"id": "4e62670c-6268-4487-8dff-cccca498731a",
|
"id": "4e62670c-6268-4487-8dff-cccca498731a",
|
||||||
"vendors": [
|
"vendors": [
|
||||||
{
|
{
|
||||||
"name": "http commander",
|
"name": "httpCommander",
|
||||||
"idName": "httpCommander",
|
"displayName": "HTTP commander",
|
||||||
"id": "45d7c941-7690-43c9-92fc-fab36e1cebd0",
|
"id": "45d7c941-7690-43c9-92fc-fab36e1cebd0",
|
||||||
"deviceClasses": [
|
"deviceClasses": [
|
||||||
{
|
{
|
||||||
"id": "b101abdf-86fd-4d2e-a657-ee76044235bd",
|
"id": "b101abdf-86fd-4d2e-a657-ee76044235bd",
|
||||||
"idName": "httpPost",
|
"name": "httpPostCommander",
|
||||||
"name": "http post",
|
"displayName": "HTTP post commander",
|
||||||
"deviceIcon": "Network",
|
"deviceIcon": "Network",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["user"],
|
||||||
"basicTags": [
|
"basicTags": [
|
||||||
"Service"
|
"Service"
|
||||||
],
|
],
|
||||||
"criticalStateTypeId": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
"interfaces": ["connectable"],
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "1a3fcb23-931b-4ba1-b134-c49b656c76f7",
|
"id": "020f672e-cc9a-4b74-92dd-a92a93ab1d23",
|
||||||
"idName": "url",
|
"name": "url",
|
||||||
"name": "url or ipv4 address",
|
"displayName": "URL or IPv4 address",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "None",
|
"inputType": "None",
|
||||||
"defaultValue": "http://nymea.io"
|
"defaultValue": "https://nymea.io"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
"id": "37830ea8-2249-46e6-aaca-12164928a81a",
|
||||||
"idName": "port",
|
|
||||||
"name": "port",
|
"name": "port",
|
||||||
|
"displayName": "port",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": "80"
|
"defaultValue": "443"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
{
|
{
|
||||||
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
||||||
"idName": "reachable",
|
"name": "connected",
|
||||||
"name": "reachable",
|
"displayName": "Reachable",
|
||||||
|
"displayNameEvent": "Reachability changed",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false,
|
"defaultValue": false
|
||||||
"eventTypeName": "reachability changed"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "69f32ec8-114d-43f4-9241-1f6a57261f32",
|
"id": "69f32ec8-114d-43f4-9241-1f6a57261f32",
|
||||||
"idName": "httpResponse",
|
|
||||||
"name": "response",
|
"name": "response",
|
||||||
|
"displayName": "response",
|
||||||
|
"displayNameEvent": "Response received",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "",
|
"defaultValue": ""
|
||||||
"eventTypeName": "response received"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
{
|
{
|
||||||
"id": "5a97ca56-b334-411b-adba-116496ffe83d",
|
"id": "5a97ca56-b334-411b-adba-116496ffe83d",
|
||||||
"idName": "post",
|
|
||||||
"name": "post",
|
"name": "post",
|
||||||
|
"displayName": "Post data",
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "363119a3-c02c-4ed5-a915-11706198f3eb",
|
"id": "363119a3-c02c-4ed5-a915-11706198f3eb",
|
||||||
"idName": "postData",
|
"name": "data",
|
||||||
"name": "post data",
|
"displayName": "Data",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "",
|
"defaultValue": ""
|
||||||
"eventTypeName": "post data sent"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -73,62 +72,61 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "05bf65f5-ff13-43e3-b6ae-77019e79d8a1",
|
"id": "05bf65f5-ff13-43e3-b6ae-77019e79d8a1",
|
||||||
"idName": "httpPut",
|
"name": "httpPutCommander",
|
||||||
"name": "http put",
|
"displayName": "HTTP put commander",
|
||||||
"deviceIcon": "Network",
|
"deviceIcon": "Network",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["user"],
|
||||||
|
"interfaces": ["connectable"],
|
||||||
"basicTags": [
|
"basicTags": [
|
||||||
"Service"
|
"Service"
|
||||||
],
|
],
|
||||||
"criticalStateTypeId": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "1a3fcb23-931b-4ba1-b134-c49b656c76f7",
|
"id": "1a3fcb23-931b-4ba1-b134-c49b656c76f7",
|
||||||
"idName": "url",
|
"name": "url",
|
||||||
"name": "url or ipv4 address",
|
"displayName": "URL or IPv4 address",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "None",
|
"inputType": "None",
|
||||||
"defaultValue": "http://nymea.io"
|
"defaultValue": "https://nymea.io"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
"id": "db994349-1105-4ce5-b6fe-6fd38fbc436a",
|
||||||
"idName": "port",
|
|
||||||
"name": "port",
|
"name": "port",
|
||||||
|
"displayName": "Port",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": "80"
|
"defaultValue": "443"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
{
|
{
|
||||||
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
"id": "d102ff86-b773-48e3-a7a5-e138cb541f49",
|
||||||
"idName": "reachable",
|
"name": "connected",
|
||||||
"name": "reachable",
|
"displayName": "Reachable",
|
||||||
|
"displayNameEvent": "Reachability changed",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false,
|
"defaultValue": false
|
||||||
"eventTypeName": "reachability changed"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "69f32ec8-114d-43f4-9241-1f6a57261f32",
|
"id": "69f32ec8-114d-43f4-9241-1f6a57261f32",
|
||||||
"idName": "httpResponse",
|
|
||||||
"name": "response",
|
"name": "response",
|
||||||
|
"displayName": "Response",
|
||||||
|
"displayNameEvent": "Response received",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "",
|
"defaultValue": ""
|
||||||
"eventTypeName": "response received"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
{
|
{
|
||||||
"id": "a9f165dc-cdf1-48f0-b4b6-7c24373cb77c",
|
"id": "a9f165dc-cdf1-48f0-b4b6-7c24373cb77c",
|
||||||
"idName": "put",
|
|
||||||
"name": "put",
|
"name": "put",
|
||||||
|
"displayName": "put",
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "7742d445-8fc1-4b20-87f2-1bb35929fce1",
|
"id": "7742d445-8fc1-4b20-87f2-1bb35929fce1",
|
||||||
"idName": "putData",
|
"name": "data",
|
||||||
"name": "put data",
|
"displayName": "Data",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "",
|
"defaultValue": ""
|
||||||
"eventTypeName": "post data sent"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -136,47 +134,47 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "8f3f6dde-9db3-4237-800b-bb7f804098c9",
|
"id": "8f3f6dde-9db3-4237-800b-bb7f804098c9",
|
||||||
"idName": "httpGet",
|
"name": "httpGetCommander",
|
||||||
"name": "http get",
|
"displayName": "HTTP get",
|
||||||
"deviceIcon": "Network",
|
"deviceIcon": "Network",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["user"],
|
||||||
"basicTags": [
|
"basicTags": [
|
||||||
"Service"
|
"Service"
|
||||||
],
|
],
|
||||||
"criticalStateTypeId": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
"interfaces": ["connectable"],
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "1a3fcb23-931b-4ba1-b134-c49b656c76f7",
|
"id": "477b544b-b631-4526-a4ef-c712ff5f955d",
|
||||||
"idName": "url",
|
"name": "url",
|
||||||
"name": "Url or IPv4 Address",
|
"displayName": "URL or IPv4 Address",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "None",
|
"inputType": "None",
|
||||||
"defaultValue": "http://nymea.io"
|
"defaultValue": "https://nymea.io"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
||||||
"idName": "port",
|
"name": "port",
|
||||||
"name": "Port",
|
"displayName": "Port",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": "80"
|
"defaultValue": "443"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes":[
|
"stateTypes":[
|
||||||
{
|
{
|
||||||
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
|
"id": "0d63f815-efd1-488a-9bfa-e9f6bda540d2",
|
||||||
"idName": "reachable",
|
"name": "connected",
|
||||||
"name": "reachable",
|
"displayName": "Reachable",
|
||||||
|
"displayNameEvent": "Reachability changed",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false,
|
"defaultValue": false
|
||||||
"eventTypeName": "reachability changed"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "d81f0644-b94e-48ed-ae48-1b8ff6cebc0c",
|
"id": "d81f0644-b94e-48ed-ae48-1b8ff6cebc0c",
|
||||||
"idName": "getData",
|
"name": "response",
|
||||||
"name": "data",
|
"displayName": "Response",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "",
|
"defaultValue": "",
|
||||||
"eventTypeName": "get data received"
|
"displayNameEvent": "Response data received"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
TRANSLATIONS = translations/en_US.ts \
|
|
||||||
translations/de_DE.ts
|
|
||||||
|
|
||||||
# Note: include after the TRANSLATIONS definition
|
|
||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(guh_devicepluginhttpcommander)
|
TARGET = $$qtLibraryTarget(guh_devicepluginhttpcommander)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue