add debug categories for plugins and update man page
This commit is contained in:
parent
a8727407eb
commit
c496d26866
53
debian/guhd.1
vendored
53
debian/guhd.1
vendored
@ -21,6 +21,59 @@ Displays version information.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-no\-daemon\fR
|
||||
Run guhd in the foreground, not as daemon.
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-debug\fR, \fB\<[No\]DebugCategory>\fR
|
||||
Debug categories to enable. Prefix with \"No\" to disable. Warnings from all
|
||||
categories will be printed unless explicitly muted with "NoWarnings".
|
||||
.RS
|
||||
.TP
|
||||
Categories are:
|
||||
.IP \fIApplication\fR\ (default\ enabled)
|
||||
Print the debug messages from the core application.
|
||||
.IP \fICommandLauncher\fR\ (default\ disabled)
|
||||
Print the debug messages from the command launcher device plugin.
|
||||
.IP \fIConnection\fR\ (default\ enabled)
|
||||
Print the debug messages from the TCP connections in guh.
|
||||
.IP \fIDeviceManager\fR\ (default\ enabled)
|
||||
Print the debug messages from the device manager.
|
||||
.IP \fIEQ-3\fR\ (default\ disabled)
|
||||
Print the debug messages from eQ-3 device plugin.
|
||||
.IP \fIHardware\fR\ (default\ disabled)
|
||||
Print the debug messages from hardware resources in guh.
|
||||
.IP \fIJsonRpc\fR\ (default\ disabled)
|
||||
Print the debug messages from JSON-RPC interface.
|
||||
.IP \fILgSmartTv\fR\ (default\ disabled)
|
||||
Print the debug messages from Lg Smart Tv device plugin.
|
||||
.IP \fILircd\fR\ (default\ disabled)
|
||||
Print the debug messages from lircd device plugin.
|
||||
.IP \fILogEngine\fR\ (default\ disabled)
|
||||
Print the debug messages from logging engine.
|
||||
.IP \fIMailNotification\fR\ (default\ disabled)
|
||||
Print the debug messages from the mail notification device plugin.
|
||||
.IP \fIMock\fR\ (default\ disabled)
|
||||
Print the debug messages from the mock device plugin.
|
||||
.IP \fIOpenweahtermap\fR\ (default\ disabled)
|
||||
Print the debug messages from the open weathermap device plugin.
|
||||
.IP \fIPhilipsHue\fR\ (default\ disabled)
|
||||
Print the debug messages from the Philips Hue device plugin.
|
||||
.IP \fIRF433\fR\ (default\ disabled)
|
||||
Print the debug messages from the RF 433 MHz plugins. Each plugin which uses the RF 433 MHz
|
||||
hardware resource is in this debug caterogry.
|
||||
.IP \fIRuleEngine\fR\ (default\ enabled)
|
||||
Print the debug messages from the rule engine.
|
||||
.IP \fITune\fR\ (default\ disabled)
|
||||
Print the debug messages from the tune device plugin.
|
||||
.IP \fIUdpCommander\fR\ (default\ disabled)
|
||||
Print the debug messages from the UPD commander device plugin.
|
||||
.IP \fIWakeOnLan\fR\ (default\ disabled)
|
||||
Print the debug messages from the wake on lan device plugin.
|
||||
.IP \fIWarnings\fR\ (default\ enabled)
|
||||
Print warnings of all categories.
|
||||
.IP \fIWemo\fR\ (default\ disabled)
|
||||
Print the debug messages from the wemo device plugin.
|
||||
.IP \fIWifiDetector\fR\ (default\ disabled)
|
||||
Print the debug messages from the WiFi detector device plugin.
|
||||
|
||||
.SH SEE ALSO
|
||||
Full developer documentation at: <http://dev.guh.guru>
|
||||
.br
|
||||
|
||||
@ -21,10 +21,29 @@
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(dcApplication, "Application")
|
||||
Q_LOGGING_CATEGORY(dcDeviceManager,"DeviceManager")
|
||||
Q_LOGGING_CATEGORY(dcRuleEngine,"RuleEngine")
|
||||
Q_LOGGING_CATEGORY(dcHardware,"Hardware")
|
||||
Q_LOGGING_CATEGORY(dcConnection,"Connection")
|
||||
Q_LOGGING_CATEGORY(dcJsonRpc,"JsonRpc")
|
||||
Q_LOGGING_CATEGORY(dcLogEngine,"LogEngine")
|
||||
Q_LOGGING_CATEGORY(dcDeviceManager, "DeviceManager")
|
||||
Q_LOGGING_CATEGORY(dcRuleEngine, "RuleEngine")
|
||||
Q_LOGGING_CATEGORY(dcHardware, "Hardware")
|
||||
Q_LOGGING_CATEGORY(dcConnection, "Connection")
|
||||
Q_LOGGING_CATEGORY(dcJsonRpc, "JsonRpc")
|
||||
Q_LOGGING_CATEGORY(dcLogEngine, "LogEngine")
|
||||
|
||||
// Plugins
|
||||
#ifdef boblight
|
||||
Q_LOGGING_CATEGORY(dcBoblight, "Boblight")
|
||||
#endif
|
||||
|
||||
Q_LOGGING_CATEGORY(dcCommandLauncher, "CommandLauncher")
|
||||
Q_LOGGING_CATEGORY(dcRF433, "RF433")
|
||||
Q_LOGGING_CATEGORY(dcEQ3, "EQ-3")
|
||||
Q_LOGGING_CATEGORY(dcLgSmartTv, "LgSmartTv")
|
||||
Q_LOGGING_CATEGORY(dcLircd, "Lircd")
|
||||
Q_LOGGING_CATEGORY(dcMailNotification, "MailNotification")
|
||||
Q_LOGGING_CATEGORY(dcMock, "Mock")
|
||||
Q_LOGGING_CATEGORY(dcOpenweathermap, "Openweahtermap")
|
||||
Q_LOGGING_CATEGORY(dcPhilipsHue, "PhilipsHue")
|
||||
Q_LOGGING_CATEGORY(dcTune, "Tune")
|
||||
Q_LOGGING_CATEGORY(dcUdpCommander, "UdpCommander")
|
||||
Q_LOGGING_CATEGORY(dcWakeOnLan, "WakeOnLan")
|
||||
Q_LOGGING_CATEGORY(dcWemo, "Wemo")
|
||||
Q_LOGGING_CATEGORY(dcWifiDetector, "WifiDetector")
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
// Core / libguh
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcApplication)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcDeviceManager)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcRuleEngine)
|
||||
@ -31,4 +32,29 @@ Q_DECLARE_LOGGING_CATEGORY(dcConnection)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcLogEngine)
|
||||
|
||||
// Plugins
|
||||
|
||||
#ifdef boblight
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcBoblight)
|
||||
#endif
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcCommandLauncher)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcRF433)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcEQ3)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcLgSmartTv)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcLircd)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcMailNotification)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcMock)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcOpenweathermap)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcPhilipsHue)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcTune)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcUdpCommander)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcWakeOnLan)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcWemo)
|
||||
Q_DECLARE_LOGGING_CATEGORY(dcWifiDetector)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // LOGGINGCATEGORYS_H
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
|
||||
#include "bobclient.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include "libboblight/boblight.h"
|
||||
|
||||
@ -41,19 +42,19 @@ BobClient::BobClient(QObject *parent) :
|
||||
|
||||
bool BobClient::connect(const QString &hostname, int port)
|
||||
{
|
||||
qDebug() << "Connecting to boblightd\n";
|
||||
qCDebug(dcBoblight) << "Connecting to boblightd\n";
|
||||
m_boblight = boblight_init();
|
||||
|
||||
//try to connect, if we can't then bitch to stderr and destroy boblight
|
||||
if (!boblight_connect(m_boblight, hostname.toLatin1().data(), port, 5000000) ||
|
||||
!boblight_setpriority(m_boblight, 1))
|
||||
{
|
||||
qDebug() << "Failed to connect:" << boblight_geterror(m_boblight);
|
||||
qCWarning(dcBoblight) << "Failed to connect:" << boblight_geterror(m_boblight);
|
||||
boblight_destroy(m_boblight);
|
||||
m_connected = false;
|
||||
return false;
|
||||
}
|
||||
qDebug() << "Connection to boblightd opened\n";
|
||||
qCDebug(dcBoblight) << "Connection to boblightd opened\n";
|
||||
m_hostname = hostname;
|
||||
m_port = port;
|
||||
m_connected = true;
|
||||
@ -67,8 +68,8 @@ bool BobClient::connected() const
|
||||
|
||||
void BobClient::setPriority(int priority)
|
||||
{
|
||||
qDebug() << "setting new priority:" << priority;
|
||||
qDebug() << "setting priority to" << priority << boblight_setpriority(m_boblight, priority);
|
||||
qCDebug(dcBoblight) << "setting new priority:" << priority;
|
||||
qCDebug(dcBoblight) << "setting priority to" << priority << boblight_setpriority(m_boblight, priority);
|
||||
}
|
||||
|
||||
void BobClient::setColor(int channel, QColor color)
|
||||
@ -79,14 +80,14 @@ void BobClient::setColor(int channel, QColor color)
|
||||
}
|
||||
} else {
|
||||
m_colors[channel] = color;
|
||||
// qDebug() << "set channel" << channel << "to color" << color;
|
||||
qCDebug(dcBoblight) << "set channel" << channel << "to color" << color;
|
||||
}
|
||||
}
|
||||
|
||||
void BobClient::sync()
|
||||
{
|
||||
if(!m_connected) {
|
||||
qDebug() << "Not connected to boblight. Cannot sync";
|
||||
qCWarning(dcBoblight) << "Not connected to boblight. Cannot sync";
|
||||
return;
|
||||
}
|
||||
if(m_lastSyncTime.addMSecs(50) > QTime::currentTime()) {
|
||||
@ -95,7 +96,7 @@ void BobClient::sync()
|
||||
}
|
||||
return;
|
||||
}
|
||||
//qDebug() << "syncing";
|
||||
qCDebug(dcBoblight) << "syncing";
|
||||
m_lastSyncTime = QTime::currentTime();
|
||||
|
||||
for(int i = 0; i < lightsCount(); ++i) {
|
||||
@ -104,7 +105,7 @@ void BobClient::sync()
|
||||
rgb[0] = m_colors[i].red() * m_colors[i].alphaF();
|
||||
rgb[1] = m_colors[i].green() * m_colors[i].alphaF();
|
||||
rgb[2] = m_colors[i].blue() * m_colors[i].alphaF();
|
||||
// qDebug() << "set color" << rgb[0] << rgb[1] << rgb[2];
|
||||
qCDebug(dcBoblight) << "set color" << rgb[0] << rgb[1] << rgb[2];
|
||||
|
||||
//set all lights to the color we want and send it
|
||||
boblight_addpixel(m_boblight, i, rgb);
|
||||
@ -113,8 +114,7 @@ void BobClient::sync()
|
||||
|
||||
if (!boblight_sendrgb(m_boblight, 1, NULL)) //some error happened, probably connection broken, so bitch and try again
|
||||
{
|
||||
qDebug() << "Boblight connection error!";
|
||||
qDebug() << boblight_geterror(m_boblight);
|
||||
qCWarning(dcBoblight) << "Boblight connection error:" << boblight_geterror(m_boblight);
|
||||
boblight_destroy(m_boblight);
|
||||
m_connected = false;
|
||||
connect(m_hostname, m_port);
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include "bobclient.h"
|
||||
#include "plugininfo.h"
|
||||
@ -126,7 +127,7 @@ QPair<DeviceManager::DeviceError, QString> DevicePluginBoblight::executeAction(D
|
||||
if (!newColor.isValid()) {
|
||||
return report(DeviceManager::DeviceErrorActionParameterError, "color");
|
||||
}
|
||||
qDebug() << "executing boblight action" << newColor;
|
||||
qCDebug(dcBoblight) << "executing boblight action" << newColor;
|
||||
m_bobClient->setColor(device->paramValue("channel").toInt(), newColor);
|
||||
m_bobClient->sync();
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -126,15 +127,15 @@ DeviceManager::DeviceSetupStatus DevicePluginCommandLauncher::setupDevice(Device
|
||||
// check if script exists and if it is executable
|
||||
QFileInfo fileInfo(scriptArguments.first());
|
||||
if (!fileInfo.exists()) {
|
||||
qWarning() << "ERROR: script " << scriptArguments.first() << "does not exist.";
|
||||
qCWarning(dcCommandLauncher) << "script " << scriptArguments.first() << "does not exist.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
if (!fileInfo.isExecutable()) {
|
||||
qWarning() << "ERROR: script " << scriptArguments.first() << "is not executable. Please check the permissions.";
|
||||
qCWarning(dcCommandLauncher) << "script " << scriptArguments.first() << "is not executable. Please check the permissions.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
if (!fileInfo.isReadable()) {
|
||||
qWarning() << "ERROR: script " << scriptArguments.first() << "is not readable. Please check the permissions.";
|
||||
qCWarning(dcCommandLauncher) << "script " << scriptArguments.first() << "is not readable. Please check the permissions.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -128,10 +129,10 @@ DeviceManager::DeviceError DevicePluginConrad::executeAction(Device *device, con
|
||||
// =======================================
|
||||
// send data to driver
|
||||
if(transmitData(delay, rawData, repetitions)){
|
||||
qDebug() << "action" << pluginName() << device->name() << action.actionTypeId();
|
||||
qCDebug(dcRF433) << "transmitted successfully" << pluginName() << device->name() << action.actionTypeId();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}else{
|
||||
qDebug() << "could not transmitt" << pluginName() << device->name() << action.actionTypeId();
|
||||
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << action.actionTypeId();
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
}
|
||||
@ -143,7 +144,7 @@ void DevicePluginConrad::radioData(const QList<int> &rawData)
|
||||
return;
|
||||
}
|
||||
|
||||
// qDebug() << rawData;
|
||||
qCDebug(dcRF433) << rawData;
|
||||
|
||||
int delay = rawData.first()/10;
|
||||
QByteArray binCode;
|
||||
@ -186,5 +187,5 @@ void DevicePluginConrad::radioData(const QList<int> &rawData)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "CONRAD: " << binCode.left(binCode.length() - 24) << " ID = " << binCode.right(24);
|
||||
qCDebug(dcRF433) << "Conrad: " << binCode.left(binCode.length() - 24) << " ID = " << binCode.right(24);
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "devicepluginelro.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -152,10 +153,10 @@ DeviceManager::DeviceError DevicePluginElro::executeAction(Device *device, const
|
||||
|
||||
// send data to hardware resource
|
||||
if (transmitData(delay, rawData)) {
|
||||
qDebug() << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
} else {
|
||||
qDebug() << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
}
|
||||
@ -207,13 +208,13 @@ void DevicePluginElro::radioData(const QList<int> &rawData)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "ELRO understands this protocol: " << binCode;
|
||||
qCDebug(dcRF433) << "ELRO understands this protocol: " << binCode;
|
||||
|
||||
if (binCode.left(20) == "00000100000000000001") {
|
||||
if (binCode.right(4) == "0100") {
|
||||
qDebug() << "Motion Detector OFF";
|
||||
qCDebug(dcRF433) << "Motion Detector OFF";
|
||||
} else {
|
||||
qDebug() << "Motion Detector ON";
|
||||
qCDebug(dcRF433) << "Motion Detector ON";
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,5 +258,5 @@ void DevicePluginElro::radioData(const QList<int> &rawData)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "ELRO:" << group << buttonCode << power;
|
||||
qCDebug(dcRF433) << "Elro:" << group << buttonCode << power;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@
|
||||
#include "devicemanager.h"
|
||||
#include "types/param.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -110,12 +111,12 @@ void DevicePluginEQ3::startMonitoringAutoDevices()
|
||||
|
||||
DeviceManager::DeviceSetupStatus DevicePluginEQ3::setupDevice(Device *device)
|
||||
{
|
||||
qDebug() << "setupDevice" << device->params();
|
||||
qCDebug(dcEQ3) << "setupDevice" << device->params();
|
||||
|
||||
if(device->deviceClassId() == cubeDeviceClassId){
|
||||
foreach (MaxCube *cube, m_cubes.keys()) {
|
||||
if(cube->serialNumber() == device->paramValue("serial number").toString()){
|
||||
qDebug() << cube->serialNumber() << " already exists...";
|
||||
qCDebug(dcEQ3) << cube->serialNumber() << " already exists...";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
}
|
||||
@ -150,7 +151,7 @@ void DevicePluginEQ3::deviceRemoved(Device *device)
|
||||
|
||||
MaxCube *cube = m_cubes.key(device);
|
||||
cube->disconnectFromCube();
|
||||
qDebug() << "remove cube " << cube->serialNumber();
|
||||
qCDebug(dcEQ3) << "remove cube " << cube->serialNumber();
|
||||
m_cubes.remove(cube);
|
||||
cube->deleteLater();
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "maxcube.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
MaxCube::MaxCube(QObject *parent, QString serialNumber, QHostAddress hostAdress, quint16 port):
|
||||
QTcpSocket(parent), m_serialNumber(serialNumber), m_hostAddress(hostAdress), m_port(port)
|
||||
@ -153,25 +154,25 @@ void MaxCube::decodeHelloMessage(QByteArray data)
|
||||
m_rfAddress = list.at(1);
|
||||
m_firmware = list.at(2).toInt();
|
||||
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " HELLO message:";
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " serial number | " << m_serialNumber;
|
||||
// qDebug() << " RF address (hex) | " << m_rfAddress;
|
||||
// qDebug() << " firmware | " << m_firmware;
|
||||
// qDebug() << " Cube date | " << m_cubeDateTime.date().toString("dd.MM.yyyy");
|
||||
// qDebug() << " Cube time | " << m_cubeDateTime.time().toString("HH:mm");
|
||||
// qDebug() << " State Cube Time | " << list.at(9);
|
||||
// qDebug() << " NTP counter | " << list.at(10);
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " HELLO message:";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " serial number | " << m_serialNumber;
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << m_rfAddress;
|
||||
qCDebug(dcEQ3) << " firmware | " << m_firmware;
|
||||
qCDebug(dcEQ3) << " Cube date | " << m_cubeDateTime.date().toString("dd.MM.yyyy");
|
||||
qCDebug(dcEQ3) << " Cube time | " << m_cubeDateTime.time().toString("HH:mm");
|
||||
qCDebug(dcEQ3) << " State Cube Time | " << list.at(9);
|
||||
qCDebug(dcEQ3) << " NTP counter | " << list.at(10);
|
||||
}
|
||||
|
||||
void MaxCube::decodeMetadataMessage(QByteArray data)
|
||||
{
|
||||
QList<QByteArray> list = data.left(data.length()-2).split(',');
|
||||
QByteArray dataDecoded = QByteArray::fromBase64(list.at(2));
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " METADATA message:";
|
||||
// qDebug() << "====================================================";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " METADATA message:";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
|
||||
// parse room list
|
||||
int roomCount = dataDecoded.toHex().mid(4,2).toInt(0,16);
|
||||
@ -188,24 +189,24 @@ void MaxCube::decodeMetadataMessage(QByteArray data)
|
||||
m_roomList.append(room);
|
||||
roomRawData = roomRawData.right(roomRawData.length() - ((roomNameLength*2) + 10));
|
||||
}
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
// qDebug() << "found " << m_roomList.count() << "rooms";
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << "found " << m_roomList.count() << "rooms";
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
|
||||
// foreach (Room *room, m_roomList) {
|
||||
// qDebug() << " Room Name | " << room->roomName();
|
||||
// qDebug() << " Room ID | " << room->roomId();
|
||||
// qDebug() << " Group RF Address | " << room->groupRfAddress();
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
// }
|
||||
foreach (Room *room, m_roomList) {
|
||||
qCDebug(dcEQ3) << " Room Name | " << room->roomName();
|
||||
qCDebug(dcEQ3) << " Room ID | " << room->roomId();
|
||||
qCDebug(dcEQ3) << " Group RF Address | " << room->groupRfAddress();
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
}
|
||||
|
||||
// parse device list
|
||||
int deviceCount = roomRawData.left(2).toInt(0,16);
|
||||
QByteArray deviceRawData = roomRawData.right(roomRawData.length() - 2);
|
||||
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
// qDebug() << "found " << deviceCount << "devices";
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << "found " << deviceCount << "devices";
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
|
||||
for(int i = 0; i < deviceCount; i++){
|
||||
int deviceType = deviceRawData.left(2).toInt(0,16);
|
||||
@ -228,13 +229,13 @@ void MaxCube::decodeMetadataMessage(QByteArray data)
|
||||
}
|
||||
m_radiatorThermostatList.append(device);
|
||||
|
||||
// qDebug() << " Device Name | " << device->deviceName();
|
||||
// qDebug() << " Serial Number| " << device->serialNumber();
|
||||
// qDebug() << " Device Type String | " << device->deviceTypeString();
|
||||
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||
// qDebug() << " Room ID | " << device->roomId();
|
||||
// qDebug() << " Room Name | " << device->roomName();
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << " Device Name | " << device->deviceName();
|
||||
qCDebug(dcEQ3) << " Serial Number| " << device->serialNumber();
|
||||
qCDebug(dcEQ3) << " Device Type String | " << device->deviceTypeString();
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << device->rfAddress();
|
||||
qCDebug(dcEQ3) << " Room ID | " << device->roomId();
|
||||
qCDebug(dcEQ3) << " Room Name | " << device->roomName();
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
break;
|
||||
}
|
||||
case MaxDevice::DeviceWallThermostat:{
|
||||
@ -255,13 +256,13 @@ void MaxCube::decodeMetadataMessage(QByteArray data)
|
||||
}
|
||||
m_wallThermostatList.append(device);
|
||||
|
||||
// qDebug() << " Device Name | " << device->deviceName();
|
||||
// qDebug() << " Serial Number| " << device->serialNumber();
|
||||
// qDebug() << " Device Type String | " << device->deviceTypeString();
|
||||
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||
// qDebug() << " Room ID | " << device->roomId();
|
||||
// qDebug() << " Room Name | " << device->roomName();
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << " Device Name | " << device->deviceName();
|
||||
qCDebug(dcEQ3) << " Serial Number| " << device->serialNumber();
|
||||
qCDebug(dcEQ3) << " Device Type String | " << device->deviceTypeString();
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << device->rfAddress();
|
||||
qCDebug(dcEQ3) << " Room ID | " << device->roomId();
|
||||
qCDebug(dcEQ3) << " Room Name | " << device->roomName();
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -280,32 +281,32 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
||||
}
|
||||
QByteArray rfAddress = list.at(0);
|
||||
QByteArray dataRaw = QByteArray::fromBase64(list.at(1)).toHex();
|
||||
//int lengthData = dataRaw.left(2).toInt(0,16);
|
||||
int lengthData = dataRaw.left(2).toInt(0,16);
|
||||
if(rfAddress != dataRaw.mid(2,6)){
|
||||
qDebug() << "ERROR: rf addresses not equal!";
|
||||
qCWarning(dcEQ3) << "RF addresses not equal!";
|
||||
}
|
||||
int deviceType = dataRaw.mid(8,2).toInt(0,16);
|
||||
//QByteArray unknown = dataRaw.mid(12,6);
|
||||
|
||||
QByteArray serialNumber = QByteArray::fromHex(dataRaw.mid(16,20));
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " CONFIG message:";
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " Serial Number | " << serialNumber;
|
||||
// qDebug() << " device Type | " << deviceTypeString(deviceType);
|
||||
// qDebug() << " RF address (hex) | " << rfAddress;
|
||||
// qDebug() << " data length | " << lengthData;
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " CONFIG message:";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " Serial Number | " << serialNumber;
|
||||
qCDebug(dcEQ3) << " device Type | " << deviceTypeString(deviceType);
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << rfAddress;
|
||||
qCDebug(dcEQ3) << " data length | " << lengthData;
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
|
||||
switch (deviceType) {
|
||||
case MaxDevice::DeviceCube:{
|
||||
|
||||
m_portalEnabeld = (bool)dataRaw.mid(36,2).toInt(0,16);
|
||||
|
||||
// qDebug() << " portal enabled | " << m_portalEnabeld;
|
||||
// qDebug() << " portal URL | " << QString(QByteArray::fromHex(dataRaw.mid(170,68)));
|
||||
// qDebug() << " time zone | " << QString(QByteArray::fromHex(dataRaw.mid(428,6)));
|
||||
// qDebug() << " summer/winter time | " << QString(QByteArray::fromHex(dataRaw.mid(452,8)));
|
||||
qCDebug(dcEQ3) << " portal enabled | " << m_portalEnabeld;
|
||||
qCDebug(dcEQ3) << " portal URL | " << QString(QByteArray::fromHex(dataRaw.mid(170,68)));
|
||||
qCDebug(dcEQ3) << " time zone | " << QString(QByteArray::fromHex(dataRaw.mid(428,6)));
|
||||
qCDebug(dcEQ3) << " summer/winter time | " << QString(QByteArray::fromHex(dataRaw.mid(452,8)));
|
||||
emit cubeConfigReady();
|
||||
break;
|
||||
}
|
||||
@ -314,7 +315,7 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
||||
if(device->rfAddress() == rfAddress){
|
||||
|
||||
//int roomId = dataRaw.mid(10,2).toInt(0,16);
|
||||
//int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||
int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||
device->setComfortTemp((double)dataRaw.mid(36,2).toInt(0,16) / 2.0);
|
||||
device->setEcoTemp((double)dataRaw.mid(38,2).toInt(0,16) / 2.0);
|
||||
device->setMaxSetPointTemp((double)dataRaw.mid(40,2).toInt(0,16) / 2.0);
|
||||
@ -335,21 +336,21 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
||||
device->setValveMaximumSettings((double)dataRaw.mid(54,2).toInt(0,16)*(double)100.0/255.0);
|
||||
device->setValveOffset((double)dataRaw.mid(56,2).toInt(0,16)*100.0/255.0);
|
||||
|
||||
// qDebug() << " Room ID | " << device->roomId();
|
||||
// qDebug() << " firmware | " << firmware;
|
||||
// qDebug() << " Confort Temp. | " << device->confortTemp() << "C";
|
||||
// qDebug() << " Eco Temp. | " << device->ecoTemp() << "C";
|
||||
// qDebug() << " Max. Set Point Temp. | " << device->maxSetPointTemp() << "C";
|
||||
// qDebug() << " Min. Set Point Temp. | " << device->minSetPointTemp() << "C";
|
||||
// qDebug() << " Temp. Offset | " << device->offsetTemp() << "C";
|
||||
// qDebug() << " Window Open Temp. | " << device->windowOpenTemp() << "C";
|
||||
// qDebug() << " Window Open Duration | " << device->windowOpenDuration() << "min";
|
||||
// qDebug() << " Boost Duration | " << device->boostDuration() << "min";
|
||||
// qDebug() << " Valve value | " << device->boostValveValue() << "%";
|
||||
// qDebug() << " disclaiming run day | " << device->discalcingWeekDay();
|
||||
// qDebug() << " disclaiming run time | " << device->discalcingTime().toString("HH:mm");
|
||||
// qDebug() << " Valve Maximum Settings | " << device->valveMaximumSettings() << "%";
|
||||
// qDebug() << " Valve Offset | " << device->valveOffset() << "%";
|
||||
qCDebug(dcEQ3) << " Room ID | " << device->roomId();
|
||||
qCDebug(dcEQ3) << " firmware | " << firmware;
|
||||
//qCDebug(dcEQ3) << " Confort Temp. | " << device->confortTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Eco Temp. | " << device->ecoTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Max. Set Point Temp. | " << device->maxSetPointTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Min. Set Point Temp. | " << device->minSetPointTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Temp. Offset | " << device->offsetTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Window Open Temp. | " << device->windowOpenTemp() << "C";
|
||||
qCDebug(dcEQ3) << " Window Open Duration | " << device->windowOpenDuration() << "min";
|
||||
qCDebug(dcEQ3) << " Boost Duration | " << device->boostDuration() << "min";
|
||||
qCDebug(dcEQ3) << " Valve value | " << device->boostValveValue() << "%";
|
||||
qCDebug(dcEQ3) << " disclaiming run day | " << device->discalcingWeekDay();
|
||||
qCDebug(dcEQ3) << " disclaiming run time | " << device->discalcingTime().toString("HH:mm");
|
||||
qCDebug(dcEQ3) << " Valve Maximum Settings | " << device->valveMaximumSettings() << "%";
|
||||
qCDebug(dcEQ3) << " Valve Offset | " << device->valveOffset() << "%";
|
||||
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 58));
|
||||
emit radiatorThermostatFound();
|
||||
}
|
||||
@ -362,18 +363,18 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
||||
foreach (WallThermostat* device, m_wallThermostatList) {
|
||||
if(device->rfAddress() == rfAddress){
|
||||
//int roomId = dataRaw.mid(10,2).toInt(0,16);
|
||||
//int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||
int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||
device->setComfortTemp((double)dataRaw.mid(36,2).toInt(0,16) / 2.0);
|
||||
device->setEcoTemp((double)dataRaw.mid(38,2).toInt(0,16)/2.0);
|
||||
device->setMaxSetPointTemp((double)dataRaw.mid(40,2).toInt(0,16)/2.0);
|
||||
device->setMinSetPointTemp((double)dataRaw.mid(42,2).toInt(0,16)/2.0);
|
||||
|
||||
// qDebug() << " Room ID | " << device->roomId();
|
||||
// qDebug() << " firmware | " << firmware;
|
||||
// qDebug() << " Confort Temp. | " << device->confortTemp();
|
||||
// qDebug() << " Eco Temp. | " << device->ecoTemp();
|
||||
// qDebug() << " Max. Set Point Temp. | " << device->maxSetPointTemp();
|
||||
// qDebug() << " Min. Set Point Temp. | " << device->minSetPointTemp();
|
||||
qCDebug(dcEQ3) << " Room ID | " << device->roomId();
|
||||
qCDebug(dcEQ3) << " firmware | " << firmware;
|
||||
//qCDebug(dcEQ3) << " Confort Temp. | " << device->confortTemp();
|
||||
qCDebug(dcEQ3) << " Eco Temp. | " << device->ecoTemp();
|
||||
qCDebug(dcEQ3) << " Max. Set Point Temp. | " << device->maxSetPointTemp();
|
||||
qCDebug(dcEQ3) << " Min. Set Point Temp. | " << device->minSetPointTemp();
|
||||
|
||||
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 44));
|
||||
emit wallThermostatFound();
|
||||
@ -386,16 +387,16 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
||||
case MaxDevice::DeviceWindowContact:
|
||||
break;
|
||||
default:
|
||||
qWarning() << "unknown device type: " << deviceType;
|
||||
qCWarning(dcEQ3) << "unknown device type: " << deviceType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
{
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " LIVE message:";
|
||||
// qDebug() << "====================================================";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " LIVE message:";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
|
||||
QByteArray rawDataAll = QByteArray::fromBase64(data).toHex();
|
||||
QList<QByteArray> deviceMessageList = splitMessage(rawDataAll);
|
||||
@ -435,24 +436,24 @@ void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
device->setCurrentTemperatre((double)rawData.right(2).toInt(0,16) / 10.0);
|
||||
}
|
||||
|
||||
// qDebug() << " raw data | " << rawData;
|
||||
// qDebug() << " device type | " << device->deviceTypeString();
|
||||
// qDebug() << " device name | " << device->deviceName();
|
||||
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||
// qDebug() << " initCode | " << initCode;
|
||||
// qDebug() << " information valid | " << device->informationValid();
|
||||
// qDebug() << " error occured | " << device->errorOccured();
|
||||
// qDebug() << " is answere to a command | " << device->isAnswereToCommand();
|
||||
// qDebug() << " initialized | " << device->initialized();
|
||||
// qDebug() << " battery low | " << device->batteryLow();
|
||||
// qDebug() << " link status OK | " << device->linkStatusOK();
|
||||
// qDebug() << " panel locked | " << device->panelLocked();
|
||||
// qDebug() << " gateway known | " << device->gatewayKnown();
|
||||
// qDebug() << " DST settings active | " << device->dtsActive();
|
||||
// qDebug() << " device mode | " << device->deviceModeString();
|
||||
// qDebug() << " Temperatur Setpoint | " << device->setpointTemperature();
|
||||
// qDebug() << " Current Temp | " << device->currentTemperature();
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << " raw data | " << rawData;
|
||||
qCDebug(dcEQ3) << " device type | " << device->deviceTypeString();
|
||||
qCDebug(dcEQ3) << " device name | " << device->deviceName();
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << device->rfAddress();
|
||||
qCDebug(dcEQ3) << " initCode | " << initCode;
|
||||
qCDebug(dcEQ3) << " information valid | " << device->informationValid();
|
||||
qCDebug(dcEQ3) << " error occured | " << device->errorOccured();
|
||||
qCDebug(dcEQ3) << " is answere to a command | " << device->isAnswereToCommand();
|
||||
qCDebug(dcEQ3) << " initialized | " << device->initialized();
|
||||
qCDebug(dcEQ3) << " battery low | " << device->batteryLow();
|
||||
qCDebug(dcEQ3) << " link status OK | " << device->linkStatusOK();
|
||||
qCDebug(dcEQ3) << " panel locked | " << device->panelLocked();
|
||||
qCDebug(dcEQ3) << " gateway known | " << device->gatewayKnown();
|
||||
qCDebug(dcEQ3) << " DST settings active | " << device->dtsActive();
|
||||
qCDebug(dcEQ3) << " device mode | " << device->deviceModeString();
|
||||
qCDebug(dcEQ3) << " Temperatur Setpoint | " << device->setpointTemperature();
|
||||
qCDebug(dcEQ3) << " Current Temp | " << device->currentTemperature();
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
|
||||
emit wallThermostatDataUpdated();
|
||||
}
|
||||
@ -480,22 +481,22 @@ void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
device->setValvePosition((double)rawData.mid(12,2).toInt(0,16));
|
||||
device->setSetpointTemperatre((double)rawData.mid(14,2).toInt(0,16)/ 2.0);
|
||||
|
||||
// qDebug() << " device type | " << device->deviceTypeString();
|
||||
// qDebug() << " device name | " << device->deviceName();
|
||||
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||
// qDebug() << " information valid | " << device->informationValid();
|
||||
// qDebug() << " error occured | " << device->errorOccured();
|
||||
// qDebug() << " is answere to a command | " << device->isAnswereToCommand();
|
||||
// qDebug() << " initialized | " << device->initialized();
|
||||
// qDebug() << " battery low | " << device->batteryLow();
|
||||
// qDebug() << " link status OK | " << device->linkStatusOK();
|
||||
// qDebug() << " panel locked | " << device->panelLocked();
|
||||
// qDebug() << " gateway known | " << device->gatewayKnown();
|
||||
// qDebug() << " DST settings active | " << device->dtsActive();
|
||||
// qDebug() << " device mode | " << device->deviceModeString();
|
||||
// qDebug() << " valve position | " << device->valvePosition() << "%";
|
||||
// qDebug() << " Temperatur Setpoint | " << device->setpointTemperature() << " deg C";
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
qCDebug(dcEQ3) << " device type | " << device->deviceTypeString();
|
||||
qCDebug(dcEQ3) << " device name | " << device->deviceName();
|
||||
qCDebug(dcEQ3) << " RF address (hex) | " << device->rfAddress();
|
||||
qCDebug(dcEQ3) << " information valid | " << device->informationValid();
|
||||
qCDebug(dcEQ3) << " error occured | " << device->errorOccured();
|
||||
qCDebug(dcEQ3) << " is answere to a command | " << device->isAnswereToCommand();
|
||||
qCDebug(dcEQ3) << " initialized | " << device->initialized();
|
||||
qCDebug(dcEQ3) << " battery low | " << device->batteryLow();
|
||||
qCDebug(dcEQ3) << " link status OK | " << device->linkStatusOK();
|
||||
qCDebug(dcEQ3) << " panel locked | " << device->panelLocked();
|
||||
qCDebug(dcEQ3) << " gateway known | " << device->gatewayKnown();
|
||||
qCDebug(dcEQ3) << " DST settings active | " << device->dtsActive();
|
||||
qCDebug(dcEQ3) << " device mode | " << device->deviceModeString();
|
||||
qCDebug(dcEQ3) << " valve position | " << device->valvePosition() << "%";
|
||||
qCDebug(dcEQ3) << " Temperatur Setpoint | " << device->setpointTemperature() << " deg C";
|
||||
qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
|
||||
emit radiatorThermostatDataUpdated();
|
||||
}
|
||||
@ -506,12 +507,12 @@ void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
//QByteArray windowOpenRawData = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
||||
//bool windowOpen = (bool)windowOpenRawData.mid(5,1).toInt();
|
||||
|
||||
// qDebug() << " raw data | " << rawData;
|
||||
// qDebug() << " device type name | " << "Window Contact";
|
||||
// qDebug() << " RF address (hex) | " << rfAddress;
|
||||
// qDebug() << " window open code | " << windowOpenRawData;
|
||||
// qDebug() << " window open | " << windowOpen;
|
||||
// qDebug() << "-------------------------|-------------------------";
|
||||
// qCDebug(dcEQ3) << " raw data | " << rawData;
|
||||
// qCDebug(dcEQ3) << " device type name | " << "Window Contact";
|
||||
// qCDebug(dcEQ3) << " RF address (hex) | " << rfAddress;
|
||||
// qCDebug(dcEQ3) << " window open code | " << windowOpenRawData;
|
||||
// qCDebug(dcEQ3) << " window open | " << windowOpen;
|
||||
// qCDebug(dcEQ3) << "-------------------------|-------------------------";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -535,19 +536,19 @@ void MaxCube::parseWeeklyProgram(QByteArray data)
|
||||
{
|
||||
for(int i=0; i < 7; i++){
|
||||
QByteArray dayData = data.left(52);
|
||||
//qDebug() << weekDayString(i);
|
||||
//qCDebug(dcEQ3) << weekDayString(i);
|
||||
for(int i = 0; i < 52; i+=4){
|
||||
QByteArray element = fillBin(QByteArray::number(dayData.mid(i,4).toInt(0,16),2),16);
|
||||
//int minutes = element.right(9).toInt(0,2) * 5;
|
||||
//int hours = (minutes / 60) % 24;
|
||||
//minutes = minutes % 60;
|
||||
//QTime time = QTime(hours,minutes);
|
||||
//qDebug() << (double)element.left(7).toInt(0,2) / 2 << "\t" << "deg. until" << "\t" << time.toString("HH:mm");
|
||||
//qCDebug(dcEQ3) << (double)element.left(7).toInt(0,2) / 2 << "\t" << "deg. until" << "\t" << time.toString("HH:mm");
|
||||
}
|
||||
data = data.right(data.length() - 52);
|
||||
}
|
||||
if(!data.isEmpty()){
|
||||
//qDebug() << " ? | " << data;
|
||||
//qCDebug(dcEQ3) << " ? | " << data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,10 +558,10 @@ void MaxCube::decodeNewDeviceFoundMessage(QByteArray data)
|
||||
return;
|
||||
}
|
||||
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " NEW DEVICE message:";
|
||||
// qDebug() << "====================================================";
|
||||
// qDebug() << " Serial Number | " << QByteArray::fromBase64(data);
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " NEW DEVICE message:";
|
||||
qCDebug(dcEQ3) << "====================================================";
|
||||
qCDebug(dcEQ3) << " Serial Number | " << QByteArray::fromBase64(data);
|
||||
|
||||
}
|
||||
|
||||
@ -657,7 +658,7 @@ QList<QByteArray> MaxCube::splitMessage(QByteArray data)
|
||||
messageList.append(data.mid(2,length));
|
||||
data = data.right(data.length() - (length+2));
|
||||
}
|
||||
//qDebug() << messageList;
|
||||
//qCDebug(dcEQ3) << messageList;
|
||||
return messageList;
|
||||
}
|
||||
|
||||
@ -681,12 +682,12 @@ void MaxCube::connectionStateChanged(const QAbstractSocket::SocketState &socketS
|
||||
{
|
||||
switch (socketState) {
|
||||
case QAbstractSocket::ConnectedState:
|
||||
qDebug() << "-> connected to cube " << m_serialNumber << m_hostAddress.toString();
|
||||
qCDebug(dcEQ3) << "connected to cube " << m_serialNumber << m_hostAddress.toString();
|
||||
emit cubeConnectionStatusChanged(true);
|
||||
break;
|
||||
case QAbstractSocket::UnconnectedState:
|
||||
m_cubeInitialized = false;
|
||||
qDebug() << "-> disconnected from cube " << m_serialNumber << m_hostAddress.toString();
|
||||
qCDebug(dcEQ3) << "disconnected from cube " << m_serialNumber << m_hostAddress.toString();
|
||||
emit cubeConnectionStatusChanged(false);
|
||||
break;
|
||||
default:
|
||||
@ -696,7 +697,7 @@ void MaxCube::connectionStateChanged(const QAbstractSocket::SocketState &socketS
|
||||
|
||||
void MaxCube::error(QAbstractSocket::SocketError error)
|
||||
{
|
||||
qDebug() << "connection error (" << m_serialNumber << "): " << error;
|
||||
qCWarning(dcEQ3) << "connection error (" << m_serialNumber << "): " << error;
|
||||
emit cubeConnectionStatusChanged(false);
|
||||
}
|
||||
|
||||
@ -712,7 +713,7 @@ void MaxCube::readData()
|
||||
|
||||
void MaxCube::processCubeData(const QByteArray &data)
|
||||
{
|
||||
//qDebug() << "data" << data;
|
||||
//qCDebug(dcEQ3) << "data" << data;
|
||||
if(data.startsWith("H")){
|
||||
decodeHelloMessage(data.right(data.length() -2 ));
|
||||
return;
|
||||
@ -752,22 +753,22 @@ void MaxCube::processCubeData(const QByteArray &data)
|
||||
}
|
||||
// ACK message
|
||||
if(data.startsWith("A")){
|
||||
qDebug() << "cube ACK!";
|
||||
qCDebug(dcEQ3) << "cube ACK!";
|
||||
emit cubeACK();
|
||||
return;
|
||||
}
|
||||
qDebug() << " -> unknown message!!!!!!! from cube:" << data;
|
||||
qCWarning(dcEQ3) << " -> unknown message!!!!!!! from cube:" << data;
|
||||
}
|
||||
|
||||
void MaxCube::enablePairingMode()
|
||||
{
|
||||
qDebug() << "-------> enable pairing mode! press the boost button for min. 3 seconds";
|
||||
qCDebug(dcEQ3) << "-------> enable pairing mode! press the boost button for min. 3 seconds";
|
||||
write("n:003c\r\n");
|
||||
}
|
||||
|
||||
void MaxCube::disablePairingMode()
|
||||
{
|
||||
qDebug() << " ----> disable pairing mode!";
|
||||
qCDebug(dcEQ3) << " ----> disable pairing mode!";
|
||||
write("x:\r\n");
|
||||
}
|
||||
|
||||
@ -781,7 +782,7 @@ void MaxCube::refresh()
|
||||
|
||||
void MaxCube::customRequest(QByteArray data)
|
||||
{
|
||||
qDebug() << " ----> custom request" << data;
|
||||
qCDebug(dcEQ3) << " ----> custom request" << data;
|
||||
write(data + "\r\n");
|
||||
}
|
||||
|
||||
@ -816,7 +817,7 @@ void MaxCube::setDeviceSetpointTemp(QByteArray rfAddress, int roomId, double tem
|
||||
// add date/time until (000000 = forever)
|
||||
data.append("000000");
|
||||
|
||||
qDebug() << "sending command " << temperatureData << data;
|
||||
qCDebug(dcEQ3) << "sending command " << temperatureData << data;
|
||||
|
||||
write("s:" + QByteArray::fromHex(data).toBase64() + "\r\n");
|
||||
}
|
||||
@ -840,7 +841,7 @@ void MaxCube::setDeviceAutoMode(QByteArray rfAddress, int roomId, ActionId actio
|
||||
temperatureData.append("00000000");
|
||||
data.append("000000");
|
||||
|
||||
qDebug() << "sending command " << temperatureData << data;
|
||||
qCDebug(dcEQ3) << "sending command " << temperatureData << data;
|
||||
|
||||
write("s:" + QByteArray::fromHex(data).toBase64() + "\r\n");
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -180,10 +181,10 @@ DeviceManager::DeviceError DevicePluginIntertechno::executeAction(Device *device
|
||||
// =======================================
|
||||
// send data to hardware resource
|
||||
if (transmitData(delay, rawData)) {
|
||||
qDebug() << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
} else {
|
||||
qWarning() << "ERROR: could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
}
|
||||
@ -383,6 +384,6 @@ void DevicePluginIntertechno::radioData(const QList<int> &rawData)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "INTERTECHNO: family code = " << familyCode << "button code =" << buttonCode << power;
|
||||
qCDebug(dcRF433) << "Intertechno: family code = " << familyCode << "button code =" << buttonCode << power;
|
||||
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
#include "devicepluginleynew.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -174,10 +175,10 @@ DeviceManager::DeviceError DevicePluginLeynew::executeAction(Device *device, con
|
||||
// =======================================
|
||||
// send data to hardware resource
|
||||
if(transmitData(delay, rawData, repetitions)){
|
||||
qDebug() << "transmitted" << pluginName() << device->name() << action.id();
|
||||
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << action.id();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}else{
|
||||
qDebug() << "could not transmitt" << pluginName() << device->name() << action.id();
|
||||
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << action.id();
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -218,7 +219,7 @@ void DevicePluginLgSmartTv::deviceRemoved(Device *device)
|
||||
}
|
||||
|
||||
TvDevice *tvDevice= m_tvList.key(device);
|
||||
qDebug() << "remove LG SmartTv " << tvDevice->modelName();
|
||||
qCDebug(dcLgSmartTv) << "remove LG SmartTv " << tvDevice->modelName();
|
||||
tvDevice->endPairing();
|
||||
m_tvList.remove(tvDevice);
|
||||
delete tvDevice;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "tvdevice.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
TvDevice::TvDevice(QObject *parent, UpnpDeviceDescriptor upnpDeviceDescriptor) :
|
||||
UpnpDevice(parent, upnpDeviceDescriptor)
|
||||
@ -171,7 +172,7 @@ void TvDevice::sendCommand(TvDevice::RemoteKey key, ActionId actionId)
|
||||
|
||||
void TvDevice::setupEventHandler()
|
||||
{
|
||||
//qDebug() << "set up event handler " << m_hostAddress.toString() << m_port;
|
||||
qCDebug(dcLgSmartTv) << "set up event handler " << hostAddress().toString() << port();
|
||||
m_eventHandler = new TvEventHandler(this, hostAddress(), port());
|
||||
connect(m_eventHandler, &TvEventHandler::eventOccured, this, &TvDevice::eventOccured);
|
||||
}
|
||||
@ -214,7 +215,7 @@ void TvDevice::queryChannelInformation()
|
||||
|
||||
void TvDevice::parseVolumeInformation(const QByteArray &data)
|
||||
{
|
||||
//qDebug() << printXmlData(data);
|
||||
qCDebug(dcLgSmartTv) << printXmlData(data);
|
||||
QXmlStreamReader xml(data);
|
||||
|
||||
while(!xml.atEnd() && !xml.hasError()) {
|
||||
@ -232,7 +233,7 @@ void TvDevice::parseVolumeInformation(const QByteArray &data)
|
||||
|
||||
void TvDevice::parseChannelInformation(const QByteArray &data)
|
||||
{
|
||||
//qDebug() << printXmlData(data);
|
||||
qCDebug(dcLgSmartTv) << printXmlData(data);
|
||||
QXmlStreamReader xml(data);
|
||||
|
||||
while(!xml.atEnd() && !xml.hasError()) {
|
||||
@ -274,8 +275,7 @@ QString TvDevice::printXmlData(QByteArray data)
|
||||
}
|
||||
}
|
||||
if(reader.hasError()) {
|
||||
qDebug() << "ERROR reading XML device information: " << reader.errorString();
|
||||
qDebug() << "--------------------------------------------";
|
||||
qCWarning(dcLgSmartTv) << "error reading XML device information: " << reader.errorString();
|
||||
}
|
||||
return xmlOut;
|
||||
}
|
||||
@ -292,7 +292,7 @@ void TvDevice::replyFinished(QNetworkReply *reply)
|
||||
|
||||
if(reply == m_showKeyReplay) {
|
||||
if(status != 200) {
|
||||
//qWarning() << "ERROR: could not request to show pairing key on screen " << status;
|
||||
qCWarning(dcLgSmartTv) << "ERROR: could not request to show pairing key on screen " << status;
|
||||
}
|
||||
m_showKeyReplay->deleteLater();
|
||||
}
|
||||
@ -300,10 +300,10 @@ void TvDevice::replyFinished(QNetworkReply *reply)
|
||||
if(status != 200) {
|
||||
m_pairingStatus = false;
|
||||
emit pairingFinished(false);
|
||||
//qWarning() << "ERROR: could not pair with device" << status;
|
||||
qCWarning(dcLgSmartTv) << "could not pair with device" << status;
|
||||
} else {
|
||||
m_pairingStatus = true;
|
||||
//qDebug() << "successfully paired with tv " << modelName();
|
||||
qCDebug(dcLgSmartTv) << "successfully paired with tv " << modelName();
|
||||
emit pairingFinished(true);
|
||||
}
|
||||
m_requestPairingReplay->deleteLater();
|
||||
@ -312,7 +312,7 @@ void TvDevice::replyFinished(QNetworkReply *reply)
|
||||
if(reply == m_finishingPairingReplay) {
|
||||
if(status == 200) {
|
||||
m_pairingStatus = false;
|
||||
//qDebug() << "successfully unpaired from tv " << modelName();
|
||||
qCDebug(dcLgSmartTv) << "successfully unpaired from tv " << modelName();
|
||||
}
|
||||
m_finishingPairingReplay->deleteLater();
|
||||
}
|
||||
@ -320,10 +320,10 @@ void TvDevice::replyFinished(QNetworkReply *reply)
|
||||
if(reply == m_sendCommandReplay) {
|
||||
if (status != 200) {
|
||||
emit sendCommandFinished(false,m_actionId);
|
||||
qWarning() << "ERROR: could not send comand" << status;
|
||||
qCWarning(dcLgSmartTv) << "ERROR: could not send comand" << status;
|
||||
} else {
|
||||
m_pairingStatus = true;
|
||||
//qDebug() << "successfully sent command to tv " << modelName();
|
||||
qCDebug(dcLgSmartTv) << "successfully sent command to tv " << modelName();
|
||||
emit sendCommandFinished(true,m_actionId);
|
||||
refresh();
|
||||
}
|
||||
@ -352,7 +352,7 @@ void TvDevice::eventOccured(const QByteArray &data)
|
||||
// if the tv suspends, it will send a byebye message, which means
|
||||
// the pairing will be closed.
|
||||
if(data.contains("api type=\"pairing\"") && data.contains("byebye")) {
|
||||
qDebug() << "--> tv ended pairing";
|
||||
qCDebug(dcLgSmartTv) << "--> tv ended pairing";
|
||||
m_pairingStatus = false;
|
||||
m_reachable = false;
|
||||
emit statusChanged();
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "tveventhandler.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
TvEventHandler::TvEventHandler(QObject *parent, QHostAddress host, int port) :
|
||||
QTcpServer(parent),m_host(host),m_port(port)
|
||||
@ -41,7 +42,7 @@ void TvEventHandler::incomingConnection(qintptr socket)
|
||||
connect(tcpSocket, &QTcpSocket::disconnected, this, &TvEventHandler::discardClient);
|
||||
tcpSocket->setSocketDescriptor(socket);
|
||||
|
||||
//qDebug() << "incomming connection" << s->peerAddress().toString() << s->peerName();
|
||||
qCDebug(dcLgSmartTv) << "incomming connection" << tcpSocket->peerAddress().toString() << tcpSocket->peerName();
|
||||
}
|
||||
|
||||
void TvEventHandler::readClient()
|
||||
@ -86,9 +87,8 @@ void TvEventHandler::readClient()
|
||||
// check if we got header
|
||||
if (data.startsWith("POST") && !m_expectingData) {
|
||||
m_expectingData = true;
|
||||
// QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*"));
|
||||
// qDebug() << "==================================";
|
||||
// qDebug() << "event occured" << "http://" << m_host.toString() << ":" << m_port << tokens[1];
|
||||
QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*"));
|
||||
qCDebug(dcLgSmartTv) << "event occured" << "http://" << m_host.toString() << ":" << m_port << tokens[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include "lircdclient.h"
|
||||
|
||||
@ -83,11 +84,11 @@ void DevicePluginLircd::buttonPressed(const QString &remoteName, const QString &
|
||||
}
|
||||
}
|
||||
if (!remote) {
|
||||
qDebug() << "Unhandled remote" << remoteName << buttonName;
|
||||
qCWarning(dcLircd) << "Unhandled remote" << remoteName << buttonName;
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "found remote" << remoteName << supportedDevices().first().eventTypes().count();
|
||||
qCDebug(dcLircd) << "found remote" << remoteName << supportedDevices().first().eventTypes().count();
|
||||
ParamList params;
|
||||
Param buttonParam("button", buttonName);
|
||||
params.append(buttonParam);
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "lircdclient.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLocalSocket>
|
||||
@ -34,22 +35,22 @@ bool LircClient::connect()
|
||||
{
|
||||
m_socket->connectToServer("/var/run/lirc/lircd", QIODevice::ReadWrite);
|
||||
if (!m_socket->isOpen()) {
|
||||
qWarning() << "--> Lirc daemon NOT available.";
|
||||
qCWarning(dcLircd) << "--> Lirc daemon NOT available.";
|
||||
return false;
|
||||
}
|
||||
m_socket->write("LIST\n");
|
||||
qDebug() << "--> Lirc daemon available.";
|
||||
qCDebug(dcLircd) << "--> Lirc daemon available.";
|
||||
return true;
|
||||
}
|
||||
|
||||
void LircClient::readyRead()
|
||||
{
|
||||
// qDebug() << "got data" << m_socket->readAll();
|
||||
qCDebug(dcLircd) << "got data" << m_socket->readAll();
|
||||
|
||||
bool inBlock = false;
|
||||
while (m_socket->canReadLine()) {
|
||||
QByteArray line = m_socket->readLine().trimmed();
|
||||
//qDebug() << "got line:" << line;
|
||||
qCDebug(dcLircd) << "got line:" << line;
|
||||
if (line == "BEGIN") {
|
||||
inBlock = true;
|
||||
continue;
|
||||
@ -58,7 +59,7 @@ void LircClient::readyRead()
|
||||
if (m_socket->readLine().trimmed() == "SUCCESS") {
|
||||
readRemotes();
|
||||
} else {
|
||||
qWarning() << "Error reading remotes from Lircd";
|
||||
qCWarning(dcLircd) << "Error reading remotes from Lircd";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -70,10 +71,10 @@ void LircClient::readyRead()
|
||||
if (!inBlock) {
|
||||
QList<QByteArray> parts = line.split(' ');
|
||||
if (parts.count() != 4) {
|
||||
qWarning() << "Don't understand IR command. ignoring...";
|
||||
qCWarning(dcLircd) << "Don't understand IR command. ignoring...";
|
||||
continue;
|
||||
}
|
||||
qDebug() << "emitting buttonpress";
|
||||
qCDebug(dcLircd) << "emitting buttonpress";
|
||||
emit buttonPressed(QString(parts.at(3)), QString(parts.at(2)), parts.at(1).toInt());
|
||||
}
|
||||
}
|
||||
@ -83,7 +84,7 @@ void LircClient::readRemotes()
|
||||
{
|
||||
m_socket->readLine(); // IGNORE DATA
|
||||
int remoteCount = m_socket->readLine().trimmed().toInt();
|
||||
qDebug() << "found" << remoteCount << "lirc remotes";
|
||||
qCDebug(dcLircd) << "found" << remoteCount << "lirc remotes";
|
||||
for (int i = 0; i < remoteCount; i++) {
|
||||
QByteArray line = m_socket->readLine().trimmed();
|
||||
m_remotes.append(line);
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "smtpclient.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
SmtpClient::SmtpClient(QObject *parent):
|
||||
QObject(parent)
|
||||
@ -293,7 +294,7 @@ void SmtpClient::setRecipient(const QString &rcpt)
|
||||
|
||||
void SmtpClient::socketError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
qWarning() << "ERROR: mail socket -> " << error << m_socket->errorString();
|
||||
qCWarning(dcMailNotification) << "ERROR: mail socket -> " << error << m_socket->errorString();
|
||||
}
|
||||
|
||||
void SmtpClient::send(const QString &data)
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -46,7 +47,7 @@ DeviceManager::HardwareResources DevicePluginMock::requiredHardware() const
|
||||
DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms)
|
||||
{
|
||||
Q_UNUSED(deviceClassId)
|
||||
qDebug() << "starting mock discovery:" << params;
|
||||
qCDebug(dcMock) << "starting mock discovery:" << params;
|
||||
m_discoveredDeviceCount = params.paramValue("resultCount").toInt();
|
||||
QTimer::singleShot(1000, this, SLOT(emitDevicesDiscovered()));
|
||||
return DeviceManager::DeviceErrorAsync;
|
||||
@ -54,14 +55,14 @@ DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId
|
||||
|
||||
DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device)
|
||||
{
|
||||
qDebug() << "Mockdevice created returning true"
|
||||
qCDebug(dcMock) << "Mockdevice created returning true"
|
||||
<< device->paramValue("name").toString()
|
||||
<< device->paramValue("httpport").toInt()
|
||||
<< device->paramValue("async").toBool()
|
||||
<< device->paramValue("broken").toBool();
|
||||
|
||||
if (device->paramValue("broken").toBool()) {
|
||||
qWarning() << "This device is intentionally broken.";
|
||||
qCWarning(dcMock) << "This device is intentionally broken.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device)
|
||||
m_daemons.insert(device, daemon);
|
||||
|
||||
if (!daemon->isListening()) {
|
||||
qWarning() << "HTTP port opening failed.";
|
||||
qCWarning(dcMock) << "HTTP port opening failed.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
@ -167,7 +168,7 @@ void DevicePluginMock::triggerEvent(const EventTypeId &id)
|
||||
|
||||
Event event(id, device->id());
|
||||
|
||||
qDebug() << "Emitting event " << event.eventTypeId();
|
||||
qCDebug(dcMock) << "Emitting event " << event.eventTypeId();
|
||||
emit emitEvent(event);
|
||||
}
|
||||
|
||||
@ -202,7 +203,7 @@ void DevicePluginMock::emitDevicesDiscovered()
|
||||
|
||||
void DevicePluginMock::emitDeviceSetupFinished()
|
||||
{
|
||||
qDebug() << "emitting setup finised";
|
||||
qCDebug(dcMock) << "emitting setup finised";
|
||||
Device *device = m_asyncSetupDevices.takeFirst();
|
||||
if (device->paramValue("broken").toBool()) {
|
||||
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "plugin/deviceclass.h"
|
||||
#include "plugin/deviceplugin.h"
|
||||
#include "types/statetype.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QTcpSocket>
|
||||
#include <QDebug>
|
||||
@ -113,7 +114,7 @@ void HttpDaemon::discardClient()
|
||||
QTcpSocket* socket = (QTcpSocket*)sender();
|
||||
socket->deleteLater();
|
||||
|
||||
qDebug() << "Connection closed";
|
||||
qCDebug(dcMock) << "Connection closed";
|
||||
}
|
||||
|
||||
QString HttpDaemon::generateHeader()
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
@ -95,13 +96,6 @@ DeviceManager::DeviceSetupStatus DevicePluginOpenweathermap::setupDevice(Device
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
// foreach (Device *d, myDevices()) {
|
||||
// if(d->paramValue("id").toString() == device->paramValue("id").toString()){
|
||||
// qWarning() << QString("ERROR: Location " + d->paramValue("location").toString() + " with id " + d->paramValue("id").toString() + ") " + " already added: ");
|
||||
// return DeviceManager::DeviceSetupStatusFailure;
|
||||
// }
|
||||
// }
|
||||
|
||||
device->setName("Weather from OpenWeatherMap (" + device->paramValue("location").toString() + ")");
|
||||
update(device);
|
||||
|
||||
@ -242,15 +236,15 @@ void DevicePluginOpenweathermap::processAutodetectResponse(QByteArray data)
|
||||
if (dataMap.contains("lon") && dataMap.contains("lat")) {
|
||||
m_longitude = dataMap.value("lon").toDouble();
|
||||
m_latitude = dataMap.value("lat").toDouble();
|
||||
qDebug() << "----------------------------------------";
|
||||
qDebug() << "Autodetection of location: ";
|
||||
qDebug() << "----------------------------------------";
|
||||
qDebug() << " name:" << m_cityName;
|
||||
qDebug() << " country:" << m_country;
|
||||
qDebug() << " WAN IP:" << m_wanIp.toString();
|
||||
qDebug() << " latitude:" << m_latitude;
|
||||
qDebug() << " longitude:" << m_longitude;
|
||||
qDebug() << "----------------------------------------";
|
||||
qCDebug(dcOpenweathermap) << "----------------------------------------";
|
||||
qCDebug(dcOpenweathermap) << "Autodetection of location: ";
|
||||
qCDebug(dcOpenweathermap) << "----------------------------------------";
|
||||
qCDebug(dcOpenweathermap) << " name:" << m_cityName;
|
||||
qCDebug(dcOpenweathermap) << " country:" << m_country;
|
||||
qCDebug(dcOpenweathermap) << " WAN IP:" << m_wanIp.toString();
|
||||
qCDebug(dcOpenweathermap) << " latitude:" << m_latitude;
|
||||
qCDebug(dcOpenweathermap) << " longitude:" << m_longitude;
|
||||
qCDebug(dcOpenweathermap) << "----------------------------------------";
|
||||
searchGeoLocation(m_latitude, m_longitude);
|
||||
}
|
||||
}
|
||||
@ -261,7 +255,7 @@ void DevicePluginOpenweathermap::processSearchResponse(QByteArray data)
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
||||
|
||||
if(error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "failed to parse data" << data << ":" << error.errorString();
|
||||
qCWarning(dcOpenweathermap) << "failed to parse data" << data << ":" << error.errorString();
|
||||
}
|
||||
|
||||
QVariantMap dataMap = jsonDoc.toVariant().toMap();
|
||||
@ -286,7 +280,7 @@ void DevicePluginOpenweathermap::processGeoSearchResponse(QByteArray data)
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
||||
|
||||
if(error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "failed to parse data" << data << ":" << error.errorString();
|
||||
qCWarning(dcOpenweathermap) << "failed to parse data" << data << ":" << error.errorString();
|
||||
}
|
||||
|
||||
QVariantMap dataMap = jsonDoc.toVariant().toMap();
|
||||
@ -333,7 +327,7 @@ void DevicePluginOpenweathermap::processWeatherData(const QByteArray &data, Devi
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "failed to parse weather data for device " << device->name() << ": " << data << ":" << error.errorString();
|
||||
qCWarning(dcOpenweathermap) << "failed to parse weather data for device " << device->name() << ": " << data << ":" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "types/param.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -246,7 +247,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Request error:" << status << reply->errorString();
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
@ -257,7 +258,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Request error:" << status << reply->errorString();
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
@ -269,7 +270,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Refresh Hue Light request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Refresh Hue Light request error:" << status << reply->errorString();
|
||||
onBridgeError(device);
|
||||
reply->deleteLater();
|
||||
return;
|
||||
@ -282,7 +283,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Refresh Hue Bridge request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Refresh Hue Bridge request error:" << status << reply->errorString();
|
||||
onBridgeError(device);
|
||||
reply->deleteLater();
|
||||
return;
|
||||
@ -295,7 +296,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Refresh Hue Light request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Refresh Hue Light request error:" << status << reply->errorString();
|
||||
onBridgeError(actionInfo.first);
|
||||
emit actionExecutionFinished(actionInfo.second, DeviceManager::DeviceErrorHardwareNotAvailable);
|
||||
reply->deleteLater();
|
||||
@ -310,7 +311,7 @@ void DevicePluginPhilipsHue::networkManagerReplyReady(QNetworkReply *reply)
|
||||
|
||||
// check HTTP status code
|
||||
if (status != 200) {
|
||||
qWarning() << "Set name of Hue Light request error:" << status << reply->errorString();
|
||||
qCWarning(dcPhilipsHue) << "Set name of Hue Light request error:" << status << reply->errorString();
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
@ -432,13 +433,13 @@ void DevicePluginPhilipsHue::processLightRefreshResponse(Device *device, const Q
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
// check response error
|
||||
if (data.contains("error")) {
|
||||
qWarning() << "Failed to refresh Hue Light:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to refresh Hue Light:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -453,13 +454,13 @@ void DevicePluginPhilipsHue::processBridgeRefreshResponse(Device *device, const
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
// check response error
|
||||
if (data.contains("error")) {
|
||||
qWarning() << "Failed to refresh Hue Bridge:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to refresh Hue Bridge:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -485,14 +486,14 @@ void DevicePluginPhilipsHue::processSetNameResponse(Device *device, const QByteA
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
// check response error
|
||||
if (data.contains("error")) {
|
||||
qWarning() << "Failed to set name of Hue:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to set name of Hue:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
@ -511,14 +512,14 @@ void DevicePluginPhilipsHue::processPairingResponse(const DevicePluginPhilipsHue
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
// check response error
|
||||
if (data.contains("error")) {
|
||||
qWarning() << "Failed to pair Hue Bridge:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to pair Hue Bridge:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
@ -538,7 +539,7 @@ void DevicePluginPhilipsHue::processInformationResponse(const DevicePluginPhilip
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
@ -547,7 +548,7 @@ void DevicePluginPhilipsHue::processInformationResponse(const DevicePluginPhilip
|
||||
|
||||
// check response error
|
||||
if (response.contains("error")) {
|
||||
qWarning() << "Failed to get information from Hue Bridge:" << response.value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to get information from Hue Bridge:" << response.value("error").toMap().value("description").toString();
|
||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure);
|
||||
return;
|
||||
}
|
||||
@ -592,14 +593,14 @@ void DevicePluginPhilipsHue::processActionResponse(Device *device, const ActionI
|
||||
|
||||
// check JSON error
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Hue Bridge json error in response" << error.errorString();
|
||||
qCWarning(dcPhilipsHue) << "Hue Bridge json error in response" << error.errorString();
|
||||
emit actionExecutionFinished(actionId, DeviceManager::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
// check response error
|
||||
if (data.contains("error")) {
|
||||
qWarning() << "Failed to execute Hue action:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
qCWarning(dcPhilipsHue) << "Failed to execute Hue action:" << jsonDoc.toVariant().toList().first().toMap().value("error").toMap().value("description").toString();
|
||||
emit actionExecutionFinished(actionId, DeviceManager::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "deviceplugintune.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
DevicePluginTune::DevicePluginTune()
|
||||
{
|
||||
@ -151,7 +152,7 @@ void DevicePluginTune::tuneConnectionStatusChanged(const bool &connected)
|
||||
void DevicePluginTune::updateMood(const QVariantMap &message)
|
||||
{
|
||||
QVariantMap mood = message.value("mood").toMap();
|
||||
//qDebug () << QJsonDocument::fromVariant(message).toJson();
|
||||
qCDebug(dcTune) << QJsonDocument::fromVariant(message).toJson();
|
||||
Device *device = deviceManager()->findConfiguredDevice(DeviceId(mood.value("deviceId").toString()));
|
||||
if (device) {
|
||||
QVariantMap states = mood.value("states").toMap();
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "jsonrpcserver.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
extern PluginId pluginId;
|
||||
extern DeviceClassId moodDeviceClassId;
|
||||
@ -103,7 +104,7 @@ bool JsonRpcServer::sync(QList<Device *> deviceList)
|
||||
m_requests.insert(m_id, message);
|
||||
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromVariant(message);
|
||||
qDebug() << jsonDoc.toJson();
|
||||
qCDebug(dcTune) << jsonDoc.toJson();
|
||||
m_manager->sendData(jsonDoc.toJson(QJsonDocument::Compact));
|
||||
return true;
|
||||
}
|
||||
@ -143,7 +144,7 @@ void JsonRpcServer::executeAction(Device *device, const Action &action)
|
||||
m_requests.insert(m_id, message);
|
||||
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromVariant(message);
|
||||
qDebug() << jsonDoc.toJson();
|
||||
qCDebug(dcTune) << jsonDoc.toJson();
|
||||
m_manager->sendData(jsonDoc.toJson(QJsonDocument::Compact));
|
||||
}
|
||||
|
||||
@ -172,7 +173,7 @@ void JsonRpcServer::handleResponse(const QVariantMap &response)
|
||||
int responseId = response.value("id").toInt();
|
||||
|
||||
if (!m_requests.contains(responseId)) {
|
||||
qWarning() << "ERROR: got a response without a corresponding request!!!!";
|
||||
qCWarning(dcTune) << "got a response without a corresponding request!!!!";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,7 +182,7 @@ void JsonRpcServer::handleResponse(const QVariantMap &response)
|
||||
|
||||
// Note: maby we have to do something if any request fails
|
||||
if (!response.value("success").toBool()) {
|
||||
qWarning() << "ERROR: for request:" << request << response.value("error").toString();
|
||||
qCWarning(dcTune) << "error for request:" << request << response.value("error").toString();
|
||||
}
|
||||
|
||||
// check if this is a response to an action execution
|
||||
@ -196,7 +197,7 @@ void JsonRpcServer::processData(const QByteArray &data)
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
||||
|
||||
if(error.error != QJsonParseError::NoError) {
|
||||
qDebug() << "failed to parse data" << data << ":" << error.errorString();
|
||||
qCWarning(dcTune) << "failed to parse data" << data << ":" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -204,7 +205,7 @@ void JsonRpcServer::processData(const QByteArray &data)
|
||||
|
||||
// check if the message has an id
|
||||
if (!message.contains("id")) {
|
||||
qWarning() << "ERROR: message does not contain a valid id" << message;
|
||||
qCWarning(dcTune) << "message does not contain a valid id" << message;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -216,7 +217,7 @@ void JsonRpcServer::processData(const QByteArray &data)
|
||||
|
||||
// otherwise we need a method
|
||||
if (!message.contains("method")) {
|
||||
qWarning() << "ERROR: message does not contain a valid method" << message;
|
||||
qCWarning(dcTune) << "message does not contain a valid method" << message;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "tunemanager.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
TuneManager::TuneManager(int port, QObject *parent) :
|
||||
QObject(parent),
|
||||
@ -48,7 +49,7 @@ void TuneManager::tuneConnected()
|
||||
QTcpSocket *socket = m_server->nextPendingConnection();
|
||||
|
||||
if (m_tune) {
|
||||
qWarning() << "--> ATTENTION: tune already connected! connection refused.";
|
||||
qCWarning(dcTune) << "tune already connected! connection refused.";
|
||||
socket->disconnect();
|
||||
delete socket;
|
||||
return;
|
||||
@ -59,14 +60,14 @@ void TuneManager::tuneConnected()
|
||||
connect(m_tune, &QTcpSocket::readyRead, this, &TuneManager::readData);
|
||||
connect(m_tune, &QTcpSocket::disconnected, this, &TuneManager::tuneDisconnected);
|
||||
|
||||
qDebug() << " --> tune connected:" << m_tune->peerAddress().toString() << m_port;
|
||||
qCDebug(dcTune) << "Tune connected:" << m_tune->peerAddress().toString() << m_port;
|
||||
m_connected = true;
|
||||
emit tuneConnectionStatusChanged(true);
|
||||
}
|
||||
|
||||
void TuneManager::tuneDisconnected()
|
||||
{
|
||||
qWarning() << " --> tune disconnected:" << m_tune->peerAddress().toString();
|
||||
qCWarning(dcTune) << "Tune disconnected:" << m_tune->peerAddress().toString();
|
||||
m_connected = false;
|
||||
emit tuneConnectionStatusChanged(false);
|
||||
delete m_tune;
|
||||
@ -96,18 +97,18 @@ bool TuneManager::start()
|
||||
|
||||
QHostAddress localhost = QHostAddress(QHostAddress::LocalHost);
|
||||
if(!m_server->listen(localhost, m_port)) {
|
||||
qWarning() << "ERROR: Tune server can not listen on" << localhost << m_port;
|
||||
qCWarning(dcTune) << "Tune server can not listen on" << localhost << m_port;
|
||||
delete m_server;
|
||||
return false;
|
||||
}
|
||||
qDebug() << "--> Tune server started" << localhost << m_port;
|
||||
qCDebug(dcTune) << "Tune server started" << localhost << m_port;
|
||||
connect(m_server, &QTcpServer::newConnection, this, &TuneManager::tuneConnected);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TuneManager::stop()
|
||||
{
|
||||
qDebug() << "--> close Tune server" << m_server->serverAddress().toString();
|
||||
qCDebug(dcTune) << "close Tune server" << m_server->serverAddress().toString();
|
||||
m_server->close();
|
||||
delete m_server;
|
||||
m_server = 0;
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
#include "devicepluginudpcommander.h"
|
||||
#include "plugin/device.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
DevicePluginUdpCommander::DevicePluginUdpCommander()
|
||||
{
|
||||
@ -82,14 +83,14 @@ DeviceManager::DeviceSetupStatus DevicePluginUdpCommander::setupDevice(Device *d
|
||||
bool portOk = false;
|
||||
int port = device->paramValue("port").toInt(&portOk);
|
||||
if (!portOk || port <= 0 || port > 65535) {
|
||||
qWarning() << "ERROR: UDP commander" << device->paramValue("name") << ": invalid port:" << device->paramValue("port").toString() << ".";
|
||||
qCWarning(dcUdpCommander) << device->paramValue("name") << ": invalid port:" << device->paramValue("port").toString() << ".";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
QUdpSocket *udpSocket = new QUdpSocket(this);
|
||||
|
||||
if (!udpSocket->bind(QHostAddress::Any, port)) {
|
||||
qWarning() << "ERROR: UDP commander" << device->paramValue("name") << "can't bind to port" << port << ".";
|
||||
qCWarning(dcUdpCommander) << device->paramValue("name") << "can't bind to port" << port << ".";
|
||||
delete udpSocket;
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
@ -125,7 +126,7 @@ void DevicePluginUdpCommander::readPendingDatagrams()
|
||||
|
||||
if (datagram == device->paramValue("command").toByteArray() ||
|
||||
datagram == device->paramValue("command").toByteArray() + "\n") {
|
||||
qDebug() << device->paramValue("name").toString() << " got command from" << sender.toString() << senderPort;
|
||||
qCDebug(dcUdpCommander) << device->paramValue("name").toString() << " got command from" << sender.toString() << senderPort;
|
||||
emit emitEvent(Event(commandReceivedEventTypeId, device->id()));
|
||||
socket->writeDatagram("OK\n", sender, senderPort);
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "devicepluginunitec.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -60,6 +61,23 @@ DeviceManager::HardwareResources DevicePluginUnitec::requiredHardware() const
|
||||
return DeviceManager::HardwareResourceRadio433;
|
||||
}
|
||||
|
||||
DeviceManager::DeviceSetupStatus DevicePluginUnitec::setupDevice(Device *device)
|
||||
{
|
||||
if (device->deviceClassId() != switchDeviceClassId) {
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
|
||||
foreach (Device* d, myDevices()) {
|
||||
if (d->paramValue("Channel").toString() == device->paramValue("Channel").toString()) {
|
||||
qCWarning(dcRF433) << "Unitec switch with channel " << device->paramValue("Channel").toString() << "already added.";
|
||||
return DeviceManager::DeviceSetupStatusFailure;
|
||||
}
|
||||
}
|
||||
|
||||
device->setName("Unitec switch 48111 (" + device->paramValue("Channel").toString() + ")");
|
||||
return DeviceManager::DeviceSetupStatusSuccess;
|
||||
}
|
||||
|
||||
DeviceManager::DeviceError DevicePluginUnitec::executeAction(Device *device, const Action &action)
|
||||
{
|
||||
QList<int> rawData;
|
||||
@ -111,10 +129,10 @@ DeviceManager::DeviceError DevicePluginUnitec::executeAction(Device *device, con
|
||||
// =======================================
|
||||
// send data to hardware resource
|
||||
if(transmitData(delay, rawData)){
|
||||
qDebug() << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}else{
|
||||
qDebug() << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -62,32 +63,6 @@ DevicePluginWakeOnLan::DevicePluginWakeOnLan()
|
||||
{
|
||||
}
|
||||
|
||||
//QList<DeviceClass> DevicePluginWakeOnLan::supportedDevices() const
|
||||
//{
|
||||
// QList<DeviceClass> ret;
|
||||
|
||||
// DeviceClass deviceClassWakeOnLan(pluginId(), supportedVendors().first().id(), wolDeviceClassId);
|
||||
// deviceClassWakeOnLan.setName("Wake On Lan");
|
||||
|
||||
// QList<ParamType> wolParams;
|
||||
// ParamType nameParam("name", QVariant::String);
|
||||
// wolParams.append(nameParam);
|
||||
// ParamType wolParam("mac", QVariant::String);
|
||||
// wolParams.append(wolParam);
|
||||
|
||||
|
||||
// QList<ActionType> wolActions;
|
||||
// ActionType wolAction(wolActionTypeId);
|
||||
// wolAction.setName("wakeup");
|
||||
// wolActions.append(wolAction);
|
||||
|
||||
// deviceClassWakeOnLan.setParamTypes(wolParams);
|
||||
// deviceClassWakeOnLan.setActions(wolActions);
|
||||
|
||||
// ret.append(deviceClassWakeOnLan);
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
DeviceManager::HardwareResources DevicePluginWakeOnLan::requiredHardware() const
|
||||
{
|
||||
return DeviceManager::HardwareResourceNone;
|
||||
@ -95,8 +70,8 @@ DeviceManager::HardwareResources DevicePluginWakeOnLan::requiredHardware() const
|
||||
|
||||
DeviceManager::DeviceError DevicePluginWakeOnLan::executeAction(Device *device, const Action &action)
|
||||
{
|
||||
qDebug() << "execute action " << action.actionTypeId().toString();
|
||||
if(action.actionTypeId() == wolActionTypeId){
|
||||
qCDebug(dcWakeOnLan) << "wake up" << device->name();
|
||||
wakeup(device->paramValue("mac").toString());
|
||||
}
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
@ -109,9 +84,8 @@ void DevicePluginWakeOnLan::wakeup(QString mac)
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
packet.append(QByteArray::fromHex(mac.remove(':').toLocal8Bit()));
|
||||
}
|
||||
qDebug() << "created magic packet:" << packet.toHex();
|
||||
qCDebug(dcWakeOnLan) << "created magic packet:" << packet.toHex();
|
||||
QUdpSocket udpSocket;
|
||||
udpSocket.writeDatagram(packet.data(), packet.size(), QHostAddress::Broadcast, 9);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QNetworkReply>
|
||||
@ -150,7 +151,7 @@ void DevicePluginWemo::networkManagerReplyReady(QNetworkReply *reply)
|
||||
if (reply->error()) {
|
||||
// give only error if we don't already know that is unreachable
|
||||
if (device->stateValue(reachableStateTypeId).toBool()) {
|
||||
qWarning() << "ERROR: WeMo reply error: " << reply->errorString();
|
||||
qCWarning(dcWemo) << "WeMo reply error: " << reply->errorString();
|
||||
}
|
||||
device->setStateValue(reachableStateTypeId, false);
|
||||
} else {
|
||||
@ -163,7 +164,7 @@ void DevicePluginWemo::networkManagerReplyReady(QNetworkReply *reply)
|
||||
if (reply->error()) {
|
||||
// give only error if we don't already know that is unreachable
|
||||
if (device->stateValue(reachableStateTypeId).toBool()) {
|
||||
qWarning() << "ERROR: WeMo reply error: " << reply->errorString();
|
||||
qCWarning(dcWemo) << "WeMo reply error: " << reply->errorString();
|
||||
}
|
||||
device->setStateValue(reachableStateTypeId, false);
|
||||
} else {
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
#include "plugin/device.h"
|
||||
#include "devicemanager.h"
|
||||
#include "plugininfo.h"
|
||||
#include "loggingcategorys.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@ -78,8 +79,7 @@ void DevicePluginWifiDetector::processFinished(int exitCode, QProcess::ExitStatu
|
||||
p->deleteLater();
|
||||
|
||||
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
||||
qWarning() << "error performing network scan:";
|
||||
qWarning() << p->readAllStandardError();
|
||||
qCWarning(dcWifiDetector) << "error performing network scan:" << p->readAllStandardError();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
||||
application.setApplicationName("guhd");
|
||||
application.setApplicationVersion(GUH_VERSION_STRING);
|
||||
|
||||
// filter for core and libguh
|
||||
s_loggingFilters.insert("Application", true);
|
||||
s_loggingFilters.insert("Warnings", true);
|
||||
s_loggingFilters.insert("DeviceManager", true);
|
||||
@ -61,28 +62,51 @@ int main(int argc, char *argv[])
|
||||
s_loggingFilters.insert("Hardware", false);
|
||||
s_loggingFilters.insert("LogEngine", false);
|
||||
|
||||
// plugins
|
||||
#ifdef boblight
|
||||
s_loggingFilters.insert("Boblight", false);
|
||||
#endif
|
||||
s_loggingFilters.insert("CommandLauncher", false);
|
||||
s_loggingFilters.insert("RF433", false);
|
||||
s_loggingFilters.insert("EQ-3", false);
|
||||
s_loggingFilters.insert("LgSmartTv", false);
|
||||
s_loggingFilters.insert("Lircd", false);
|
||||
s_loggingFilters.insert("MailNotification", false);
|
||||
s_loggingFilters.insert("Mock", false);
|
||||
s_loggingFilters.insert("Openweahtermap", false);
|
||||
s_loggingFilters.insert("PhilipsHue", false);
|
||||
s_loggingFilters.insert("Tune", false);
|
||||
s_loggingFilters.insert("UdpCommander", false);
|
||||
s_loggingFilters.insert("WakeOnLan", false);
|
||||
s_loggingFilters.insert("Wemo", false);
|
||||
s_loggingFilters.insert("WifiDetector", false);
|
||||
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QString applicationDescription = QString("\nguh ( /[guːh]/ ) is an open source home automation server, which allows to\n"
|
||||
"control a lot of different devices from many different manufacturers.\n"
|
||||
"control a lot of different devices from many different manufacturers.\n\n"
|
||||
"guhd %1 (C) 2014-2015 guh\n"
|
||||
"Released under the GNU GENERAL PUBLIC LICENSE Version 2.").arg(GUH_VERSION_STRING);
|
||||
|
||||
parser.setApplicationDescription(applicationDescription);
|
||||
|
||||
QString debugDescription = QString("Debug categories to enable. Prefix with \"No\" to disable. Warnings from all categories will be printed unless explicitly muted with \"NoWarnings\". \nCategories are:");
|
||||
foreach (const QString &filterName, s_loggingFilters.keys()) {
|
||||
debugDescription += "\n" + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
||||
QCommandLineOption foregroundOption(QStringList() << "n" << "no-daemon", QCoreApplication::translate("main", "Run guhd in the foreground, not as daemon."));
|
||||
parser.addOption(foregroundOption);
|
||||
|
||||
QString debugDescription = QString("Debug categories to enable. Prefix with \"No\" to disable. Warnings from all categories will be printed unless explicitly muted with \"NoWarnings\". \n\nCategories are:");
|
||||
QStringList sortedFilterList = QStringList(s_loggingFilters.keys());
|
||||
sortedFilterList.sort();
|
||||
foreach (const QString &filterName, sortedFilterList) {
|
||||
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
||||
}
|
||||
QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "[No]DebugCategory");
|
||||
parser.addOption(debugOption);
|
||||
|
||||
QCommandLineOption foregroundOption(QStringList() << "n" << "no-daemon", QCoreApplication::translate("main", "Run guhd in the foreground, not as daemon."));
|
||||
parser.addOption(foregroundOption);
|
||||
|
||||
parser.process(application);
|
||||
|
||||
// check debug area
|
||||
foreach (QString debugArea, parser.values(debugOption)) {
|
||||
bool enable = !debugArea.startsWith("No");
|
||||
debugArea.remove(QRegExp("^No"));
|
||||
|
||||
Reference in New Issue
Block a user