guhd -> nymead

This commit is contained in:
Michael Zanetti 2018-01-29 15:50:23 +01:00
parent 4be14f1904
commit 22533fb23c
16 changed files with 44 additions and 123 deletions

View File

@ -20,7 +20,7 @@
/*! /*!
\class guhserver::BluetoothServer \class guhserver::BluetoothServer
\brief This class represents the bluetooth server for guhd. \brief This class represents the bluetooth server for nymead.
\ingroup server \ingroup server
\inmodule core \inmodule core

View File

@ -338,8 +338,8 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
writer.writeStartElement("div"); writer.writeStartElement("div");
writer.writeAttribute("class", "download-name-column"); writer.writeAttribute("class", "download-name-column");
//: The guhd settings download description of the debug interface //: The nymead settings download description of the debug interface
writer.writeTextElement("p", QCoreApplication::translate("main", "Guhd settings")); writer.writeTextElement("p", QCoreApplication::translate("main", "nymead settings"));
writer.writeEndElement(); // div download-name-column writer.writeEndElement(); // div download-name-column
writer.writeStartElement("div"); writer.writeStartElement("div");
@ -352,7 +352,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
writer.writeStartElement("form"); writer.writeStartElement("form");
writer.writeAttribute("class", "download-button"); writer.writeAttribute("class", "download-button");
writer.writeAttribute("method", "get"); writer.writeAttribute("method", "get");
writer.writeAttribute("action", "/debug/settings/guhd"); writer.writeAttribute("action", "/debug/settings/nymead");
writer.writeStartElement("button"); writer.writeStartElement("button");
writer.writeAttribute("class", "button"); writer.writeAttribute("class", "button");
writer.writeAttribute("type", "submit"); writer.writeAttribute("type", "submit");
@ -763,7 +763,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
return reply; return reply;
} }
if (requestPath.startsWith("/debug/settings/guhd")) { if (requestPath.startsWith("/debug/settings/nymead")) {
QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleGlobal).fileName(); QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleGlobal).fileName();
qCDebug(dcWebServer()) << "Loading" << settingsFileName; qCDebug(dcWebServer()) << "Loading" << settingsFileName;
QFile settingsFile(settingsFileName); QFile settingsFile(settingsFileName);

View File

@ -1,34 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
* *
* This file is part of guh. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hardwaremanagerdbusservice.h"
namespace guhserver {
HardwareManagerDBusService::HardwareManagerDBusService(const QString &objectPath, QObject *parent) :
GuhDBusService(objectPath, parent)
{
}
}

View File

@ -1,45 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
* *
* This file is part of guh. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef HARDWAREMANAGERDBUSSERVICE_H
#define HARDWAREMANAGERDBUSSERVICE_H
#include <QObject>
#include "guhdbusservice.h"
namespace guhserver {
class HardwareManagerDBusService : public GuhDBusService
{
Q_OBJECT
public:
explicit HardwareManagerDBusService(const QString &objectPath, QObject *parent = nullptr);
signals:
public slots:
};
}
#endif // HARDWAREMANAGERDBUSSERVICE_H

View File

@ -59,8 +59,8 @@ ServerManager::ServerManager(GuhConfiguration* configuration, QObject *parent) :
QString configCertificateFileName = configuration->sslCertificate(); QString configCertificateFileName = configuration->sslCertificate();
QString configKeyFileName = configuration->sslCertificateKey(); QString configKeyFileName = configuration->sslCertificateKey();
QString fallbackCertificateFileName = GuhSettings::storagePath() + "/certs/guhd-certificate.crt"; QString fallbackCertificateFileName = GuhSettings::storagePath() + "/certs/nymead-certificate.crt";
QString fallbackKeyFileName = GuhSettings::storagePath() + "/certs/guhd-certificate.key"; QString fallbackKeyFileName = GuhSettings::storagePath() + "/certs/nymead-certificate.key";
bool certsLoaded = false; bool certsLoaded = false;
if (loadCertificate(configKeyFileName, configCertificateFileName)) { if (loadCertificate(configKeyFileName, configCertificateFileName)) {

View File

@ -21,7 +21,7 @@
/*! /*!
\class guhserver::TcpServer \class guhserver::TcpServer
\brief This class represents the tcp server for guhd. \brief This class represents the tcp server for nymead.
\ingroup server \ingroup server
\inmodule core \inmodule core

View File

@ -20,7 +20,7 @@
/*! /*!
\class guhserver::WebServer \class guhserver::WebServer
\brief This class represents the web server for guhd. \brief This class represents the web server for nymead.
\ingroup server \ingroup server
\inmodule core \inmodule core
@ -384,7 +384,7 @@ void WebServer::readClient()
reply->deleteLater(); reply->deleteLater();
return; return;
} else { } else {
qCWarning(dcWebServer()) << "The debug server handler is disabled. You can enable it by adding \'debugServerEnabled=true\' in the \'guhd\' section of the guhd.conf file."; qCWarning(dcWebServer()) << "The debug server handler is disabled. You can enable it by adding \'debugServerEnabled=true\' in the \'nymead\' section of the guhd.conf file.";
HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound);
reply->setClientId(clientId); reply->setClientId(clientId);
sendHttpReply(reply); sendHttpReply(reply);
@ -666,7 +666,7 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
writer.writeTextElement("manufacturer", "guh GmbH"); writer.writeTextElement("manufacturer", "guh GmbH");
writer.writeTextElement("manufacturerURL", "http://guh.io"); writer.writeTextElement("manufacturerURL", "http://guh.io");
writer.writeTextElement("modelDescription", "IoT server"); writer.writeTextElement("modelDescription", "IoT server");
writer.writeTextElement("modelName", "guhd"); writer.writeTextElement("modelName", "nymead");
writer.writeTextElement("modelNumber", GUH_VERSION_STRING); writer.writeTextElement("modelNumber", GUH_VERSION_STRING);
writer.writeTextElement("modelURL", "http://guh.io"); // (optional) writer.writeTextElement("modelURL", "http://guh.io"); // (optional)
writer.writeTextElement("UDN", "uuid:" + uuid); writer.writeTextElement("UDN", "uuid:" + uuid);
@ -763,7 +763,7 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
/*! /*!
\class guhserver::WebServerClient \class guhserver::WebServerClient
\brief This class represents a client the web server for guhd. \brief This class represents a client the web server for nymead.
\ingroup server \ingroup server
\inmodule core \inmodule core

View File

@ -20,7 +20,7 @@
/*! /*!
\class guhserver::WebSocketServer \class guhserver::WebSocketServer
\brief This class represents the websocket server for guhd. \brief This class represents the websocket server for nymead.
\ingroup server \ingroup server
\inmodule core \inmodule core

View File

@ -186,7 +186,7 @@ static void catchUnixSignals(const std::vector<int>& quitSignals, const std::vec
} }
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
qCDebug(dcApplication) << "Shutting down guh daemon"; qCDebug(dcApplication) << "Shutting down nymea daemon";
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
s_aboutToShutdown = true; s_aboutToShutdown = true;

View File

@ -26,7 +26,7 @@
\ingroup core \ingroup core
\inmodule server \inmodule server
The \l{GuhService} represents the forked guhd. The \l{GuhService} represents the forked nymead.
\sa QtService \sa QtService
*/ */
@ -43,26 +43,26 @@
namespace guhserver { namespace guhserver {
/*! Constructs the forked guhd application with the given argument count \a argc and argument vector \a argv. */ /*! Constructs the forked nymead application with the given argument count \a argc and argument vector \a argv. */
GuhService::GuhService(int argc, char **argv): GuhService::GuhService(int argc, char **argv):
QtService<QCoreApplication>(argc, argv, "guh - IoT server") QtService<QCoreApplication>(argc, argv, "nymea - IoT server")
{ {
application()->setOrganizationName("guh"); application()->setOrganizationName("guh");
application()->setApplicationName("guhd"); application()->setApplicationName("nymead");
application()->setApplicationVersion(GUH_VERSION_STRING); application()->setApplicationVersion(GUH_VERSION_STRING);
close(STDIN_FILENO); close(STDIN_FILENO);
close(STDOUT_FILENO); close(STDOUT_FILENO);
close(STDERR_FILENO); close(STDERR_FILENO);
setServiceDescription("guh - IoT server"); setServiceDescription("nymea - IoT server");
setServiceFlags(QtServiceBase::CanBeSuspended); setServiceFlags(QtServiceBase::CanBeSuspended);
} }
/*! Destroyes the forked guhd application. */ /*! Destroyes the forked nymead application. */
GuhService::~GuhService() GuhService::~GuhService()
{ {
} }
/*! Starts the forked guhd application. */ /*! Starts the forked nymead application. */
void GuhService::start() void GuhService::start()
{ {
// check if config directory for logfile exists // check if config directory for logfile exists
@ -71,7 +71,7 @@ void GuhService::start()
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
qCDebug(dcApplication) << "guhd" << GUH_VERSION_STRING << "started as daemon."; qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started as daemon.";
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
GuhCore::instance(); GuhCore::instance();
} }

View File

@ -105,7 +105,7 @@ int main(int argc, char *argv[])
GuhApplication application(argc, argv); GuhApplication application(argc, argv);
application.setOrganizationName("guh"); application.setOrganizationName("guh");
application.setApplicationName("guhd"); application.setApplicationName("nymead");
application.setApplicationVersion(GUH_VERSION_STRING); application.setApplicationVersion(GUH_VERSION_STRING);
// logging filers for core and libnymea // logging filers for core and libnymea
@ -150,7 +150,7 @@ int main(int argc, char *argv[])
// check if there are local translations // check if there are local translations
if (!translator.load(QLocale::system(), application.applicationName(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm")) if (!translator.load(QLocale::system(), application.applicationName(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm"))
if (!translator.load(QLocale::system(), application.applicationName(), "-", GuhSettings::translationsPath(), ".qm")) if (!translator.load(QLocale::system(), application.applicationName(), "-", GuhSettings::translationsPath(), ".qm"))
qWarning(dcApplication()) << "Could not find guhd translations for" << QLocale::system().name() << endl << (QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath()) << endl << GuhSettings::translationsPath(); qWarning(dcApplication()) << "Could not find nymead translations for" << QLocale::system().name() << endl << (QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath()) << endl << GuhSettings::translationsPath();
@ -165,13 +165,13 @@ int main(int argc, char *argv[])
"device available in the system and create individual scenes and behaviors \n" "device available in the system and create individual scenes and behaviors \n"
"for your environment.\n\n"); "for your environment.\n\n");
applicationDescription.append(QString("guhd %1 %2 2014-2018 guh GmbH\n" applicationDescription.append(QString("nymead %1 %2 2014-2018 guh GmbH\n"
"Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n" "Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n"
"API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION)); "API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION));
parser.setApplicationDescription(applicationDescription); parser.setApplicationDescription(applicationDescription);
QCommandLineOption foregroundOption(QStringList() << "n" << "no-daemon", QCoreApplication::translate("main", "Run guhd in the foreground, not as daemon.")); QCommandLineOption foregroundOption(QStringList() << "n" << "no-daemon", QCoreApplication::translate("main", "Run nymead in the foreground, not as daemon."));
parser.addOption(foregroundOption); parser.addOption(foregroundOption);
QString debugDescription = QCoreApplication::translate("main", "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 = QCoreApplication::translate("main", "Debug categories to enable. Prefix with \"No\" to disable. Warnings from all categories will be printed unless explicitly muted with \"NoWarnings\". \n\nCategories are:");
@ -194,7 +194,7 @@ int main(int argc, char *argv[])
QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. Single debug categories can be disabled again with -d parameter.")); QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. Single debug categories can be disabled again with -d parameter."));
parser.addOption(allOption); parser.addOption(allOption);
QCommandLineOption logOption({"l", "log"}, QCoreApplication::translate("main", "Specify a log file to write to, if this option is not specified, logs will be printed to the standard output."), "logfile", "/var/log/guhd.log"); QCommandLineOption logOption({"l", "log"}, QCoreApplication::translate("main", "Specify a log file to write to, if this option is not specified, logs will be printed to the standard output."), "logfile", "/var/log/nymead.log");
parser.addOption(logOption); parser.addOption(logOption);
QCommandLineOption dbusOption(QStringList() << "session", QCoreApplication::translate("main", "If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus.")); QCommandLineOption dbusOption(QStringList() << "session", QCoreApplication::translate("main", "If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus."));
@ -257,11 +257,11 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
qCDebug(dcApplication) << "guhd" << GUH_VERSION_STRING << "started with user ID" << userId; qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started with user ID" << userId;
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
} else { } else {
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
qCDebug(dcApplication) << "guhd" << GUH_VERSION_STRING << "started as root."; qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started as root.";
qCDebug(dcApplication) << "====================================="; qCDebug(dcApplication) << "=====================================";
} }

