add debug categories to each plugin

fix loading vendorId
improoved man page
improoved help message
add extern ids to extern-plugininfo.h
This commit is contained in:
Simon Stürz 2015-06-30 18:57:44 +02:00 committed by Michael Zanetti
parent 515c3c0c2a
commit 37c2d0219d
68 changed files with 226 additions and 245 deletions

54
debian/guhd.1 vendored
View File

@ -1,6 +1,6 @@
.\" Manpage for guhd. .\" Manpage for guhd.
.\" Contact simon.stuerz@guh.guru to correct errors or typos. .\" Contact simon.stuerz@guh.guru to correct errors or typos.
.TH man 1 "May 2015" "1.0" "guhd man page" .TH man 1 "June 2015" "1.1" "guhd man page"
.SH NAME .SH NAME
guhd \- Server for home automation systems guhd \- Server for home automation systems
.SH SYNOPSIS .SH SYNOPSIS
@ -23,8 +23,9 @@ Displays version information.
Run guhd in the foreground, not as daemon. Run guhd in the foreground, not as daemon.
.TP .TP
\fB\-d\fR, \fB\-\-debug\fR, \fB\<[No\]DebugCategory>\fR \fB\-d\fR, \fB\-\-debug\fR, \fB\<[No\]DebugCategory>\fR
Debug categories to enable. Prefix with \"No\" to disable. Warnings from all Debug categories to enable. In order to disable a category which is enabled by
categories will be printed unless explicitly muted with "NoWarnings". default, you can add \"No\" to the category. Warnings from all
categories will be printed unless they are explicitly muted with "NoWarnings".
.RS .RS
.TP .TP
\fBMain\ debug\ categories:\fR \fBMain\ debug\ categories:\fR
@ -44,42 +45,17 @@ Print the debug messages from logging engine.
Print the debug messages from the rule engine. Print the debug messages from the rule engine.
.TP .TP
\fBDebug\ categories\ for\ plugins:\fR \fBDebug\ categories\ for\ plugins:\fR
.IP \fICommandLauncher\fR\ (default\ disabled) Since guh loads the plugins dynamically, the list of supported
Print the debug messages from the command launcher device plugin. plugin debug categories depends on your plugin installation. Please use
.IP \fIDateTime\fR\ (default\ disabled) the \fB-h\fR command to see which categories are available for your system.
Print the debug messages from the date/time device plugin. .SH EXAMPLES
.IP \fIEQ-3\fR\ (default\ disabled) .TP
Print the debug messages from eQ-3 device plugin. To start guhd in the foreground and read the debug messages from the Hardware:
.IP \fILgSmartTv\fR\ (default\ disabled) .IP $ guhd -n -d Hardware
Print the debug messages from Lg Smart Tv device plugin. .TP
.IP \fIKodi\fR\ (default\ disabled) To start guhd in the foreground, disable debug messages from the DeviceManager
Print the debug messages from kodi device plugin. and enable debug messages for JsonRpc and LogEngine:
.IP \fILircd\fR\ (default\ disabled) .IP $ guhd -n -d NoDeviceManager JsonRpc LogEngine
Print the debug messages from lircd device plugin.
.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 \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 .SH SEE ALSO
Full developer documentation at: <http://dev.guh.guru> Full developer documentation at: <http://dev.guh.guru>
.br .br

View File

@ -226,18 +226,21 @@ DeviceManager::~DeviceManager()
} }
} }
QList<QJsonObject> DeviceManager::pluginNames() QStringList DeviceManager::pluginSearchDirs()
{ {
QStringList searchDirs; QStringList searchDirs;
searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/deviceplugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/deviceplugins";
return searchDirs;
}
QList<QJsonObject> DeviceManager::pluginsMetadata()
{
QList<QJsonObject> pluginList; QList<QJsonObject> pluginList;
foreach (const QString &path, searchDirs) { foreach (const QString &path, pluginSearchDirs()) {
QDir dir(path); QDir dir(path);
qCDebug(dcDeviceManager) << "Loading plugins from:" << dir.absolutePath();
foreach (const QString &entry, dir.entryList()) { foreach (const QString &entry, dir.entryList()) {
QFileInfo fi; QFileInfo fi;
if (entry.startsWith("libguh_deviceplugin") && entry.endsWith(".so")) { if (entry.startsWith("libguh_deviceplugin") && entry.endsWith(".so")) {
@ -767,13 +770,7 @@ DeviceManager::DeviceError DeviceManager::executeAction(const Action &action)
void DeviceManager::loadPlugins() void DeviceManager::loadPlugins()
{ {
QStringList searchDirs; foreach (const QString &path, pluginSearchDirs()) {
searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/deviceplugins";
foreach (const QString &path, searchDirs) {
QDir dir(path); QDir dir(path);
qCDebug(dcDeviceManager) << "Loading plugins from:" << dir.absolutePath(); qCDebug(dcDeviceManager) << "Loading plugins from:" << dir.absolutePath();
foreach (const QString &entry, dir.entryList()) { foreach (const QString &entry, dir.entryList()) {
@ -1317,3 +1314,4 @@ DeviceManager::DeviceError DeviceManager::verifyParam(const ParamType &paramType
qCWarning(dcDeviceManager) << "Parameter name" << param.name() << "does not match with ParamType name" << paramType.name(); qCWarning(dcDeviceManager) << "Parameter name" << param.name() << "does not match with ParamType name" << paramType.name();
return DeviceErrorInvalidParameter; return DeviceErrorInvalidParameter;
} }

View File

@ -88,7 +88,8 @@ public:
explicit DeviceManager(QObject *parent = 0); explicit DeviceManager(QObject *parent = 0);
~DeviceManager(); ~DeviceManager();
static QList<QJsonObject> pluginNames(); static QStringList pluginSearchDirs();
static QList<QJsonObject> pluginsMetadata();
QList<DevicePlugin*> plugins() const; QList<DevicePlugin*> plugins() const;
DevicePlugin* plugin(const PluginId &id) const; DevicePlugin* plugin(const PluginId &id) const;
@ -157,7 +158,6 @@ private:
DeviceError verifyParam(const ParamType &paramType, const Param &param); DeviceError verifyParam(const ParamType &paramType, const Param &param);
private: private:
QHash<VendorId, Vendor> m_supportedVendors; QHash<VendorId, Vendor> m_supportedVendors;
QHash<VendorId, QList<DeviceClassId> > m_vendorDeviceMap; QHash<VendorId, QList<DeviceClassId> > m_vendorDeviceMap;
QHash<DeviceClassId, DeviceClass> m_supportedDevices; QHash<DeviceClassId, DeviceClass> m_supportedDevices;

View File

@ -28,24 +28,3 @@ Q_LOGGING_CATEGORY(dcConnection, "Connection")
Q_LOGGING_CATEGORY(dcJsonRpc, "JsonRpc") Q_LOGGING_CATEGORY(dcJsonRpc, "JsonRpc")
Q_LOGGING_CATEGORY(dcLogEngine, "LogEngine") 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(dcDateTime, "DateTime")
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")
//Q_LOGGING_CATEGORY(dcKodi, "Kodi")

View File

@ -32,31 +32,4 @@ Q_DECLARE_LOGGING_CATEGORY(dcConnection)
Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc) Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc)
Q_DECLARE_LOGGING_CATEGORY(dcLogEngine) 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(dcDateTime)
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)
//Q_DECLARE_LOGGING_CATEGORY(dcKodi)
#endif // LOGGINGCATEGORYS_H #endif // LOGGINGCATEGORYS_H

View File

@ -21,7 +21,7 @@
#include "bobclient.h" #include "bobclient.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
#include "libboblight/boblight.h" #include "libboblight/boblight.h"

View File

@ -50,7 +50,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "loggingcategories.h"
#include "bobclient.h" #include "bobclient.h"
#include "plugininfo.h" #include "plugininfo.h"

View File

@ -1,6 +1,7 @@
{ {
"name": "Boblight",
"id": "8c5e8d4c-b5ed-4bfe-b30d-35c2790ec100", "id": "8c5e8d4c-b5ed-4bfe-b30d-35c2790ec100",
"name": "Boblight",
"idName": "Boblight",
"vendors": [ "vendors": [
{ {
"name": "Boblight", "name": "Boblight",

View File

@ -105,7 +105,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>

View File

@ -1,5 +1,6 @@
{ {
"name": "Application and script launcher", "name": "Application and script launcher",
"idName": "CommandLauncher",
"id": "5d37b796-4872-4eab-a7af-94ca9ddd8199", "id": "5d37b796-4872-4eab-a7af-94ca9ddd8199",
"vendors": [ "vendors": [
{ {

View File

@ -50,7 +50,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -129,10 +128,10 @@ DeviceManager::DeviceError DevicePluginConrad::executeAction(Device *device, con
// ======================================= // =======================================
// send data to driver // send data to driver
if(transmitData(delay, rawData, repetitions)){ if(transmitData(delay, rawData, repetitions)){
qCDebug(dcRF433) << "transmitted successfully" << pluginName() << device->name() << action.actionTypeId(); qCDebug(dcConrad) << "transmitted successfully" << pluginName() << device->name() << action.actionTypeId();
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
}else{ }else{
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << action.actionTypeId(); qCWarning(dcConrad) << "could not transmitt" << pluginName() << device->name() << action.actionTypeId();
return DeviceManager::DeviceErrorHardwareNotAvailable; return DeviceManager::DeviceErrorHardwareNotAvailable;
} }
} }
@ -144,7 +143,7 @@ void DevicePluginConrad::radioData(const QList<int> &rawData)
return; return;
} }
qCDebug(dcRF433) << rawData; qCDebug(dcConrad) << rawData;
int delay = rawData.first()/10; int delay = rawData.first()/10;
QByteArray binCode; QByteArray binCode;
@ -187,5 +186,5 @@ void DevicePluginConrad::radioData(const QList<int> &rawData)
return; return;
} }
qCDebug(dcRF433) << "Conrad: " << binCode.left(binCode.length() - 24) << " ID = " << binCode.right(24); qCDebug(dcConrad) << "Conrad: " << binCode.left(binCode.length() - 24) << " ID = " << binCode.right(24);
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "Conrad", "name": "Conrad",
"idName": "Conrad",
"id": "1fd1a076-f229-4ec6-b501-48ddd15935e4", "id": "1fd1a076-f229-4ec6-b501-48ddd15935e4",
"vendors": [ "vendors": [
{ {
"name": "Conrad Electronic", "name": "Conrad Electronic",
"idName": "conrad",
"id": "986cf06f-3ef1-4271-b2a3-2cc277ebecb6", "id": "986cf06f-3ef1-4271-b2a3-2cc277ebecb6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "alarm.h" #include "alarm.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
Alarm::Alarm(QObject *parent) : Alarm::Alarm(QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "countdown.h" #include "countdown.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
Countdown::Countdown(const QString &name, const QTime &time, const bool &repeating, QObject *parent) : Countdown::Countdown(const QString &name, const QTime &time, const bool &repeating, QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -101,7 +101,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QJsonDocument> #include <QJsonDocument>
#include <QUrlQuery> #include <QUrlQuery>

View File

@ -1,9 +1,11 @@
{ {
"name": "Time", "name": "Time",
"idName": "DateTime",
"id": "c26014c6-87fb-4233-85ed-01d18625018d", "id": "c26014c6-87fb-4233-85ed-01d18625018d",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -47,7 +47,6 @@
#include "devicepluginelro.h" #include "devicepluginelro.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -153,10 +152,10 @@ DeviceManager::DeviceError DevicePluginElro::executeAction(Device *device, const
// send data to hardware resource // send data to hardware resource
if (transmitData(delay, rawData)) { if (transmitData(delay, rawData)) {
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCDebug(dcElro) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else { } else {
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCWarning(dcElro) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorHardwareNotAvailable; return DeviceManager::DeviceErrorHardwareNotAvailable;
} }
} }
@ -208,13 +207,13 @@ void DevicePluginElro::radioData(const QList<int> &rawData)
return; return;
} }
qCDebug(dcRF433) << "ELRO understands this protocol: " << binCode; qCDebug(dcElro) << "ELRO understands this protocol: " << binCode;
if (binCode.left(20) == "00000100000000000001") { if (binCode.left(20) == "00000100000000000001") {
if (binCode.right(4) == "0100") { if (binCode.right(4) == "0100") {
qCDebug(dcRF433) << "Motion Detector OFF"; qCDebug(dcElro) << "Motion Detector OFF";
} else { } else {
qCDebug(dcRF433) << "Motion Detector ON"; qCDebug(dcElro) << "Motion Detector ON";
} }
} }
@ -258,5 +257,5 @@ void DevicePluginElro::radioData(const QList<int> &rawData)
return; return;
} }
qCDebug(dcRF433) << "Elro:" << group << buttonCode << power; qCDebug(dcElro) << "Elro:" << group << buttonCode << power;
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "Elro", "name": "Elro",
"idName": "Elro",
"id": "2b267f81-d9ae-4f4f-89a0-7386b547cfd3", "id": "2b267f81-d9ae-4f4f-89a0-7386b547cfd3",
"vendors": [ "vendors": [
{ {
"name": "Elro", "name": "Elro",
"idName": "elro",
"id": "435a13a0-65ca-4f0c-94c1-e5873b258db5", "id": "435a13a0-65ca-4f0c-94c1-e5873b258db5",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -72,7 +72,6 @@
#include "devicemanager.h" #include "devicemanager.h"
#include "types/param.h" #include "types/param.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>

View File

@ -1,9 +1,11 @@
{ {
"name": "eQ-3", "name": "eQ-3",
"idName": "EQ3",
"id": "f324c43c-9680-48d8-852a-93b2227139b9", "id": "f324c43c-9680-48d8-852a-93b2227139b9",
"vendors": [ "vendors": [
{ {
"name": "eQ-3", "name": "eQ-3",
"idName": "eq3",
"id": "2cac0645-855e-44fa-837e-1cab0ae4304c", "id": "2cac0645-855e-44fa-837e-1cab0ae4304c",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "maxcube.h" #include "maxcube.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
MaxCube::MaxCube(QObject *parent, QString serialNumber, QHostAddress hostAdress, quint16 port): MaxCube::MaxCube(QObject *parent, QString serialNumber, QHostAddress hostAdress, quint16 port):
QTcpSocket(parent), m_serialNumber(serialNumber), m_hostAddress(hostAdress), m_port(port) QTcpSocket(parent), m_serialNumber(serialNumber), m_hostAddress(hostAdress), m_port(port)

View File

@ -19,6 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "maxcubediscovery.h" #include "maxcubediscovery.h"
#include "extern-plugininfo.h"
MaxCubeDiscovery::MaxCubeDiscovery(QObject *parent) : MaxCubeDiscovery::MaxCubeDiscovery(QObject *parent) :
QObject(parent) QObject(parent)

View File

@ -19,6 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "maxdevice.h" #include "maxdevice.h"
#include "extern-plugininfo.h"
MaxDevice::MaxDevice(QObject *parent) : MaxDevice::MaxDevice(QObject *parent) :
QObject(parent) QObject(parent)

View File

@ -19,6 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "radiatorthermostat.h" #include "radiatorthermostat.h"
#include "extern-plugininfo.h"
RadiatorThermostat::RadiatorThermostat(QObject *parent) : RadiatorThermostat::RadiatorThermostat(QObject *parent) :
MaxDevice(parent) MaxDevice(parent)

View File

@ -19,6 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "room.h" #include "room.h"
#include "extern-plugininfo.h"
Room::Room(QObject *parent) : Room::Room(QObject *parent) :
QObject(parent) QObject(parent)

View File

@ -19,6 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "wallthermostat.h" #include "wallthermostat.h"
#include "extern-plugininfo.h"
WallThermostat::WallThermostat(QObject *parent) : WallThermostat::WallThermostat(QObject *parent) :
MaxDevice(parent) MaxDevice(parent)

View File

@ -1,9 +1,11 @@
{ {
"name": "Generic Elements", "name": "Generic Elements",
"idName": "GenericElements",
"id": "6e22161e-39b7-4416-8623-39e730721efb", "id": "6e22161e-39b7-4416-8623-39e730721efb",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -49,7 +49,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -181,10 +180,10 @@ DeviceManager::DeviceError DevicePluginIntertechno::executeAction(Device *device
// ======================================= // =======================================
// send data to hardware resource // send data to hardware resource
if (transmitData(delay, rawData)) { if (transmitData(delay, rawData)) {
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCDebug(dcIntertechno) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else { } else {
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCWarning(dcIntertechno) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorHardwareNotAvailable; return DeviceManager::DeviceErrorHardwareNotAvailable;
} }
} }
@ -384,6 +383,6 @@ void DevicePluginIntertechno::radioData(const QList<int> &rawData)
return; return;
} }
qCDebug(dcRF433) << "Intertechno: family code = " << familyCode << "button code =" << buttonCode << power; qCDebug(dcIntertechno) << "Intertechno: family code = " << familyCode << "button code =" << buttonCode << power;
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "Intertechno", "name": "Intertechno",
"idName": "Intertechno",
"id": "e998d934-0397-42c1-ad63-9141bcac8563", "id": "e998d934-0397-42c1-ad63-9141bcac8563",
"vendors": [ "vendors": [
{ {
"name": "Intertechno", "name": "Intertechno",
"idName": "intertechno",
"id": "6a852bc2-34dd-4f4c-9ac9-dd4c32ddbcba", "id": "6a852bc2-34dd-4f4c-9ac9-dd4c32ddbcba",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -68,7 +68,6 @@
#include "devicepluginkodi.h" #include "devicepluginkodi.h"
#include "plugin/device.h" #include "plugin/device.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
DevicePluginKodi::DevicePluginKodi() DevicePluginKodi::DevicePluginKodi()
{ {

View File

@ -1,11 +1,12 @@
{ {
"id": "e7186890-99fa-4c5b-8247-09c6d450d490",
"name": "Kodi", "name": "Kodi",
"idName": "Kodi", "idName": "Kodi",
"id": "e7186890-99fa-4c5b-8247-09c6d450d490",
"vendors": [ "vendors": [
{ {
"name": "Kodi",
"id": "447bf3d6-a86e-4636-9db0-8936c0e4d9e9", "id": "447bf3d6-a86e-4636-9db0-8936c0e4d9e9",
"name": "Kodi",
"idName": "kodi",
"deviceClasses": [ "deviceClasses": [
{ {
"deviceClassId": "d09953e3-c5bd-415b-973b-0d0bf2be3f69", "deviceClassId": "d09953e3-c5bd-415b-973b-0d0bf2be3f69",

View File

@ -19,7 +19,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "kodiconnection.h" #include "kodiconnection.h"
#include "loggingcategories.h"
#include "jsonhandler.h" #include "jsonhandler.h"
#include "extern-plugininfo.h" #include "extern-plugininfo.h"

View File

@ -53,7 +53,6 @@
#include "devicepluginleynew.h" #include "devicepluginleynew.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -175,10 +174,10 @@ DeviceManager::DeviceError DevicePluginLeynew::executeAction(Device *device, con
// ======================================= // =======================================
// send data to hardware resource // send data to hardware resource
if(transmitData(delay, rawData, repetitions)){ if(transmitData(delay, rawData, repetitions)){
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << action.id(); qCDebug(dcLeynew) << "transmitted" << pluginName() << device->name() << action.id();
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
}else{ }else{
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << action.id(); qCWarning(dcLeynew) << "could not transmitt" << pluginName() << device->name() << action.id();
return DeviceManager::DeviceErrorHardwareNotAvailable; return DeviceManager::DeviceErrorHardwareNotAvailable;
} }
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "Leynew", "name": "Leynew",
"idName": "Leynew",
"id": "9a6d23e6-fad8-4203-aeab-2e6e5c756990", "id": "9a6d23e6-fad8-4203-aeab-2e6e5c756990",
"vendors": [ "vendors": [
{ {
"name": "Leynew", "name": "Leynew",
"idName": "leynew",
"id": "83c649b4-49b0-4482-9334-d86a85bfbd2a", "id": "83c649b4-49b0-4482-9334-d86a85bfbd2a",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -49,7 +49,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>

View File

@ -1,9 +1,11 @@
{ {
"name": "LG Smart Tv", "name": "LG Smart Tv",
"idName": "LgSmartTv",
"id": "4ef7a68b-9da0-4c62-b9ac-f478dc6f9f52", "id": "4ef7a68b-9da0-4c62-b9ac-f478dc6f9f52",
"vendors": [ "vendors": [
{ {
"name": "LG", "name": "LG",
"idName": "lg",
"id": "a9af9673-78db-4226-a16b-f34b304f7041", "id": "a9af9673-78db-4226-a16b-f34b304f7041",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "tvdevice.h" #include "tvdevice.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
TvDevice::TvDevice(const QHostAddress &hostAddress, const int &port, QObject *parent) : TvDevice::TvDevice(const QHostAddress &hostAddress, const int &port, QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "tveventhandler.h" #include "tveventhandler.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
TvEventHandler::TvEventHandler(const QHostAddress &host, const int &port, QObject *parent) : TvEventHandler::TvEventHandler(const QHostAddress &host, const int &port, QObject *parent) :
QTcpServer(parent), QTcpServer(parent),

View File

@ -50,8 +50,7 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "loggingcategories.h" #include "plugininfo.h"
#include "lircdclient.h" #include "lircdclient.h"
#include <QDebug> #include <QDebug>

View File

@ -1,9 +1,11 @@
{ {
"name": "Lirc receiver", "name": "Lirc receiver",
"idName": "Lircd",
"id": "075f734f-4d76-4ce3-9ef8-34c212285676", "id": "075f734f-4d76-4ce3-9ef8-34c212285676",
"vendors": [ "vendors": [
{ {
"name": "Lirc", "name": "Lirc",
"idName": "lirc",
"id": "9a53049c-8828-4b87-b3f6-7bc7708196cd", "id": "9a53049c-8828-4b87-b3f6-7bc7708196cd",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "lircdclient.h" #include "lircdclient.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
#include <QDebug> #include <QDebug>
#include <QLocalSocket> #include <QLocalSocket>

View File

@ -67,7 +67,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>

View File

@ -1,9 +1,11 @@
{ {
"name": "Mail notification", "name": "Mail notification",
"idName": "MailNotification",
"id": "1ae35df1-1b51-4c93-94fa-3febc77e0318", "id": "1ae35df1-1b51-4c93-94fa-3febc77e0318",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "smtpclient.h" #include "smtpclient.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
SmtpClient::SmtpClient(QObject *parent): SmtpClient::SmtpClient(QObject *parent):
QObject(parent) QObject(parent)

View File

@ -25,7 +25,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -47,7 +46,7 @@ DeviceManager::HardwareResources DevicePluginMock::requiredHardware() const
DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params) DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{ {
Q_UNUSED(deviceClassId) Q_UNUSED(deviceClassId)
qCDebug(dcMock) << "starting mock discovery:" << params; qCDebug(dcMockDevice) << "starting mock discovery:" << params;
m_discoveredDeviceCount = params.paramValue("resultCount").toInt(); m_discoveredDeviceCount = params.paramValue("resultCount").toInt();
QTimer::singleShot(1000, this, SLOT(emitDevicesDiscovered())); QTimer::singleShot(1000, this, SLOT(emitDevicesDiscovered()));
return DeviceManager::DeviceErrorAsync; return DeviceManager::DeviceErrorAsync;
@ -55,14 +54,14 @@ DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId
DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device) DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device)
{ {
qCDebug(dcMock) << "Mockdevice created returning true" qCDebug(dcMockDevice) << "Mockdevice created returning true"
<< device->paramValue("name").toString() << device->paramValue("name").toString()
<< device->paramValue("httpport").toInt() << device->paramValue("httpport").toInt()
<< device->paramValue("async").toBool() << device->paramValue("async").toBool()
<< device->paramValue("broken").toBool(); << device->paramValue("broken").toBool();
if (device->paramValue("broken").toBool()) { if (device->paramValue("broken").toBool()) {
qCWarning(dcMock) << "This device is intentionally broken."; qCWarning(dcMockDevice) << "This device is intentionally broken.";
return DeviceManager::DeviceSetupStatusFailure; return DeviceManager::DeviceSetupStatusFailure;
} }
@ -70,7 +69,7 @@ DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device)
m_daemons.insert(device, daemon); m_daemons.insert(device, daemon);
if (!daemon->isListening()) { if (!daemon->isListening()) {
qCWarning(dcMock) << "HTTP port opening failed."; qCWarning(dcMockDevice) << "HTTP port opening failed.";
return DeviceManager::DeviceSetupStatusFailure; return DeviceManager::DeviceSetupStatusFailure;
} }
@ -168,7 +167,7 @@ void DevicePluginMock::triggerEvent(const EventTypeId &id)
Event event(id, device->id()); Event event(id, device->id());
qCDebug(dcMock) << "Emitting event " << event.eventTypeId(); qCDebug(dcMockDevice) << "Emitting event " << event.eventTypeId();
emit emitEvent(event); emit emitEvent(event);
} }
@ -203,7 +202,7 @@ void DevicePluginMock::emitDevicesDiscovered()
void DevicePluginMock::emitDeviceSetupFinished() void DevicePluginMock::emitDeviceSetupFinished()
{ {
qCDebug(dcMock) << "emitting setup finised"; qCDebug(dcMockDevice) << "emitting setup finised";
Device *device = m_asyncSetupDevices.takeFirst(); Device *device = m_asyncSetupDevices.takeFirst();
if (device->paramValue("broken").toBool()) { if (device->paramValue("broken").toBool()) {
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure); emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);

View File

@ -1,9 +1,11 @@
{ {
"name": "Mock Devices", "name": "Mock Devices",
"idName": "MockDevice",
"id": "727a4a9a-c187-446f-aadf-f1b2220607d1", "id": "727a4a9a-c187-446f-aadf-f1b2220607d1",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -25,7 +25,7 @@
#include "plugin/deviceclass.h" #include "plugin/deviceclass.h"
#include "plugin/deviceplugin.h" #include "plugin/deviceplugin.h"
#include "types/statetype.h" #include "types/statetype.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
#include <QTcpSocket> #include <QTcpSocket>
#include <QDebug> #include <QDebug>
@ -114,7 +114,7 @@ void HttpDaemon::discardClient()
QTcpSocket* socket = (QTcpSocket*)sender(); QTcpSocket* socket = (QTcpSocket*)sender();
socket->deleteLater(); socket->deleteLater();
qCDebug(dcMock) << "Connection closed"; qCDebug(dcMockDevice) << "Connection closed";
} }
QString HttpDaemon::generateHeader() QString HttpDaemon::generateHeader()

View File

@ -56,7 +56,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
@ -130,7 +129,7 @@ void DevicePluginOpenweathermap::deviceRemoved(Device *device)
void DevicePluginOpenweathermap::networkManagerReplyReady(QNetworkReply *reply) void DevicePluginOpenweathermap::networkManagerReplyReady(QNetworkReply *reply)
{ {
if (reply->error()) { if (reply->error()) {
qCWarning(dcOpenweathermap) << "OpenWeatherMap reply error: " << reply->errorString(); qCWarning(dcOpenWeatherMap) << "OpenWeatherMap reply error: " << reply->errorString();
} }
if (m_autodetectionReplies.contains(reply)) { if (m_autodetectionReplies.contains(reply)) {
@ -219,7 +218,7 @@ void DevicePluginOpenweathermap::processAutodetectResponse(QByteArray data)
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error); QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
if(error.error != QJsonParseError::NoError) { if(error.error != QJsonParseError::NoError) {
qCWarning(dcOpenweathermap) << "failed to parse data" << data << ":" << error.errorString(); qCWarning(dcOpenWeatherMap) << "failed to parse data" << data << ":" << error.errorString();
} }
// search by geographic coordinates // search by geographic coordinates
@ -236,15 +235,15 @@ void DevicePluginOpenweathermap::processAutodetectResponse(QByteArray data)
if (dataMap.contains("lon") && dataMap.contains("lat")) { if (dataMap.contains("lon") && dataMap.contains("lat")) {
m_longitude = dataMap.value("lon").toDouble(); m_longitude = dataMap.value("lon").toDouble();
m_latitude = dataMap.value("lat").toDouble(); m_latitude = dataMap.value("lat").toDouble();
qCDebug(dcOpenweathermap) << "----------------------------------------"; qCDebug(dcOpenWeatherMap) << "----------------------------------------";
qCDebug(dcOpenweathermap) << "Autodetection of location: "; qCDebug(dcOpenWeatherMap) << "Autodetection of location: ";
qCDebug(dcOpenweathermap) << "----------------------------------------"; qCDebug(dcOpenWeatherMap) << "----------------------------------------";
qCDebug(dcOpenweathermap) << " name:" << m_cityName; qCDebug(dcOpenWeatherMap) << " name:" << m_cityName;
qCDebug(dcOpenweathermap) << " country:" << m_country; qCDebug(dcOpenWeatherMap) << " country:" << m_country;
qCDebug(dcOpenweathermap) << " WAN IP:" << m_wanIp.toString(); qCDebug(dcOpenWeatherMap) << " WAN IP:" << m_wanIp.toString();
qCDebug(dcOpenweathermap) << " latitude:" << m_latitude; qCDebug(dcOpenWeatherMap) << " latitude:" << m_latitude;
qCDebug(dcOpenweathermap) << " longitude:" << m_longitude; qCDebug(dcOpenWeatherMap) << " longitude:" << m_longitude;
qCDebug(dcOpenweathermap) << "----------------------------------------"; qCDebug(dcOpenWeatherMap) << "----------------------------------------";
searchGeoLocation(m_latitude, m_longitude); searchGeoLocation(m_latitude, m_longitude);
} }
} }
@ -255,7 +254,7 @@ void DevicePluginOpenweathermap::processSearchResponse(QByteArray data)
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error); QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
if(error.error != QJsonParseError::NoError) { if(error.error != QJsonParseError::NoError) {
qCWarning(dcOpenweathermap) << "failed to parse data" << data << ":" << error.errorString(); qCWarning(dcOpenWeatherMap) << "failed to parse data" << data << ":" << error.errorString();
} }
QVariantMap dataMap = jsonDoc.toVariant().toMap(); QVariantMap dataMap = jsonDoc.toVariant().toMap();
@ -280,7 +279,7 @@ void DevicePluginOpenweathermap::processGeoSearchResponse(QByteArray data)
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error); QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
if(error.error != QJsonParseError::NoError) { if(error.error != QJsonParseError::NoError) {
qCWarning(dcOpenweathermap) << "failed to parse data" << data << ":" << error.errorString(); qCWarning(dcOpenWeatherMap) << "failed to parse data" << data << ":" << error.errorString();
} }
QVariantMap dataMap = jsonDoc.toVariant().toMap(); QVariantMap dataMap = jsonDoc.toVariant().toMap();
@ -327,7 +326,7 @@ void DevicePluginOpenweathermap::processWeatherData(const QByteArray &data, Devi
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error); QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(dcOpenweathermap) << "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; return;
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "OpenWeatherMap", "name": "OpenWeatherMap",
"idName": "OpenWeatherMap",
"id": "bc6af567-2338-41d5-aac1-462dec6e4783", "id": "bc6af567-2338-41d5-aac1-462dec6e4783",
"vendors": [ "vendors": [
{ {
"name": "OpenWeatherMap", "name": "OpenWeatherMap",
"idName": "openWeatherMap",
"id": "bf1e96f0-9650-4e7c-a56c-916d54d18e7a", "id": "bf1e96f0-9650-4e7c-a56c-916d54d18e7a",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -51,7 +51,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "types/param.h" #include "types/param.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>

View File

@ -1,10 +1,12 @@
{ {
"name": "Philips Hue", "name": "Philips Hue",
"idName": "PhilipsHue",
"id": "5f2e634b-b7f3-48ee-976a-b5ae22aa5c55", "id": "5f2e634b-b7f3-48ee-976a-b5ae22aa5c55",
"vendors": [ "vendors": [
{ {
"id": "0ae1e001-2aa6-47ed-b8c0-334c3728a68f", "id": "0ae1e001-2aa6-47ed-b8c0-334c3728a68f",
"name": "Philips", "name": "Philips",
"idName": "philips",
"deviceClasses": [ "deviceClasses": [
{ {
"deviceClassId": "642aa4c7-19aa-45ed-ba06-aa1ae6c9edf7", "deviceClassId": "642aa4c7-19aa-45ed-ba06-aa1ae6c9edf7",

View File

@ -20,6 +20,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "huelight.h" #include "huelight.h"
#include "extern-plugininfo.h"
HueLight::HueLight(const int &lightId, const QHostAddress &hostAddress, const QString &name, const QString &apiKey, const QString &modelId, const DeviceId &bridgeId, QObject *parent) : HueLight::HueLight(const int &lightId, const QHostAddress &hostAddress, const QString &name, const QString &apiKey, const QString &modelId, const DeviceId &bridgeId, QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -25,7 +25,6 @@
#include "deviceplugintune.h" #include "deviceplugintune.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
DevicePluginTune::DevicePluginTune() DevicePluginTune::DevicePluginTune()
{ {

View File

@ -1,9 +1,11 @@
{ {
"name": "Tune", "name": "Tune",
"idName": "Tune",
"id": "826c8f4a-e2e1-4891-84d4-2c7a46ab1eea", "id": "826c8f4a-e2e1-4891-84d4-2c7a46ab1eea",
"vendors": [ "vendors": [
{ {
"name": "Tune", "name": "Tune",
"idName": "tune",
"id": "9ba2d9dc-b975-46bb-9e83-dbbd03ccab6c", "id": "9ba2d9dc-b975-46bb-9e83-dbbd03ccab6c",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -19,24 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "jsonrpcserver.h" #include "jsonrpcserver.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
extern PluginId pluginId;
extern DeviceClassId moodDeviceClassId;
extern StateTypeId activeStateTypeId;
extern ActionTypeId activeActionTypeId;
extern StateTypeId valueStateTypeId;
extern ActionTypeId valueActionTypeId;
extern DeviceClassId tuneDeviceClassId;
extern StateTypeId reachableStateTypeId;
extern StateTypeId approximationDetectedStateTypeId;
extern StateTypeId temperatureStateTypeId;
extern StateTypeId humidityStateTypeId;
extern StateTypeId lightIntensityStateTypeId;
extern StateTypeId powerStateTypeId;
extern ActionTypeId powerActionTypeId;
extern StateTypeId brightnessStateTypeId;
extern ActionTypeId brightnessActionTypeId;
JsonRpcServer::JsonRpcServer(QObject *parent) : JsonRpcServer::JsonRpcServer(QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "tunemanager.h" #include "tunemanager.h"
#include "loggingcategories.h" #include "extern-plugininfo.h"
TuneManager::TuneManager(int port, QObject *parent) : TuneManager::TuneManager(int port, QObject *parent) :
QObject(parent), QObject(parent),

View File

@ -65,7 +65,6 @@
#include "devicepluginudpcommander.h" #include "devicepluginudpcommander.h"
#include "plugin/device.h" #include "plugin/device.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
DevicePluginUdpCommander::DevicePluginUdpCommander() DevicePluginUdpCommander::DevicePluginUdpCommander()
{ {

View File

@ -1,9 +1,11 @@
{ {
"name": "UDP Commander", "name": "UDP Commander",
"idName": "UdpCommander",
"id": "24a8474c-1d86-499e-a76e-9cbfbf48dd72", "id": "24a8474c-1d86-499e-a76e-9cbfbf48dd72",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -47,7 +47,6 @@
#include "devicepluginunitec.h" #include "devicepluginunitec.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -69,7 +68,7 @@ DeviceManager::DeviceSetupStatus DevicePluginUnitec::setupDevice(Device *device)
foreach (Device* d, myDevices()) { foreach (Device* d, myDevices()) {
if (d->paramValue("Channel").toString() == device->paramValue("Channel").toString()) { if (d->paramValue("Channel").toString() == device->paramValue("Channel").toString()) {
qCWarning(dcRF433) << "Unitec switch with channel " << device->paramValue("Channel").toString() << "already added."; qCWarning(dcUnitec) << "Unitec switch with channel " << device->paramValue("Channel").toString() << "already added.";
return DeviceManager::DeviceSetupStatusFailure; return DeviceManager::DeviceSetupStatusFailure;
} }
} }
@ -129,10 +128,10 @@ DeviceManager::DeviceError DevicePluginUnitec::executeAction(Device *device, con
// ======================================= // =======================================
// send data to hardware resource // send data to hardware resource
if(transmitData(delay, rawData)){ if(transmitData(delay, rawData)){
qCDebug(dcRF433) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCDebug(dcUnitec) << "transmitted" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
}else{ }else{
qCWarning(dcRF433) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool(); qCWarning(dcUnitec) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
return DeviceManager::DeviceErrorHardwareNotAvailable; return DeviceManager::DeviceErrorHardwareNotAvailable;
} }
} }

View File

@ -1,9 +1,11 @@
{ {
"name": "Unitec", "name": "Unitec",
"idName": "Unitec",
"id": "aefca391-f8bf-4f6c-a205-6764de3c2c3c", "id": "aefca391-f8bf-4f6c-a205-6764de3c2c3c",
"vendors": [ "vendors": [
{ {
"name": "Unitec", "name": "Unitec",
"idName": "unitec",
"id": "f2cd9a76-5a7f-4c01-bf8c-5eae8b12e95c", "id": "f2cd9a76-5a7f-4c01-bf8c-5eae8b12e95c",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -53,7 +53,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>

View File

@ -1,9 +1,11 @@
{ {
"name": "Wake on Lan", "name": "Wake on Lan",
"idName": "WakeOnLan",
"id": "b5a87848-de56-451e-84a6-edd26ad4958f", "id": "b5a87848-de56-451e-84a6-edd26ad4958f",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -53,7 +53,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QNetworkReply> #include <QNetworkReply>

View File

@ -1,9 +1,11 @@
{ {
"name": "Wemo", "name": "Wemo",
"idName": "Wemo",
"id": "2e3b5ce0-ecf1-43de-98f0-07df4068a583", "id": "2e3b5ce0-ecf1-43de-98f0-07df4068a583",
"vendors": [ "vendors": [
{ {
"name": "Belkin", "name": "Belkin",
"idName": "belkin",
"id": "b241f7f5-8153-4a72-b260-f62beadc2d19", "id": "b241f7f5-8153-4a72-b260-f62beadc2d19",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -52,7 +52,6 @@
#include "plugin/device.h" #include "plugin/device.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "loggingcategories.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>

View File

@ -1,9 +1,11 @@
{ {
"name": "WiFi Detector", "name": "WiFi Detector",
"idName": "WifiDetector",
"id": "8e0f791e-b273-4267-8605-b7c2f55a68ab", "id": "8e0f791e-b273-4267-8605-b7c2f55a68ab",
"vendors": [ "vendors": [
{ {
"name": "guh", "name": "guh",
"idName": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6", "id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [ "deviceClasses": [
{ {

View File

@ -8,26 +8,30 @@ inputFile = open(sys.argv[1], "r")
outputfile = open(sys.argv[2], "w") outputfile = open(sys.argv[2], "w")
outputfile2 = open("extern-" + sys.argv[2], "w") outputfile2 = open("extern-" + sys.argv[2], "w")
variableNames = [] variableNames = []
externDefinitions = []
try: try:
pluginMap = json.loads(inputFile.read()) pluginMap = json.loads(inputFile.read())
except ValueError as e: except ValueError as e:
print " --> Error loading input file \"%s\"" % (sys.argv[1]) print " --> Error loading input file \"%s\"" % (sys.argv[1])
print " %s" % (e) print " %s" % (e)
exit -1 exit -1
def out(line): def writePluginInfo(line):
outputfile.write("%s\n" % line) outputfile.write("%s\n" % line)
def out2(line):
def writeExternPluginInfo(line):
outputfile2.write("%s\n" % line) outputfile2.write("%s\n" % line)
def extractVendors(pluginMap): def extractVendors(pluginMap):
for vendor in pluginMap['vendors']: for vendor in pluginMap['vendors']:
try: try:
out("VendorId %sVendorId = VendorId(\"%s\");" % pluginMap["idName"], pluginMap["id"]) print("define VendorId %sVendorId = %s" % (pluginMap["idName"], vendor["id"]))
writePluginInfo("VendorId %sVendorId = VendorId(\"%s\");" % (vendor["idName"], vendor["id"]))
createExternDefinition("VendorId", "%sVendorId" % (vendor["idName"]))
except: except:
pass pass
extractDeviceClasses(vendor) extractDeviceClasses(vendor)
@ -35,12 +39,13 @@ def extractVendors(pluginMap):
def extractDeviceClasses(vendorMap): def extractDeviceClasses(vendorMap):
for deviceClass in vendorMap["deviceClasses"]: for deviceClass in vendorMap["deviceClasses"]:
print("have deviceclass %s" % deviceClass["deviceClassId"])
try: try:
variableName = "%sDeviceClassId" % (deviceClass["idName"]) variableName = "%sDeviceClassId" % (deviceClass["idName"])
if not variableName in variableNames: if not variableName in variableNames:
variableNames.append(variableName) variableNames.append(variableName)
out("DeviceClassId %s = DeviceClassId(\"%s\");" % (variableName, deviceClass["deviceClassId"])) print("define DeviceClassId %s = %s" % (variableName, deviceClass["deviceClassId"]))
writePluginInfo("DeviceClassId %s = DeviceClassId(\"%s\");" % (variableName, deviceClass["deviceClassId"]))
createExternDefinition("DeviceClassId", variableName)
else: else:
print("duplicated variable name \"%s\" for DeviceClassId %s -> skipping") % (variableName, deviceClass["deviceClassId"]) print("duplicated variable name \"%s\" for DeviceClassId %s -> skipping") % (variableName, deviceClass["deviceClassId"])
except: except:
@ -57,16 +62,19 @@ def extractStateTypes(deviceClassMap):
variableName = "%sStateTypeId" % (stateType["idName"]) variableName = "%sStateTypeId" % (stateType["idName"])
if not variableName in variableNames: if not variableName in variableNames:
variableNames.append(variableName) variableNames.append(variableName)
out("StateTypeId %s = StateTypeId(\"%s\");" % (variableName, stateType["id"])) print("define StateTypeId %s = %s" % (variableName, stateType["id"]))
writePluginInfo("StateTypeId %s = StateTypeId(\"%s\");" % (variableName, stateType["id"]))
createExternDefinition("StateTypeId", variableName)
else: else:
print("duplicated variable name \"%s\" for StateTypeId %s -> skipping") % (variableName, stateType["id"]) print("duplicated variable name \"%s\" for StateTypeId %s -> skipping") % (variableName, stateType["id"])
# create ActionTypeId if the state is writable # create ActionTypeId if the state is writable
if 'writable' in stateType: if 'writable' in stateType:
print("create ActionTypeId for StateType %s" % stateType["id"])
vName = "%sActionTypeId" % (stateType["idName"]) vName = "%sActionTypeId" % (stateType["idName"])
if not vName in variableNames: if not vName in variableNames:
variableNames.append(vName) variableNames.append(vName)
out("ActionTypeId %s = ActionTypeId(\"%s\");" % (vName, stateType["id"])) print("define ActionTypeId %s for writable StateType %s = %s" % (vName, variableName, stateType["id"]))
writePluginInfo("ActionTypeId %s = ActionTypeId(\"%s\");" % (vName, stateType["id"]))
createExternDefinition("ActionTypeId", vName)
else: else:
print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, stateType["id"]) print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, stateType["id"])
except: except:
@ -82,7 +90,8 @@ def extractActionTypes(deviceClassMap):
variableName = "%sActionTypeId" % (actionType["idName"]) variableName = "%sActionTypeId" % (actionType["idName"])
if not variableName in variableNames: if not variableName in variableNames:
variableNames.append(variableName) variableNames.append(variableName)
out("ActionTypeId %s = ActionTypeId(\"%s\");" % (variableName, actionType["id"])) writePluginInfo("ActionTypeId %s = ActionTypeId(\"%s\");" % (variableName, actionType["id"]))
createExternDefinition("ActionTypeId", variableName)
else: else:
print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, actionType["id"]) print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, actionType["id"])
except: except:
@ -98,7 +107,8 @@ def extractEventTypes(deviceClassMap):
variableName = "%sEventTypeId" % (eventType["idName"]) variableName = "%sEventTypeId" % (eventType["idName"])
if not variableName in variableNames: if not variableName in variableNames:
variableNames.append(variableName) variableNames.append(variableName)
out("EventTypeId %s = EventTypeId(\"%s\");" % (variableName, eventType["id"])) writePluginInfo("EventTypeId %s = EventTypeId(\"%s\");" % (variableName, eventType["id"]))
createExternDefinition("EventTypeId", variableName)
else: else:
print("duplicated variable name \"%s\" for EventTypeId %s -> skipping") % (variableName, eventType["id"]) print("duplicated variable name \"%s\" for EventTypeId %s -> skipping") % (variableName, eventType["id"])
except: except:
@ -106,52 +116,74 @@ def extractEventTypes(deviceClassMap):
except: except:
pass pass
def createExternDefinition(type, name):
definition = {}
definition['type'] = type
definition['variable'] = name
externDefinitions.append(definition)
##################################################################################################################
# write plugininfo.h
print " --> generate plugininfo.h" print " --> generate plugininfo.h"
print "PluginId for plugin \"%s\" = %s" %(pluginMap['name'], pluginMap['id']) print "PluginId for plugin \"%s\" = %s" %(pluginMap['name'], pluginMap['id'])
# write header writePluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
out("/* This file is generated by the guh build system. Any changes to this file will") writePluginInfo(" * be lost.")
out(" * be lost.") writePluginInfo(" *")
out(" *") writePluginInfo(" * If you want to change this file, edit the plugin's json file and add")
out(" * If you want to change this file, edit the plugin's json file and add") writePluginInfo(" * idName tags where appropriate.")
out(" * idName tags where appropriate.") writePluginInfo(" */")
out(" */") writePluginInfo("")
writePluginInfo("#ifndef PLUGININFO_H")
out("#ifndef PLUGININFO_H") writePluginInfo("#define PLUGININFO_H")
out("#define PLUGININFO_H") writePluginInfo("#include \"typeutils.h\"")
out("#include \"typeutils.h\"") writePluginInfo("#include <QLoggingCategory>")
out("#include <QLoggingCategory>") writePluginInfo("")
writePluginInfo("// Id definitions")
out("") writePluginInfo("PluginId pluginId = PluginId(\"%s\");" % pluginMap['id'])
out("PluginId pluginId = PluginId(\"%s\");" % pluginMap['id'])
extractVendors(pluginMap) extractVendors(pluginMap)
out("") writePluginInfo("")
writePluginInfo("// Loging category")
if 'idName' in pluginMap: if 'idName' in pluginMap:
out("Q_DECLARE_LOGGING_CATEGORY(dc%s)" % pluginMap['idName']) writePluginInfo("Q_DECLARE_LOGGING_CATEGORY(dc%s)" % pluginMap['idName'])
out("Q_LOGGING_CATEGORY(dc%s, \"dc%s\")" % (pluginMap['idName'], pluginMap['idName'])) writePluginInfo("Q_LOGGING_CATEGORY(dc%s, \"%s\")" % (pluginMap['idName'], pluginMap['idName']))
print "define logging category: \"dc%s\"" % pluginMap['idName']
out("")
out("#endif") writePluginInfo("")
writePluginInfo("#endif // PLUGININFO_H")
print " --> generated successfully \"%s\"" % sys.argv[2]
out2("/* This file is generated by the guh build system. Any changes to this file will") ##################################################################################################################
out2(" * be lost.") # write extern-plugininfo.h
out2(" *") print " --> generate extern-plugininfo.h"
out2(" * If you want to change this file, edit the plugin's json file and add") writeExternPluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
out2(" * idName tags where appropriate.") writeExternPluginInfo(" * be lost.")
out2(" */") writeExternPluginInfo(" *")
out2("#ifndef PLUGININFO_H") writeExternPluginInfo(" * If you want to change this file, edit the plugin's json file and add")
out2("#define PLUGININFO_H") writeExternPluginInfo(" * idName tags where appropriate.")
out2("#include \"typeutils.h\"") writeExternPluginInfo(" */")
out2("#include <QLoggingCategory>") writeExternPluginInfo("")
out2("") writeExternPluginInfo("#ifndef EXTERNPLUGININFO_H")
writeExternPluginInfo("#define EXTERNPLUGININFO_H")
writeExternPluginInfo("#include \"typeutils.h\"")
writeExternPluginInfo("#include <QLoggingCategory>")
writeExternPluginInfo("")
writeExternPluginInfo("// Id definitions")
for externDefinition in externDefinitions:
writeExternPluginInfo("extern %s %s;" % (externDefinition['type'], externDefinition['variable']))
writeExternPluginInfo("")
writeExternPluginInfo("// Logging category definition")
if 'idName' in pluginMap: if 'idName' in pluginMap:
out2("Q_DECLARE_LOGGING_CATEGORY(dc%s)" % pluginMap['idName']) writeExternPluginInfo("Q_DECLARE_LOGGING_CATEGORY(dc%s)" % pluginMap['idName'])
out2("")
out2("#endif") writeExternPluginInfo("")
writeExternPluginInfo("#endif // EXTERNPLUGININFO_H")
print " --> generated successfully \"extern-%s\"" % (sys.argv[2])
print " --> finished writing \"%s\"" % (sys.argv[2])

View File

@ -46,13 +46,12 @@ void loggingCategoryFilter(QLoggingCategory *category)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//qInstallMessageHandler(myMessageOutput);
QCoreApplication application(argc, argv); QCoreApplication application(argc, argv);
application.setOrganizationName("guh"); application.setOrganizationName("guh");
application.setApplicationName("guhd"); application.setApplicationName("guhd");
application.setApplicationVersion(GUH_VERSION_STRING); application.setApplicationVersion(GUH_VERSION_STRING);
// filter for core and libguh // logging filers for core and libguh
s_loggingFilters.insert("Application", true); s_loggingFilters.insert("Application", true);
s_loggingFilters.insert("Warnings", true); s_loggingFilters.insert("Warnings", true);
s_loggingFilters.insert("DeviceManager", true); s_loggingFilters.insert("DeviceManager", true);
@ -62,8 +61,9 @@ int main(int argc, char *argv[])
s_loggingFilters.insert("Hardware", false); s_loggingFilters.insert("Hardware", false);
s_loggingFilters.insert("LogEngine", false); s_loggingFilters.insert("LogEngine", false);
foreach (const QJsonObject &object, DeviceManager::pluginNames()) { QHash<QString, bool> loggingFiltersPlugins;
s_loggingFilters.insert("dc" + object.value("idName").toString(), false); foreach (const QJsonObject &pluginMetadata, DeviceManager::pluginsMetadata()) {
loggingFiltersPlugins.insert(pluginMetadata.value("idName").toString(), false);
} }
QCommandLineParser parser; QCommandLineParser parser;
@ -72,7 +72,8 @@ int main(int argc, char *argv[])
QString applicationDescription = QString("\nguh ( /[guːh]/ ) is an open source home automation server, which allows to\n" 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\n" "control a lot of different devices from many different manufacturers.\n\n"
"guhd %1 (C) 2014-2015 guh\n" "guhd %1 (C) 2014-2015 guh\n"
"Released under the GNU GENERAL PUBLIC LICENSE Version 2.").arg(GUH_VERSION_STRING); "Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n"
"API version: %2\n").arg(GUH_VERSION_STRING).arg(JSON_PROTOCOL_VERSION);
parser.setApplicationDescription(applicationDescription); parser.setApplicationDescription(applicationDescription);
@ -80,16 +81,30 @@ int main(int argc, char *argv[])
parser.addOption(foregroundOption); 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:"); 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:");
// create sorted loggingFiler list
QStringList sortedFilterList = QStringList(s_loggingFilters.keys()); QStringList sortedFilterList = QStringList(s_loggingFilters.keys());
sortedFilterList.sort(); sortedFilterList.sort();
foreach (const QString &filterName, sortedFilterList) { foreach (const QString &filterName, sortedFilterList) {
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")"; debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
} }
// create sorted plugin loggingFiler list
QStringList sortedPluginList = QStringList(loggingFiltersPlugins.keys());
sortedPluginList.sort();
debugDescription += "\n\nPlugin categories:\n";
foreach (const QString &filterName, sortedPluginList) {
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
}
QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "[No]DebugCategory"); QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "[No]DebugCategory");
parser.addOption(debugOption); parser.addOption(debugOption);
parser.process(application); parser.process(application);
// add plugin metadata to the static hash
foreach (const QString &category, loggingFiltersPlugins.keys()) {
s_loggingFilters.insert(category, false);
}
// check debug area // check debug area
foreach (QString debugArea, parser.values(debugOption)) { foreach (QString debugArea, parser.values(debugOption)) {
bool enable = !debugArea.startsWith("No"); bool enable = !debugArea.startsWith("No");