View File

@ -1,6 +1,6 @@
include(../nymea.pri) include(../nymea.pri)
TARGET = guhd TARGET = nymead
TEMPLATE = app TEMPLATE = app
INCLUDEPATH += ../libnymea ../libnymea-core INCLUDEPATH += ../libnymea ../libnymea-core

View File

@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource> <qresource>
<file>guhd-v2.sqlite</file> <file>nymead-v2.sqlite</file>
<file>guhd-broken.sqlite</file> <file>nymead-broken.sqlite</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -557,19 +557,19 @@ void TestWebserver::getDebugServer_data()
QTest::newRow("POST /debug/syslog | server enabled | 404") << "post" << "/debug/syslog" << false << 404; QTest::newRow("POST /debug/syslog | server enabled | 404") << "post" << "/debug/syslog" << false << 404;
QTest::newRow("DELETE /debug/syslog | server enabled | 404") << "delete" << "/debug/syslog" << false << 404; QTest::newRow("DELETE /debug/syslog | server enabled | 404") << "delete" << "/debug/syslog" << false << 404;
// settings/guhd enabled // settings/nymead enabled
QTest::newRow("GET /debug/settings/guhd | server enabled | 200") << "get" << "/debug/settings/guhd" << true << 200; QTest::newRow("GET /debug/settings/nymead | server enabled | 200") << "get" << "/debug/settings/nymead" << true << 200;
QTest::newRow("OPTIONS /debug/settings/guhd | server enabled | 200") << "options" << "/debug/settings/guhd" << true << 200; QTest::newRow("OPTIONS /debug/settings/nymead | server enabled | 200") << "options" << "/debug/settings/nymead" << true << 200;
QTest::newRow("PUT /debug/settings/guhd | server enabled | 405") << "put" << "/debug/settings/guhd" << true << 405; QTest::newRow("PUT /debug/settings/nymead | server enabled | 405") << "put" << "/debug/settings/nymead" << true << 405;
QTest::newRow("POST /debug/settings/guhd | server enabled | 405") << "post" << "/debug/settings/guhd" << true << 405; QTest::newRow("POST /debug/settings/nymead | server enabled | 405") << "post" << "/debug/settings/nymead" << true << 405;
QTest::newRow("DELETE /debug/settings/guhd | server enabled | 405") << "delete" << "/debug/settings/guhd" << true << 405; QTest::newRow("DELETE /debug/settings/nymead | server enabled | 405") << "delete" << "/debug/settings/nymead" << true << 405;
// settings/guhd disabled // settings/nymead disabled
QTest::newRow("GET /debug/settings/guhd | server disabled | 404") << "get" << "/debug/settings/guhd" << false << 404; QTest::newRow("GET /debug/settings/nymead | server disabled | 404") << "get" << "/debug/settings/nymead" << false << 404;
QTest::newRow("OPTIONS /debug/settings/guhd | server disabled | 404") << "options" << "/debug/settings/guhd" << false << 404; QTest::newRow("OPTIONS /debug/settings/nymead | server disabled | 404") << "options" << "/debug/settings/nymead" << false << 404;
QTest::newRow("PUT /debug/settings/guhd | server disabled | 404") << "put" << "/debug/settings/guhd" << false << 404; QTest::newRow("PUT /debug/settings/nymead | server disabled | 404") << "put" << "/debug/settings/nymead" << false << 404;
QTest::newRow("POST /debug/settings/guhd | server disabled | 404") << "post" << "/debug/settings/guhd" << false << 404; QTest::newRow("POST /debug/settings/nymead | server disabled | 404") << "post" << "/debug/settings/nymead" << false << 404;
QTest::newRow("DELETE /debug/settings/guhd | server disabled | 404") << "delete" << "/debug/settings/guhd" << false << 404; QTest::newRow("DELETE /debug/settings/nymead | server disabled | 404") << "delete" << "/debug/settings/nymead" << false << 404;
// settings/devices enabled // settings/devices enabled
QTest::newRow("GET /debug/settings/devices | server enabled | 200") << "get" << "/debug/settings/devices" << true << 200; QTest::newRow("GET /debug/settings/devices | server enabled | 200") << "get" << "/debug/settings/devices" << true << 200;