guhsettings -> nymeasettings
This commit is contained in:
parent
803ee32089
commit
dca764fafd
@ -6,7 +6,7 @@ ip="IPv4", "IPv6"
|
|||||||
[WebServer]
|
[WebServer]
|
||||||
port=3333
|
port=3333
|
||||||
https=false
|
https=false
|
||||||
publicFolder=/usr/share/guh-webinterface/public
|
publicFolder=/usr/share/nymea-webinterface/public
|
||||||
|
|
||||||
[WebSocketServer]
|
[WebSocketServer]
|
||||||
https=false
|
https=false
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "awsconnector.h"
|
#include "awsconnector.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
@ -505,24 +505,24 @@ ResponseCode AWSConnector::onDisconnectedCallback(util::String mqtt_client_id, s
|
|||||||
|
|
||||||
void AWSConnector::storeRegisteredFlag(bool registered)
|
void AWSConnector::storeRegisteredFlag(bool registered)
|
||||||
{
|
{
|
||||||
QSettings settings(GuhSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
QSettings settings(NymeaSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
||||||
settings.setValue("registered", registered);
|
settings.setValue("registered", registered);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AWSConnector::readRegisteredFlag() const
|
bool AWSConnector::readRegisteredFlag() const
|
||||||
{
|
{
|
||||||
QSettings settings(GuhSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
QSettings settings(NymeaSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
||||||
return settings.value("registered", false).toBool();
|
return settings.value("registered", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWSConnector::storeSyncedNameCache(const QString &syncedName)
|
void AWSConnector::storeSyncedNameCache(const QString &syncedName)
|
||||||
{
|
{
|
||||||
QSettings settings(GuhSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
QSettings settings(NymeaSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
||||||
settings.setValue("syncedName", syncedName);
|
settings.setValue("syncedName", syncedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AWSConnector::readSyncedNameCache()
|
QString AWSConnector::readSyncedNameCache()
|
||||||
{
|
{
|
||||||
QSettings settings(GuhSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
QSettings settings(NymeaSettings::storagePath() + "/cloudstatus.conf", QSettings::IniFormat);
|
||||||
return settings.value("syncedName", QString()).toString();
|
return settings.value("syncedName", QString()).toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "httpreply.h"
|
#include "httpreply.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "httprequest.h"
|
#include "httprequest.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "debugserverhandler.h"
|
#include "debugserverhandler.h"
|
||||||
@ -219,19 +219,19 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
writer.writeStartElement("tr");
|
writer.writeStartElement("tr");
|
||||||
//: The settings path description in the server infromation section of the debug interface
|
//: The settings path description in the server infromation section of the debug interface
|
||||||
writer.writeTextElement("th", QCoreApplication::translate("main", "Settings path"));
|
writer.writeTextElement("th", QCoreApplication::translate("main", "Settings path"));
|
||||||
writer.writeTextElement("td", GuhSettings::settingsPath());
|
writer.writeTextElement("td", NymeaSettings::settingsPath());
|
||||||
writer.writeEndElement(); // tr
|
writer.writeEndElement(); // tr
|
||||||
|
|
||||||
writer.writeStartElement("tr");
|
writer.writeStartElement("tr");
|
||||||
//: The translation path description in the server infromation section of the debug interface
|
//: The translation path description in the server infromation section of the debug interface
|
||||||
writer.writeTextElement("th", QCoreApplication::translate("main", "Translations path"));
|
writer.writeTextElement("th", QCoreApplication::translate("main", "Translations path"));
|
||||||
writer.writeTextElement("td", GuhSettings(GuhSettings::SettingsRoleGlobal).translationsPath());
|
writer.writeTextElement("td", NymeaSettings(NymeaSettings::SettingsRoleGlobal).translationsPath());
|
||||||
writer.writeEndElement(); // tr
|
writer.writeEndElement(); // tr
|
||||||
|
|
||||||
writer.writeStartElement("tr");
|
writer.writeStartElement("tr");
|
||||||
//: The log database path description in the server infromation section of the debug interface
|
//: The log database path description in the server infromation section of the debug interface
|
||||||
writer.writeTextElement("th", QCoreApplication::translate("main", "Log database"));
|
writer.writeTextElement("th", QCoreApplication::translate("main", "Log database"));
|
||||||
writer.writeTextElement("td", GuhSettings(GuhSettings::SettingsRoleGlobal).logPath());
|
writer.writeTextElement("td", NymeaSettings(NymeaSettings::SettingsRoleGlobal).logPath());
|
||||||
writer.writeEndElement(); // tr
|
writer.writeEndElement(); // tr
|
||||||
|
|
||||||
for (int i = 0; i < GuhCore::instance()->deviceManager()->pluginSearchDirs().count(); i++) {
|
for (int i = 0; i < GuhCore::instance()->deviceManager()->pluginSearchDirs().count(); i++) {
|
||||||
@ -273,7 +273,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings::logPath());
|
writer.writeTextElement("p", NymeaSettings::logPath());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -344,7 +344,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings(GuhSettings::SettingsRoleGlobal).fileName());
|
writer.writeTextElement("p", NymeaSettings(NymeaSettings::SettingsRoleGlobal).fileName());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -376,7 +376,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings(GuhSettings::SettingsRoleDevices).fileName());
|
writer.writeTextElement("p", NymeaSettings(NymeaSettings::SettingsRoleDevices).fileName());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -408,7 +408,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings(GuhSettings::SettingsRoleDeviceStates).fileName());
|
writer.writeTextElement("p", NymeaSettings(NymeaSettings::SettingsRoleDeviceStates).fileName());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -440,7 +440,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings(GuhSettings::SettingsRoleRules).fileName());
|
writer.writeTextElement("p", NymeaSettings(NymeaSettings::SettingsRoleRules).fileName());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -472,7 +472,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "download-path-column");
|
writer.writeAttribute("class", "download-path-column");
|
||||||
writer.writeTextElement("p", GuhSettings(GuhSettings::SettingsRolePlugins).fileName());
|
writer.writeTextElement("p", NymeaSettings(NymeaSettings::SettingsRolePlugins).fileName());
|
||||||
writer.writeEndElement(); // div download-path-column
|
writer.writeEndElement(); // div download-path-column
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
@ -643,10 +643,10 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
|
|
||||||
// Check if this is a logdb requested
|
// Check if this is a logdb requested
|
||||||
if (requestPath.startsWith("/debug/logdb.sql")) {
|
if (requestPath.startsWith("/debug/logdb.sql")) {
|
||||||
qCDebug(dcWebServer()) << "Loading" << GuhSettings::logPath();
|
qCDebug(dcWebServer()) << "Loading" << NymeaSettings::logPath();
|
||||||
QFile logDatabaseFile(GuhSettings::logPath());
|
QFile logDatabaseFile(NymeaSettings::logPath());
|
||||||
if (!logDatabaseFile.exists()) {
|
if (!logDatabaseFile.exists()) {
|
||||||
qCWarning(dcWebServer()) << "Could not read log database file for debug download" << GuhSettings::logPath() << "file does not exist.";
|
qCWarning(dcWebServer()) << "Could not read log database file for debug download" << NymeaSettings::logPath() << "file does not exist.";
|
||||||
HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound);
|
HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound);
|
||||||
reply->setHeader(HttpReply::ContentTypeHeader, "text/html");
|
reply->setHeader(HttpReply::ContentTypeHeader, "text/html");
|
||||||
//: The HTTP error message of the debug interface. The %1 represents the file name.
|
//: The HTTP error message of the debug interface. The %1 represents the file name.
|
||||||
@ -655,7 +655,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!logDatabaseFile.open(QFile::ReadOnly)) {
|
if (!logDatabaseFile.open(QFile::ReadOnly)) {
|
||||||
qCWarning(dcWebServer()) << "Could not read log database file for debug download" << GuhSettings::logPath();
|
qCWarning(dcWebServer()) << "Could not read log database file for debug download" << NymeaSettings::logPath();
|
||||||
HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden);
|
HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden);
|
||||||
reply->setHeader(HttpReply::ContentTypeHeader, "text/html");
|
reply->setHeader(HttpReply::ContentTypeHeader, "text/html");
|
||||||
//: The HTTP error message of the debug interface. The %1 represents the file name.
|
//: The HTTP error message of the debug interface. The %1 represents the file name.
|
||||||
@ -706,7 +706,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
// Check if this is a settings request
|
// Check if this is a settings request
|
||||||
if (requestPath.startsWith("/debug/settings")) {
|
if (requestPath.startsWith("/debug/settings")) {
|
||||||
if (requestPath.startsWith("/debug/settings/devices")) {
|
if (requestPath.startsWith("/debug/settings/devices")) {
|
||||||
QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleDevices).fileName();
|
QString settingsFileName = NymeaSettings(NymeaSettings::SettingsRoleDevices).fileName();
|
||||||
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
||||||
QFile settingsFile(settingsFileName);
|
QFile settingsFile(settingsFileName);
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
@ -735,7 +735,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestPath.startsWith("/debug/settings/rules")) {
|
if (requestPath.startsWith("/debug/settings/rules")) {
|
||||||
QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleRules).fileName();
|
QString settingsFileName = NymeaSettings(NymeaSettings::SettingsRoleRules).fileName();
|
||||||
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
||||||
QFile settingsFile(settingsFileName);
|
QFile settingsFile(settingsFileName);
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
@ -764,7 +764,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestPath.startsWith("/debug/settings/nymead")) {
|
if (requestPath.startsWith("/debug/settings/nymead")) {
|
||||||
QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleGlobal).fileName();
|
QString settingsFileName = NymeaSettings(NymeaSettings::SettingsRoleGlobal).fileName();
|
||||||
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
||||||
QFile settingsFile(settingsFileName);
|
QFile settingsFile(settingsFileName);
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
@ -793,7 +793,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestPath.startsWith("/debug/settings/devicestates")) {
|
if (requestPath.startsWith("/debug/settings/devicestates")) {
|
||||||
QString settingsFileName = GuhSettings(GuhSettings::SettingsRoleDeviceStates).fileName();
|
QString settingsFileName = NymeaSettings(NymeaSettings::SettingsRoleDeviceStates).fileName();
|
||||||
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
||||||
QFile settingsFile(settingsFileName);
|
QFile settingsFile(settingsFileName);
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
@ -822,7 +822,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestPath.startsWith("/debug/settings/plugins")) {
|
if (requestPath.startsWith("/debug/settings/plugins")) {
|
||||||
QString settingsFileName = GuhSettings(GuhSettings::SettingsRolePlugins).fileName();
|
QString settingsFileName = NymeaSettings(NymeaSettings::SettingsRolePlugins).fileName();
|
||||||
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
qCDebug(dcWebServer()) << "Loading" << settingsFileName;
|
||||||
QFile settingsFile(settingsFileName);
|
QFile settingsFile(settingsFileName);
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhconfiguration.h"
|
#include "guhconfiguration.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
#include <QTimeZone>
|
#include <QTimeZone>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -58,7 +58,7 @@ GuhConfiguration::GuhConfiguration(QObject *parent) :
|
|||||||
setSslCertificate(sslCertificate(), sslCertificateKey());
|
setSslCertificate(sslCertificate(), sslCertificateKey());
|
||||||
setDebugServerEnabled(debugServerEnabled());
|
setDebugServerEnabled(debugServerEnabled());
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
|
|
||||||
// TcpServer
|
// TcpServer
|
||||||
bool createDefaults = !settings.childGroups().contains("TcpServer");
|
bool createDefaults = !settings.childGroups().contains("TcpServer");
|
||||||
@ -160,15 +160,15 @@ GuhConfiguration::GuhConfiguration(QObject *parent) :
|
|||||||
|
|
||||||
QUuid GuhConfiguration::serverUuid() const
|
QUuid GuhConfiguration::serverUuid() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
return settings.value("uuid", QUuid()).toUuid();
|
return settings.value("uuid", QUuid()).toUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::serverName() const
|
QString GuhConfiguration::serverName() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
return settings.value("name", "guhIO").toString();
|
return settings.value("name", "guhIO").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ void GuhConfiguration::setServerName(const QString &serverName)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: Server name:" << serverName;
|
qCDebug(dcApplication()) << "Configuration: Server name:" << serverName;
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
if (settings.value("name").toString() == serverName) {
|
if (settings.value("name").toString() == serverName) {
|
||||||
qCDebug(dcApplication()) << "Configuration: Server name unchanged.";
|
qCDebug(dcApplication()) << "Configuration: Server name unchanged.";
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -190,8 +190,8 @@ void GuhConfiguration::setServerName(const QString &serverName)
|
|||||||
|
|
||||||
QByteArray GuhConfiguration::timeZone() const
|
QByteArray GuhConfiguration::timeZone() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
return settings.value("timeZone", QTimeZone::systemTimeZoneId()).toByteArray();
|
return settings.value("timeZone", QTimeZone::systemTimeZoneId()).toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ void GuhConfiguration::setTimeZone(const QByteArray &timeZone)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: Time zone:" << QString::fromUtf8(timeZone);
|
qCDebug(dcApplication()) << "Configuration: Time zone:" << QString::fromUtf8(timeZone);
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
if (settings.value("timeZone").toByteArray() == timeZone) {
|
if (settings.value("timeZone").toByteArray() == timeZone) {
|
||||||
qCDebug(dcApplication()) << "Configuration: Time zone unchanged.";
|
qCDebug(dcApplication()) << "Configuration: Time zone unchanged.";
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -213,8 +213,8 @@ void GuhConfiguration::setTimeZone(const QByteArray &timeZone)
|
|||||||
|
|
||||||
QLocale GuhConfiguration::locale() const
|
QLocale GuhConfiguration::locale() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
return settings.value("language", "en_US").toString();
|
return settings.value("language", "en_US").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ void GuhConfiguration::setLocale(const QLocale &locale)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: set locale:" << locale.name() << locale.nativeCountryName() << locale.nativeLanguageName();
|
qCDebug(dcApplication()) << "Configuration: set locale:" << locale.name() << locale.nativeCountryName() << locale.nativeLanguageName();
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
if (settings.value("language").toString() == locale.name()) {
|
if (settings.value("language").toString() == locale.name()) {
|
||||||
qCDebug(dcApplication()) << "Configuration: Language unchanged.";
|
qCDebug(dcApplication()) << "Configuration: Language unchanged.";
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -265,7 +265,7 @@ void GuhConfiguration::setWebServerConfiguration(const WebServerConfiguration &c
|
|||||||
storeServerConfig("WebServer", config);
|
storeServerConfig("WebServer", config);
|
||||||
|
|
||||||
// This is a bit odd that we need to open the config once more just for the publicFolder...
|
// This is a bit odd that we need to open the config once more just for the publicFolder...
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("WebServer");
|
settings.beginGroup("WebServer");
|
||||||
settings.beginGroup(config.id);
|
settings.beginGroup(config.id);
|
||||||
settings.setValue("publicFolder", config.publicFolder);
|
settings.setValue("publicFolder", config.publicFolder);
|
||||||
@ -303,7 +303,7 @@ void GuhConfiguration::removeWebSocketServerConfiguration(const QString &id)
|
|||||||
|
|
||||||
bool GuhConfiguration::bluetoothServerEnabled() const
|
bool GuhConfiguration::bluetoothServerEnabled() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("BluetoothServer");
|
settings.beginGroup("BluetoothServer");
|
||||||
return settings.value("enabled", false).toBool();
|
return settings.value("enabled", false).toBool();
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ void GuhConfiguration::setBluetoothServerEnabled(const bool &enabled)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: Bluetooth server" << (enabled ? "enabled" : "disabled");
|
qCDebug(dcApplication()) << "Configuration: Bluetooth server" << (enabled ? "enabled" : "disabled");
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("BluetoothServer");
|
settings.beginGroup("BluetoothServer");
|
||||||
settings.setValue("enabled", enabled);
|
settings.setValue("enabled", enabled);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -321,7 +321,7 @@ void GuhConfiguration::setBluetoothServerEnabled(const bool &enabled)
|
|||||||
|
|
||||||
bool GuhConfiguration::cloudEnabled() const
|
bool GuhConfiguration::cloudEnabled() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
return settings.value("enabled", false).toBool();
|
return settings.value("enabled", false).toBool();
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ bool GuhConfiguration::cloudEnabled() const
|
|||||||
void GuhConfiguration::setCloudEnabled(bool enabled)
|
void GuhConfiguration::setCloudEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (cloudEnabled() != enabled) {
|
if (cloudEnabled() != enabled) {
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
settings.setValue("enabled", enabled);
|
settings.setValue("enabled", enabled);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -339,49 +339,49 @@ void GuhConfiguration::setCloudEnabled(bool enabled)
|
|||||||
|
|
||||||
QString GuhConfiguration::cloudServerUrl() const
|
QString GuhConfiguration::cloudServerUrl() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
return settings.value("cloudServerUrl").toString();
|
return settings.value("cloudServerUrl").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::cloudCertificateCA() const
|
QString GuhConfiguration::cloudCertificateCA() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
return settings.value("cloudCertificateCA").toString();
|
return settings.value("cloudCertificateCA").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::cloudCertificate() const
|
QString GuhConfiguration::cloudCertificate() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
return settings.value("cloudCertificate").toString();
|
return settings.value("cloudCertificate").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::cloudCertificateKey() const
|
QString GuhConfiguration::cloudCertificateKey() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("Cloud");
|
settings.beginGroup("Cloud");
|
||||||
return settings.value("cloudCertificateKey").toString();
|
return settings.value("cloudCertificateKey").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::sslCertificate() const
|
QString GuhConfiguration::sslCertificate() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("SSL");
|
settings.beginGroup("SSL");
|
||||||
return settings.value("certificate").toString();
|
return settings.value("certificate").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GuhConfiguration::sslCertificateKey() const
|
QString GuhConfiguration::sslCertificateKey() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("SSL");
|
settings.beginGroup("SSL");
|
||||||
return settings.value("certificate-key").toString();
|
return settings.value("certificate-key").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuhConfiguration::setSslCertificate(const QString &sslCertificate, const QString &sslCertificateKey)
|
void GuhConfiguration::setSslCertificate(const QString &sslCertificate, const QString &sslCertificateKey)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("SSL");
|
settings.beginGroup("SSL");
|
||||||
settings.setValue("certificate", sslCertificate);
|
settings.setValue("certificate", sslCertificate);
|
||||||
settings.setValue("certificate-key", sslCertificateKey);
|
settings.setValue("certificate-key", sslCertificateKey);
|
||||||
@ -390,8 +390,8 @@ void GuhConfiguration::setSslCertificate(const QString &sslCertificate, const QS
|
|||||||
|
|
||||||
bool GuhConfiguration::debugServerEnabled() const
|
bool GuhConfiguration::debugServerEnabled() const
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
return settings.value("debugServerEnabled", false).toBool();
|
return settings.value("debugServerEnabled", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,8 +399,8 @@ void GuhConfiguration::setDebugServerEnabled(bool enabled)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: Set debug server" << (enabled ? "enabled" : "disabled");
|
qCDebug(dcApplication()) << "Configuration: Set debug server" << (enabled ? "enabled" : "disabled");
|
||||||
bool currentValue = debugServerEnabled();
|
bool currentValue = debugServerEnabled();
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
settings.setValue("debugServerEnabled", enabled);
|
settings.setValue("debugServerEnabled", enabled);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
@ -413,8 +413,8 @@ void GuhConfiguration::setServerUuid(const QUuid &uuid)
|
|||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << "Configuration: Server uuid:" << uuid.toString();
|
qCDebug(dcApplication()) << "Configuration: Server uuid:" << uuid.toString();
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("guhd");
|
settings.beginGroup("nymead");
|
||||||
settings.setValue("uuid", uuid);
|
settings.setValue("uuid", uuid);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ QString GuhConfiguration::defaultWebserverPublicFolderPath() const
|
|||||||
|
|
||||||
void GuhConfiguration::storeServerConfig(const QString &group, const ServerConfiguration &config)
|
void GuhConfiguration::storeServerConfig(const QString &group, const ServerConfiguration &config)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup(group);
|
settings.beginGroup(group);
|
||||||
settings.remove("disabled");
|
settings.remove("disabled");
|
||||||
settings.beginGroup(config.id);
|
settings.beginGroup(config.id);
|
||||||
@ -448,7 +448,7 @@ void GuhConfiguration::storeServerConfig(const QString &group, const ServerConfi
|
|||||||
ServerConfiguration GuhConfiguration::readServerConfig(const QString &group, const QString &id)
|
ServerConfiguration GuhConfiguration::readServerConfig(const QString &group, const QString &id)
|
||||||
{
|
{
|
||||||
ServerConfiguration config;
|
ServerConfiguration config;
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup(group);
|
settings.beginGroup(group);
|
||||||
settings.beginGroup(id);
|
settings.beginGroup(id);
|
||||||
config.id = id;
|
config.id = id;
|
||||||
@ -463,7 +463,7 @@ ServerConfiguration GuhConfiguration::readServerConfig(const QString &group, con
|
|||||||
|
|
||||||
void GuhConfiguration::deleteServerConfig(const QString &group, const QString &id)
|
void GuhConfiguration::deleteServerConfig(const QString &group, const QString &id)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup(group);
|
settings.beginGroup(group);
|
||||||
settings.remove(id);
|
settings.remove(id);
|
||||||
if (settings.childGroups().isEmpty()) {
|
if (settings.childGroups().isEmpty()) {
|
||||||
@ -475,7 +475,7 @@ void GuhConfiguration::deleteServerConfig(const QString &group, const QString &i
|
|||||||
void GuhConfiguration::storeWebServerConfig(const WebServerConfiguration &config)
|
void GuhConfiguration::storeWebServerConfig(const WebServerConfiguration &config)
|
||||||
{
|
{
|
||||||
storeServerConfig("WebServer", config);
|
storeServerConfig("WebServer", config);
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("WebServer");
|
settings.beginGroup("WebServer");
|
||||||
settings.beginGroup(config.id);
|
settings.beginGroup(config.id);
|
||||||
settings.setValue("publicFolder", config.publicFolder);
|
settings.setValue("publicFolder", config.publicFolder);
|
||||||
@ -486,7 +486,7 @@ void GuhConfiguration::storeWebServerConfig(const WebServerConfiguration &config
|
|||||||
WebServerConfiguration GuhConfiguration::readWebServerConfig(const QString &id)
|
WebServerConfiguration GuhConfiguration::readWebServerConfig(const QString &id)
|
||||||
{
|
{
|
||||||
WebServerConfiguration config;
|
WebServerConfiguration config;
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings settings(NymeaSettings::SettingsRoleGlobal);
|
||||||
settings.beginGroup("WebServer");
|
settings.beginGroup("WebServer");
|
||||||
settings.beginGroup(id);
|
settings.beginGroup(id);
|
||||||
config.id = id;
|
config.id = id;
|
||||||
|
|||||||
@ -100,6 +100,7 @@
|
|||||||
#include "jsonrpc/jsonrpcserver.h"
|
#include "jsonrpc/jsonrpcserver.h"
|
||||||
#include "ruleengine.h"
|
#include "ruleengine.h"
|
||||||
#include "networkmanager/networkmanager.h"
|
#include "networkmanager/networkmanager.h"
|
||||||
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "plugin/device.h"
|
#include "plugin/device.h"
|
||||||
@ -476,14 +477,14 @@ GuhCore::GuhCore(QObject *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GuhCore::init() {
|
void GuhCore::init() {
|
||||||
qCDebug(dcApplication()) << "Loading guh configurations" << GuhSettings(GuhSettings::SettingsRoleGlobal).fileName();
|
qCDebug(dcApplication()) << "Loading guh configurations" << NymeaSettings(NymeaSettings::SettingsRoleGlobal).fileName();
|
||||||
m_configuration = new GuhConfiguration(this);
|
m_configuration = new GuhConfiguration(this);
|
||||||
|
|
||||||
qCDebug(dcApplication()) << "Creating Time Manager";
|
qCDebug(dcApplication()) << "Creating Time Manager";
|
||||||
m_timeManager = new TimeManager(QTimeZone::systemTimeZoneId(), this);
|
m_timeManager = new TimeManager(QTimeZone::systemTimeZoneId(), this);
|
||||||
|
|
||||||
qCDebug(dcApplication) << "Creating Log Engine";
|
qCDebug(dcApplication) << "Creating Log Engine";
|
||||||
m_logger = new LogEngine(GuhSettings::logPath(), this);
|
m_logger = new LogEngine(NymeaSettings::logPath(), this);
|
||||||
|
|
||||||
qCDebug(dcApplication) << "Creating Hardware Manager";
|
qCDebug(dcApplication) << "Creating Hardware Manager";
|
||||||
m_hardwareManager = new HardwareManagerImplementation(this);
|
m_hardwareManager = new HardwareManagerImplementation(this);
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|
||||||
#include "upnpdiscoveryimplementation.h"
|
#include "upnpdiscoveryimplementation.h"
|
||||||
@ -119,8 +119,8 @@ void UpnpDiscoveryImplementation::requestDeviceInformation(const QNetworkRequest
|
|||||||
void UpnpDiscoveryImplementation::respondToSearchRequest(QHostAddress host, int port)
|
void UpnpDiscoveryImplementation::respondToSearchRequest(QHostAddress host, int port)
|
||||||
{
|
{
|
||||||
// TODO: Once DeviceManager (and with that this can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
// TODO: Once DeviceManager (and with that this can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
||||||
GuhSettings globalSettings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings globalSettings(NymeaSettings::SettingsRoleGlobal);
|
||||||
globalSettings.beginGroup("guhd");
|
globalSettings.beginGroup("nymead");
|
||||||
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
||||||
globalSettings.endGroup();
|
globalSettings.endGroup();
|
||||||
|
|
||||||
@ -349,8 +349,8 @@ void UpnpDiscoveryImplementation::notificationTimeout()
|
|||||||
void UpnpDiscoveryImplementation::sendByeByeMessage()
|
void UpnpDiscoveryImplementation::sendByeByeMessage()
|
||||||
{
|
{
|
||||||
// TODO: Once DeviceManager (and with that this can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
// TODO: Once DeviceManager (and with that this can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
||||||
GuhSettings globalSettings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings globalSettings(NymeaSettings::SettingsRoleGlobal);
|
||||||
globalSettings.beginGroup("guhd");
|
globalSettings.beginGroup("nymead");
|
||||||
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
||||||
globalSettings.endGroup();
|
globalSettings.endGroup();
|
||||||
|
|
||||||
@ -394,9 +394,9 @@ void UpnpDiscoveryImplementation::sendByeByeMessage()
|
|||||||
|
|
||||||
void UpnpDiscoveryImplementation::sendAliveMessage()
|
void UpnpDiscoveryImplementation::sendAliveMessage()
|
||||||
{
|
{
|
||||||
// TODO: Once DeviceManager (and with that this can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
// TODO: Once DeviceManager (and with that this) can be moved into the server, use GuhCore's configuration manager instead of parsing the config here...
|
||||||
GuhSettings globalSettings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings globalSettings(NymeaSettings::SettingsRoleGlobal);
|
||||||
globalSettings.beginGroup("guhd");
|
globalSettings.beginGroup("nymead");
|
||||||
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
QByteArray uuid = globalSettings.value("uuid", QUuid()).toByteArray();
|
||||||
globalSettings.endGroup();
|
globalSettings.endGroup();
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,6 @@
|
|||||||
|
|
||||||
#include "radio433brennenstuhl.h"
|
#include "radio433brennenstuhl.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
#include "hardware/gpio.h"
|
#include "hardware/gpio.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|||||||
@ -110,7 +110,7 @@
|
|||||||
This \l{LogEntry} represents the enable/disable event from an \l{Rule}.
|
This \l{LogEntry} represents the enable/disable event from an \l{Rule}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "logengine.h"
|
#include "logengine.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#include "types/event.h"
|
#include "types/event.h"
|
||||||
#include "types/action.h"
|
#include "types/action.h"
|
||||||
#include "rule.h"
|
#include "rule.h"
|
||||||
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
@ -38,7 +39,7 @@ class LogEngine: public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LogEngine(const QString &logPath = GuhSettings::logPath(), QObject *parent = 0);
|
LogEngine(const QString &logPath = NymeaSettings::logPath(), QObject *parent = 0);
|
||||||
~LogEngine();
|
~LogEngine();
|
||||||
|
|
||||||
QList<LogEntry> logEntries(const LogFilter &filter = LogFilter()) const;
|
QList<LogEntry> logEntries(const LogFilter &filter = LogFilter()) const;
|
||||||
|
|||||||
@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
#include "types/eventdescriptor.h"
|
#include "types/eventdescriptor.h"
|
||||||
#include "types/paramdescriptor.h"
|
#include "types/paramdescriptor.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "plugin/device.h"
|
#include "plugin/device.h"
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace guhserver {
|
|||||||
RuleEngine::RuleEngine(QObject *parent) :
|
RuleEngine::RuleEngine(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleRules);
|
NymeaSettings settings(NymeaSettings::SettingsRoleRules);
|
||||||
qCDebug(dcRuleEngine) << "Loading rules from" << settings.fileName();
|
qCDebug(dcRuleEngine) << "Loading rules from" << settings.fileName();
|
||||||
foreach (const QString &idString, settings.childGroups()) {
|
foreach (const QString &idString, settings.childGroups()) {
|
||||||
settings.beginGroup(idString);
|
settings.beginGroup(idString);
|
||||||
@ -797,7 +797,7 @@ RuleEngine::RuleError RuleEngine::removeRule(const RuleId &ruleId, bool fromEdit
|
|||||||
m_rules.remove(ruleId);
|
m_rules.remove(ruleId);
|
||||||
m_activeRules.removeAll(ruleId);
|
m_activeRules.removeAll(ruleId);
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleRules);
|
NymeaSettings settings(NymeaSettings::SettingsRoleRules);
|
||||||
settings.beginGroup(ruleId.toString());
|
settings.beginGroup(ruleId.toString());
|
||||||
settings.remove("");
|
settings.remove("");
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -1056,7 +1056,7 @@ void RuleEngine::removeDeviceFromRule(const RuleId &id, const DeviceId &deviceId
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove the rule from settings
|
// remove the rule from settings
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleRules);
|
NymeaSettings settings(NymeaSettings::SettingsRoleRules);
|
||||||
settings.beginGroup(id.toString());
|
settings.beginGroup(id.toString());
|
||||||
settings.remove("");
|
settings.remove("");
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -1215,7 +1215,7 @@ void RuleEngine::appendRule(const Rule &rule)
|
|||||||
|
|
||||||
void RuleEngine::saveRule(const Rule &rule)
|
void RuleEngine::saveRule(const Rule &rule)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleRules);
|
NymeaSettings settings(NymeaSettings::SettingsRoleRules);
|
||||||
settings.beginGroup(rule.id().toString());
|
settings.beginGroup(rule.id().toString());
|
||||||
settings.setValue("name", rule.name());
|
settings.setValue("name", rule.name());
|
||||||
settings.setValue("enabled", rule.enabled());
|
settings.setValue("enabled", rule.enabled());
|
||||||
|
|||||||
@ -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/nymead-certificate.crt";
|
QString fallbackCertificateFileName = NymeaSettings::storagePath() + "/certs/nymead-certificate.crt";
|
||||||
QString fallbackKeyFileName = GuhSettings::storagePath() + "/certs/nymead-certificate.key";
|
QString fallbackKeyFileName = NymeaSettings::storagePath() + "/certs/nymead-certificate.key";
|
||||||
|
|
||||||
bool certsLoaded = false;
|
bool certsLoaded = false;
|
||||||
if (loadCertificate(configKeyFileName, configCertificateFileName)) {
|
if (loadCertificate(configKeyFileName, configCertificateFileName)) {
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
namespace guhserver {
|
namespace guhserver {
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ QList<DeviceId> StateEvaluator::containedDevices() const
|
|||||||
|
|
||||||
/*! This method will be used to save this \l StateEvaluator to the given \a settings.
|
/*! This method will be used to save this \l StateEvaluator to the given \a settings.
|
||||||
The \a groupName will normally be the corresponding \l Rule. */
|
The \a groupName will normally be the corresponding \l Rule. */
|
||||||
void StateEvaluator::dumpToSettings(GuhSettings &settings, const QString &groupName) const
|
void StateEvaluator::dumpToSettings(NymeaSettings &settings, const QString &groupName) const
|
||||||
{
|
{
|
||||||
settings.beginGroup(groupName);
|
settings.beginGroup(groupName);
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ void StateEvaluator::dumpToSettings(GuhSettings &settings, const QString &groupN
|
|||||||
|
|
||||||
/*! This method will be used to load a \l StateEvaluator from the given \a settings.
|
/*! This method will be used to load a \l StateEvaluator from the given \a settings.
|
||||||
The \a groupName will be the corresponding \l RuleId. Returns the loaded \l StateEvaluator. */
|
The \a groupName will be the corresponding \l RuleId. Returns the loaded \l StateEvaluator. */
|
||||||
StateEvaluator StateEvaluator::loadFromSettings(GuhSettings &settings, const QString &groupName)
|
StateEvaluator StateEvaluator::loadFromSettings(NymeaSettings &settings, const QString &groupName)
|
||||||
{
|
{
|
||||||
settings.beginGroup(groupName);
|
settings.beginGroup(groupName);
|
||||||
settings.beginGroup("stateDescriptor");
|
settings.beginGroup("stateDescriptor");
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
class GuhSettings;
|
class NymeaSettings;
|
||||||
|
|
||||||
namespace guhserver {
|
namespace guhserver {
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
void removeDevice(const DeviceId &deviceId);
|
void removeDevice(const DeviceId &deviceId);
|
||||||
QList<DeviceId> containedDevices() const;
|
QList<DeviceId> containedDevices() const;
|
||||||
|
|
||||||
void dumpToSettings(GuhSettings &settings, const QString &groupName) const;
|
void dumpToSettings(NymeaSettings &settings, const QString &groupName) const;
|
||||||
static StateEvaluator loadFromSettings(GuhSettings &settings, const QString &groupPrefix);
|
static StateEvaluator loadFromSettings(NymeaSettings &settings, const QString &groupPrefix);
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tcpserver.h"
|
#include "tcpserver.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "timeeventitem.h"
|
#include "timeeventitem.h"
|
||||||
#include "calendaritem.h"
|
#include "calendaritem.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
|
|
||||||
namespace guhserver {
|
namespace guhserver {
|
||||||
|
|
||||||
@ -43,8 +42,8 @@ public:
|
|||||||
|
|
||||||
bool evaluate(const QDateTime &lastEvaluationTime, const QDateTime &dateTime) const;
|
bool evaluate(const QDateTime &lastEvaluationTime, const QDateTime &dateTime) const;
|
||||||
|
|
||||||
// void dumpToSettings(GuhSettings &settings, const QString &groupName) const;
|
// void dumpToSettings(NymeaSettings &settings, const QString &groupName) const;
|
||||||
// static TimeDescriptor loadFromSettings(GuhSettings &settings, const QString &groupPrefix);
|
// static TimeDescriptor loadFromSettings(NymeaSettings &settings, const QString &groupPrefix);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "usermanager.h"
|
#include "usermanager.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "pushbuttondbusservice.h"
|
#include "pushbuttondbusservice.h"
|
||||||
@ -38,7 +38,7 @@ namespace guhserver {
|
|||||||
UserManager::UserManager(QObject *parent) : QObject(parent)
|
UserManager::UserManager(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), "users");
|
m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), "users");
|
||||||
m_db.setDatabaseName(GuhSettings::settingsPath() + "/user-db.sqlite");
|
m_db.setDatabaseName(NymeaSettings::settingsPath() + "/user-db.sqlite");
|
||||||
|
|
||||||
if (!m_db.open()) {
|
if (!m_db.open()) {
|
||||||
qCWarning(dcUserManager) << "Error opening users database:" << m_db.lastError().driverText();
|
qCWarning(dcUserManager) << "Error opening users database:" << m_db.lastError().driverText();
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
The \l{WebServer} class provides a HTTP/1.1 web server. The web server
|
The \l{WebServer} class provides a HTTP/1.1 web server. The web server
|
||||||
provides access to the guh-webinterface and the path can be specified
|
provides access to the guh-webinterface and the path can be specified
|
||||||
in the \tt /etc/guh/guhd.conf file and to the guh \l{https://github.com/guh/guh/wiki/REST-Api-documentation}{REST API}.
|
in the \tt /etc/guh/nymead.conf file and to the guh \l{https://github.com/guh/guh/wiki/REST-Api-documentation}{REST API}.
|
||||||
The default port for the web server is 3333, which is according to this
|
The default port for the web server is 3333, which is according to this
|
||||||
\l{https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers}{list}
|
\l{https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers}{list}
|
||||||
officially free.
|
officially free.
|
||||||
@ -44,10 +44,10 @@
|
|||||||
The URL for the secure HTTPS (TLS 1.2) REST API access to a \l{RestResource}:
|
The URL for the secure HTTPS (TLS 1.2) REST API access to a \l{RestResource}:
|
||||||
\code https://localhost:3333/api/v1/{RestResource}\endcode
|
\code https://localhost:3333/api/v1/{RestResource}\endcode
|
||||||
|
|
||||||
You can turn on the HTTPS server in the \tt WebServer section of the \tt /etc/guh/guhd.conf file.
|
You can turn on the HTTPS server in the \tt WebServer section of the \tt /etc/guh/nymead.conf file.
|
||||||
|
|
||||||
\note For \tt HTTPS you need to have a certificate and configure it in the \tt SSL-configuration
|
\note For \tt HTTPS you need to have a certificate and configure it in the \tt SSL-configuration
|
||||||
section of the \tt /etc/guh/guhd.conf file.
|
section of the \tt /etc/guh/nymead.conf file.
|
||||||
|
|
||||||
\sa WebServerClient, WebSocketServer, TcpServer
|
\sa WebServerClient, WebSocketServer, TcpServer
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,8 @@
|
|||||||
|
|
||||||
#include "webserver.h"
|
#include "webserver.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
|
#include "guhcore.h"
|
||||||
#include "httpreply.h"
|
#include "httpreply.h"
|
||||||
#include "httprequest.h"
|
#include "httprequest.h"
|
||||||
#include "rest/restresource.h"
|
#include "rest/restresource.h"
|
||||||
@ -384,7 +385,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 \'nymead\' 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 nymead.conf file.";
|
||||||
HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound);
|
HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound);
|
||||||
reply->setClientId(clientId);
|
reply->setClientId(clientId);
|
||||||
sendHttpReply(reply);
|
sendHttpReply(reply);
|
||||||
|
|||||||
@ -39,15 +39,15 @@
|
|||||||
The URL for the secure websocket (TLS 1.2):
|
The URL for the secure websocket (TLS 1.2):
|
||||||
\code wss://localhost:4444\endcode
|
\code wss://localhost:4444\endcode
|
||||||
|
|
||||||
You can turn on the \tt wss server in the \tt WebServerServer section of the \tt /etc/guh/guhd.conf file.
|
You can turn on the \tt wss server in the \tt WebServerServer section of the \tt /etc/guh/nymead.conf file.
|
||||||
|
|
||||||
\note For \tt wss you need to have a certificate and configure it in the \tt SSL-configuration
|
\note For \tt wss you need to have a certificate and configure it in the \tt SSL-configuration
|
||||||
section of the \tt /etc/guh/guhd.conf file.
|
section of the \tt /etc/guh/nymead.conf file.
|
||||||
|
|
||||||
\sa WebServer, TcpServer, TransportInterface
|
\sa WebServer, TcpServer, TransportInterface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "websocketserver.h"
|
#include "websocketserver.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|||||||
@ -163,7 +163,7 @@
|
|||||||
#include "plugin/devicepairinginfo.h"
|
#include "plugin/devicepairinginfo.h"
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
#include "typeutils.h"
|
#include "typeutils.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
|
|
||||||
#include "plugintimer.h"
|
#include "plugintimer.h"
|
||||||
@ -346,7 +346,7 @@ DeviceManager::DeviceError DeviceManager::setPluginConfig(const PluginId &plugin
|
|||||||
if (result != DeviceErrorNoError)
|
if (result != DeviceErrorNoError)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRolePlugins);
|
NymeaSettings settings(NymeaSettings::SettingsRolePlugins);
|
||||||
settings.beginGroup("PluginConfig");
|
settings.beginGroup("PluginConfig");
|
||||||
settings.beginGroup(plugin->pluginId().toString());
|
settings.beginGroup(plugin->pluginId().toString());
|
||||||
foreach (const Param ¶m, params) {
|
foreach (const Param ¶m, params) {
|
||||||
@ -760,13 +760,13 @@ DeviceManager::DeviceError DeviceManager::removeConfiguredDevice(const DeviceId
|
|||||||
|
|
||||||
device->deleteLater();
|
device->deleteLater();
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
settings.beginGroup(deviceId.toString());
|
settings.beginGroup(deviceId.toString());
|
||||||
settings.remove("");
|
settings.remove("");
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
GuhSettings stateCache(GuhSettings::SettingsRoleDeviceStates);
|
NymeaSettings stateCache(NymeaSettings::SettingsRoleDeviceStates);
|
||||||
stateCache.remove(deviceId.toString());
|
stateCache.remove(deviceId.toString());
|
||||||
|
|
||||||
emit deviceRemoved(deviceId);
|
emit deviceRemoved(deviceId);
|
||||||
@ -1070,7 +1070,7 @@ void DeviceManager::loadPlugin(DevicePlugin *pluginIface)
|
|||||||
qCDebug(dcDeviceManager) << "* Loaded device class:" << deviceClass.name();
|
qCDebug(dcDeviceManager) << "* Loaded device class:" << deviceClass.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRolePlugins);
|
NymeaSettings settings(NymeaSettings::SettingsRolePlugins);
|
||||||
settings.beginGroup("PluginConfig");
|
settings.beginGroup("PluginConfig");
|
||||||
ParamList params;
|
ParamList params;
|
||||||
if (settings.childGroups().contains(pluginIface->pluginId().toString())) {
|
if (settings.childGroups().contains(pluginIface->pluginId().toString())) {
|
||||||
@ -1109,7 +1109,7 @@ void DeviceManager::loadPlugin(DevicePlugin *pluginIface)
|
|||||||
|
|
||||||
void DeviceManager::loadConfiguredDevices()
|
void DeviceManager::loadConfiguredDevices()
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
qCDebug(dcDeviceManager) << "Loading devices from" << settings.fileName();
|
qCDebug(dcDeviceManager) << "Loading devices from" << settings.fileName();
|
||||||
foreach (const QString &idString, settings.childGroups()) {
|
foreach (const QString &idString, settings.childGroups()) {
|
||||||
@ -1142,7 +1142,7 @@ void DeviceManager::loadConfiguredDevices()
|
|||||||
|
|
||||||
void DeviceManager::storeConfiguredDevices()
|
void DeviceManager::storeConfiguredDevices()
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
foreach (Device *device, m_configuredDevices) {
|
foreach (Device *device, m_configuredDevices) {
|
||||||
settings.beginGroup(device->id().toString());
|
settings.beginGroup(device->id().toString());
|
||||||
@ -1407,7 +1407,7 @@ void DeviceManager::onLoaded()
|
|||||||
|
|
||||||
void DeviceManager::cleanupDeviceStateCache()
|
void DeviceManager::cleanupDeviceStateCache()
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDeviceStates);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDeviceStates);
|
||||||
foreach (const QString &entry, settings.childGroups()) {
|
foreach (const QString &entry, settings.childGroups()) {
|
||||||
DeviceId deviceId(entry);
|
DeviceId deviceId(entry);
|
||||||
if (!m_configuredDevices.contains(deviceId)) {
|
if (!m_configuredDevices.contains(deviceId)) {
|
||||||
@ -1484,7 +1484,7 @@ void DeviceManager::postSetupDevice(Device *device)
|
|||||||
|
|
||||||
void DeviceManager::loadDeviceStates(Device *device)
|
void DeviceManager::loadDeviceStates(Device *device)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDeviceStates);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDeviceStates);
|
||||||
settings.beginGroup(device->id().toString());
|
settings.beginGroup(device->id().toString());
|
||||||
DeviceClass deviceClass = m_supportedDevices.value(device->deviceClassId());
|
DeviceClass deviceClass = m_supportedDevices.value(device->deviceClassId());
|
||||||
foreach (const StateType &stateType, deviceClass.stateTypes()) {
|
foreach (const StateType &stateType, deviceClass.stateTypes()) {
|
||||||
@ -1499,7 +1499,7 @@ void DeviceManager::loadDeviceStates(Device *device)
|
|||||||
|
|
||||||
void DeviceManager::storeDeviceStates(Device *device)
|
void DeviceManager::storeDeviceStates(Device *device)
|
||||||
{
|
{
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDeviceStates);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDeviceStates);
|
||||||
settings.beginGroup(device->id().toString());
|
settings.beginGroup(device->id().toString());
|
||||||
DeviceClass deviceClass = m_supportedDevices.value(device->deviceClassId());
|
DeviceClass deviceClass = m_supportedDevices.value(device->deviceClassId());
|
||||||
foreach (const StateType &stateType, deviceClass.stateTypes()) {
|
foreach (const StateType &stateType, deviceClass.stateTypes()) {
|
||||||
|
|||||||
@ -49,7 +49,6 @@
|
|||||||
|
|
||||||
#include "radio433.h"
|
#include "radio433.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
#include "hardware/gpio.h"
|
#include "hardware/gpio.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "hardwareresource.h"
|
#include "hardwareresource.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
#include "hardwaremanager.h"
|
#include "hardwaremanager.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ HEADERS += devicemanager.h \
|
|||||||
libnymea.h \
|
libnymea.h \
|
||||||
typeutils.h \
|
typeutils.h \
|
||||||
loggingcategories.h \
|
loggingcategories.h \
|
||||||
guhsettings.h \
|
nymeasettings.h \
|
||||||
plugin/device.h \
|
plugin/device.h \
|
||||||
plugin/deviceplugin.h \
|
plugin/deviceplugin.h \
|
||||||
plugin/devicedescriptor.h \
|
plugin/devicedescriptor.h \
|
||||||
@ -74,7 +74,7 @@ HEADERS += devicemanager.h \
|
|||||||
|
|
||||||
SOURCES += devicemanager.cpp \
|
SOURCES += devicemanager.cpp \
|
||||||
loggingcategories.cpp \
|
loggingcategories.cpp \
|
||||||
guhsettings.cpp \
|
nymeasettings.cpp \
|
||||||
plugin/device.cpp \
|
plugin/device.cpp \
|
||||||
plugin/deviceplugin.cpp \
|
plugin/deviceplugin.cpp \
|
||||||
plugin/devicedescriptor.cpp \
|
plugin/devicedescriptor.cpp \
|
||||||
|
|||||||
@ -21,21 +21,21 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class GuhSettings
|
\class NymeaSettings
|
||||||
\brief The settings class for guh.
|
\brief The settings class for nymea.
|
||||||
|
|
||||||
\ingroup devices
|
\ingroup devices
|
||||||
\inmodule libguh
|
\inmodule libnymea
|
||||||
|
|
||||||
Depending on how the guh server was started (which user started guhd), the setting have to
|
Depending on how the nymea server was started (which user started nymead), the setting have to
|
||||||
be stored in different locations. This class represents a centralized mechanism to store
|
be stored in different locations. This class represents a centralized mechanism to store
|
||||||
settings of the system. The different settings are represented ba the \l{SettingsRole} and
|
settings of the system. The different settings are represented ba the \l{SettingsRole} and
|
||||||
can be used everywhere in the project.
|
can be used everywhere in the project.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \enum GuhSettings::SettingsRole
|
/*! \enum NymeaSettings::SettingsRole
|
||||||
Represents the role for the \l{GuhSettings}. Each role creates its own settings file.
|
Represents the role for the \l{NymeaSettings}. Each role creates its own settings file.
|
||||||
|
|
||||||
\value SettingsRoleNone
|
\value SettingsRoleNone
|
||||||
No role will be used. This sould not be used!
|
No role will be used. This sould not be used!
|
||||||
@ -46,11 +46,11 @@
|
|||||||
\value SettingsRolePlugins
|
\value SettingsRolePlugins
|
||||||
This role will create the \b{plugins.conf} file and is used to store the \l{DevicePlugin}{Plugin} configurations.
|
This role will create the \b{plugins.conf} file and is used to store the \l{DevicePlugin}{Plugin} configurations.
|
||||||
\value SettingsRoleGlobal
|
\value SettingsRoleGlobal
|
||||||
This role will create the \b{guhd.conf} file and is used to store the global settings of the guh system. This settings
|
This role will create the \b{nymead.conf} file and is used to store the global settings of the guh system. This settings
|
||||||
file is read only.
|
file is read only.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -58,8 +58,8 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
/*! Constructs a \l{GuhSettings} instance with the given \a role and \a parent. */
|
/*! Constructs a \l{NymeaSettings} instance with the given \a role and \a parent. */
|
||||||
GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
NymeaSettings::NymeaSettings(const SettingsRole &role, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_role(role)
|
m_role(role)
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
|||||||
if (!qgetenv("SNAP").isEmpty()) {
|
if (!qgetenv("SNAP").isEmpty()) {
|
||||||
basePath = QString(qgetenv("SNAP_DATA")) + "/";
|
basePath = QString(qgetenv("SNAP_DATA")) + "/";
|
||||||
settingsPrefix.clear(); // We don't want that in the snappy case...
|
settingsPrefix.clear(); // We don't want that in the snappy case...
|
||||||
} else if (settingsPrefix == "guh-test/") {
|
} else if (settingsPrefix == "nymea-test/") {
|
||||||
basePath = "/tmp/";
|
basePath = "/tmp/";
|
||||||
} else if (isRoot()) {
|
} else if (isRoot()) {
|
||||||
basePath = "/etc/";
|
basePath = "/etc/";
|
||||||
@ -91,7 +91,7 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
|||||||
fileName = "plugins.conf";
|
fileName = "plugins.conf";
|
||||||
break;
|
break;
|
||||||
case SettingsRoleGlobal:
|
case SettingsRoleGlobal:
|
||||||
fileName = "guhd.conf";
|
fileName = "nymead.conf";
|
||||||
break;
|
break;
|
||||||
case SettingsRoleDeviceStates:
|
case SettingsRoleDeviceStates:
|
||||||
fileName = "devicestates.conf";
|
fileName = "devicestates.conf";
|
||||||
@ -100,21 +100,21 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
|||||||
m_settings = new QSettings(basePath + settingsPrefix + fileName, QSettings::IniFormat, this);
|
m_settings = new QSettings(basePath + settingsPrefix + fileName, QSettings::IniFormat, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Destructor of the GuhSettings.*/
|
/*! Destructor of the NymeaSettings.*/
|
||||||
GuhSettings::~GuhSettings()
|
NymeaSettings::~NymeaSettings()
|
||||||
{
|
{
|
||||||
m_settings->sync();
|
m_settings->sync();
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the \l{SettingsRole} of this \l{GuhSettings}.*/
|
/*! Returns the \l{SettingsRole} of this \l{NymeaSettings}.*/
|
||||||
GuhSettings::SettingsRole GuhSettings::settingsRole() const
|
NymeaSettings::SettingsRole NymeaSettings::settingsRole() const
|
||||||
{
|
{
|
||||||
return m_role;
|
return m_role;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns true if guhd is started as \b{root}.*/
|
/*! Returns true if nymead is started as \b{root}.*/
|
||||||
bool GuhSettings::isRoot()
|
bool NymeaSettings::isRoot()
|
||||||
{
|
{
|
||||||
if (getuid() != 0)
|
if (getuid() != 0)
|
||||||
return false;
|
return false;
|
||||||
@ -126,62 +126,62 @@ bool GuhSettings::isRoot()
|
|||||||
|
|
||||||
\sa guhserver::LogEngine
|
\sa guhserver::LogEngine
|
||||||
*/
|
*/
|
||||||
QString GuhSettings::logPath()
|
QString NymeaSettings::logPath()
|
||||||
{
|
{
|
||||||
QString logPath;
|
QString logPath;
|
||||||
QString organisationName = QCoreApplication::instance()->organizationName();
|
QString organisationName = QCoreApplication::instance()->organizationName();
|
||||||
|
|
||||||
if (!qgetenv("SNAP").isEmpty()) {
|
if (!qgetenv("SNAP").isEmpty()) {
|
||||||
logPath = QString(qgetenv("SNAP_COMMON")) + "/guhd.sqlite";
|
logPath = QString(qgetenv("SNAP_COMMON")) + "/nymead.sqlite";
|
||||||
} else if (organisationName == "guh-test") {
|
} else if (organisationName == "nymea-test") {
|
||||||
logPath = "/tmp/" + organisationName + "/guhd-test.sqlite";
|
logPath = "/tmp/" + organisationName + "/nymead-test.sqlite";
|
||||||
} else if (GuhSettings::isRoot()) {
|
} else if (NymeaSettings::isRoot()) {
|
||||||
logPath = "/var/log/guhd.sqlite";
|
logPath = "/var/log/nymead.sqlite";
|
||||||
} else {
|
} else {
|
||||||
logPath = QDir::homePath() + "/.config/" + organisationName + "/guhd.sqlite";
|
logPath = QDir::homePath() + "/.config/" + organisationName + "/nymead.sqlite";
|
||||||
}
|
}
|
||||||
|
|
||||||
return logPath;
|
return logPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the path to the folder where the GuhSettings will be saved i.e. \tt{/etc/guh}. */
|
/*! Returns the path to the folder where the NymeaSettings will be saved i.e. \tt{/etc/nymea}. */
|
||||||
QString GuhSettings::settingsPath()
|
QString NymeaSettings::settingsPath()
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
QString organisationName = QCoreApplication::instance()->organizationName();
|
QString organisationName = QCoreApplication::instance()->organizationName();
|
||||||
|
|
||||||
if (!qgetenv("SNAP").isEmpty()) {
|
if (!qgetenv("SNAP").isEmpty()) {
|
||||||
path = QString(qgetenv("SNAP_DATA"));
|
path = QString(qgetenv("SNAP_DATA"));
|
||||||
} else if (organisationName == "guh-test") {
|
} else if (organisationName == "nymea-test") {
|
||||||
path = "/tmp/" + organisationName;
|
path = "/tmp/" + organisationName;
|
||||||
} else if (GuhSettings::isRoot()) {
|
} else if (NymeaSettings::isRoot()) {
|
||||||
path = "/etc/guh";
|
path = "/etc/nymea";
|
||||||
} else {
|
} else {
|
||||||
path = QDir::homePath() + "/.config/" + organisationName;
|
path = QDir::homePath() + "/.config/" + organisationName;
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the default system translation path \tt{/usr/share/guh/translations}. */
|
/*! Returns the default system translation path \tt{/usr/share/nymea/translations}. */
|
||||||
QString GuhSettings::translationsPath()
|
QString NymeaSettings::translationsPath()
|
||||||
{
|
{
|
||||||
if (!qgetenv("SNAP").isEmpty()) {
|
if (!qgetenv("SNAP").isEmpty()) {
|
||||||
return QString(qgetenv("SNAP") + "/usr/share/guh/translations");
|
return QString(qgetenv("SNAP") + "/usr/share/nymea/translations");
|
||||||
} else {
|
} else {
|
||||||
return QString("/usr/share/guh/translations");
|
return QString("/usr/share/nymea/translations");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the default system sorage path i.e. \tt{/var/lib/guh}. */
|
/*! Returns the default system sorage path i.e. \tt{/var/lib/nymea}. */
|
||||||
QString GuhSettings::storagePath()
|
QString NymeaSettings::storagePath()
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
QString organisationName = QCoreApplication::instance()->organizationName();
|
QString organisationName = QCoreApplication::instance()->organizationName();
|
||||||
if (!qgetenv("SNAP").isEmpty()) {
|
if (!qgetenv("SNAP").isEmpty()) {
|
||||||
path = QString(qgetenv("SNAP_DATA"));
|
path = QString(qgetenv("SNAP_DATA"));
|
||||||
} else if (organisationName == "guh-test") {
|
} else if (organisationName == "nymea-test") {
|
||||||
path = "/tmp/" + organisationName;
|
path = "/tmp/" + organisationName;
|
||||||
} else if (GuhSettings::isRoot()) {
|
} else if (NymeaSettings::isRoot()) {
|
||||||
path = "/var/lib/" + organisationName;
|
path = "/var/lib/" + organisationName;
|
||||||
} else {
|
} else {
|
||||||
path = QDir::homePath() + "/.local/share/" + organisationName;
|
path = QDir::homePath() + "/.local/share/" + organisationName;
|
||||||
@ -190,105 +190,105 @@ QString GuhSettings::storagePath()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! Return a list of all settings keys.*/
|
/*! Return a list of all settings keys.*/
|
||||||
QStringList GuhSettings::allKeys() const
|
QStringList NymeaSettings::allKeys() const
|
||||||
{
|
{
|
||||||
return m_settings->allKeys();
|
return m_settings->allKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Adds \a prefix to the current group and starts writing an array of size size. If size is -1 (the default),
|
/*! Adds \a prefix to the current group and starts writing an array of size size. If size is -1 (the default),
|
||||||
* it is automatically determined based on the indexes of the entries written. */
|
* it is automatically determined based on the indexes of the entries written. */
|
||||||
void GuhSettings::beginWriteArray(const QString &prefix)
|
void NymeaSettings::beginWriteArray(const QString &prefix)
|
||||||
{
|
{
|
||||||
m_settings->beginWriteArray(prefix);
|
m_settings->beginWriteArray(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Sets the current array index to \a i. */
|
/*! Sets the current array index to \a i. */
|
||||||
void GuhSettings::setArrayIndex(int i)
|
void NymeaSettings::setArrayIndex(int i)
|
||||||
{
|
{
|
||||||
m_settings->setArrayIndex(i);
|
m_settings->setArrayIndex(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Adds \a prefix to the current group and starts reading from an array. Returns the size of the array.*/
|
/*! Adds \a prefix to the current group and starts reading from an array. Returns the size of the array.*/
|
||||||
int GuhSettings::beginReadArray(const QString &prefix)
|
int NymeaSettings::beginReadArray(const QString &prefix)
|
||||||
{
|
{
|
||||||
return m_settings->beginReadArray(prefix);
|
return m_settings->beginReadArray(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! End an array. */
|
/*! End an array. */
|
||||||
void GuhSettings::endArray()
|
void NymeaSettings::endArray()
|
||||||
{
|
{
|
||||||
m_settings->endArray();
|
m_settings->endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Begins a new group with the given \a prefix.*/
|
/*! Begins a new group with the given \a prefix.*/
|
||||||
void GuhSettings::beginGroup(const QString &prefix)
|
void NymeaSettings::beginGroup(const QString &prefix)
|
||||||
{
|
{
|
||||||
m_settings->beginGroup(prefix);
|
m_settings->beginGroup(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns a list of all key top-level groups that contain keys that can be read
|
/*! Returns a list of all key top-level groups that contain keys that can be read
|
||||||
* using the \l{GuhSettings} object.*/
|
* using the \l{NymeaSettings} object.*/
|
||||||
QStringList GuhSettings::childGroups() const
|
QStringList NymeaSettings::childGroups() const
|
||||||
{
|
{
|
||||||
return m_settings->childGroups();
|
return m_settings->childGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns a list of all top-level keys that can be read using the \l{GuhSettings} object.*/
|
/*! Returns a list of all top-level keys that can be read using the \l{NymeaSettings} object.*/
|
||||||
QStringList GuhSettings::childKeys() const
|
QStringList NymeaSettings::childKeys() const
|
||||||
{
|
{
|
||||||
return m_settings->childKeys();
|
return m_settings->childKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Removes all entries in the primary location associated to this \l{GuhSettings} object.*/
|
/*! Removes all entries in the primary location associated to this \l{NymeaSettings} object.*/
|
||||||
void GuhSettings::clear()
|
void NymeaSettings::clear()
|
||||||
{
|
{
|
||||||
m_settings->clear();
|
m_settings->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns true if there exists a setting called \a key; returns false otherwise. */
|
/*! Returns true if there exists a setting called \a key; returns false otherwise. */
|
||||||
bool GuhSettings::contains(const QString &key) const
|
bool NymeaSettings::contains(const QString &key) const
|
||||||
{
|
{
|
||||||
return m_settings->contains(key);
|
return m_settings->contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Resets the group to what it was before the corresponding beginGroup() call. */
|
/*! Resets the group to what it was before the corresponding beginGroup() call. */
|
||||||
void GuhSettings::endGroup()
|
void NymeaSettings::endGroup()
|
||||||
{
|
{
|
||||||
m_settings->endGroup();
|
m_settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the current group. */
|
/*! Returns the current group. */
|
||||||
QString GuhSettings::group() const
|
QString NymeaSettings::group() const
|
||||||
{
|
{
|
||||||
return m_settings->group();
|
return m_settings->group();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the path where settings written using this \l{GuhSettings} object are stored. */
|
/*! Returns the path where settings written using this \l{NymeaSettings} object are stored. */
|
||||||
QString GuhSettings::fileName() const
|
QString NymeaSettings::fileName() const
|
||||||
{
|
{
|
||||||
return m_settings->fileName();
|
return m_settings->fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns true if settings can be written using this \l{GuhSettings} object; returns false otherwise. */
|
/*! Returns true if settings can be written using this \l{NymeaSettings} object; returns false otherwise. */
|
||||||
bool GuhSettings::isWritable() const
|
bool NymeaSettings::isWritable() const
|
||||||
{
|
{
|
||||||
return m_settings->isWritable();
|
return m_settings->isWritable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Removes the setting key and any sub-settings of \a key. */
|
/*! Removes the setting key and any sub-settings of \a key. */
|
||||||
void GuhSettings::remove(const QString &key)
|
void NymeaSettings::remove(const QString &key)
|
||||||
{
|
{
|
||||||
m_settings->remove(key);
|
m_settings->remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Sets the \a value of setting \a key to value. If the \a key already exists, the previous value is overwritten. */
|
/*! Sets the \a value of setting \a key to value. If the \a key already exists, the previous value is overwritten. */
|
||||||
void GuhSettings::setValue(const QString &key, const QVariant &value)
|
void NymeaSettings::setValue(const QString &key, const QVariant &value)
|
||||||
{
|
{
|
||||||
m_settings->setValue(key, value);
|
m_settings->setValue(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the value for setting \a key. If the setting doesn't exist, returns \a defaultValue. */
|
/*! Returns the value for setting \a key. If the setting doesn't exist, returns \a defaultValue. */
|
||||||
QVariant GuhSettings::value(const QString &key, const QVariant &defaultValue) const
|
QVariant NymeaSettings::value(const QString &key, const QVariant &defaultValue) const
|
||||||
{
|
{
|
||||||
return m_settings->value(key, defaultValue);
|
return m_settings->value(key, defaultValue);
|
||||||
}
|
}
|
||||||
@ -20,8 +20,8 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#ifndef GUHSETTINGS_H
|
#ifndef NYMEASETTINGS_H
|
||||||
#define GUHSETTINGS_H
|
#define NYMEASETTINGS_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
class LIBNYMEA_EXPORT GuhSettings : public QObject
|
class LIBNYMEA_EXPORT NymeaSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -43,8 +43,8 @@ public:
|
|||||||
SettingsRoleDeviceStates
|
SettingsRoleDeviceStates
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit GuhSettings(const SettingsRole &role = SettingsRoleNone, QObject *parent = nullptr);
|
explicit NymeaSettings(const SettingsRole &role = SettingsRoleNone, QObject *parent = nullptr);
|
||||||
~GuhSettings();
|
~NymeaSettings();
|
||||||
|
|
||||||
SettingsRole settingsRole() const;
|
SettingsRole settingsRole() const;
|
||||||
|
|
||||||
@ -80,4 +80,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUHSETTINGS_H
|
#endif // NYMEASETTINGS_H
|
||||||
@ -96,7 +96,7 @@
|
|||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
|
|
||||||
#include "hardware/radio433/radio433.h"
|
#include "hardware/radio433/radio433.h"
|
||||||
#include "network/upnp/upnpdiscovery.h"
|
#include "network/upnp/upnpdiscovery.h"
|
||||||
@ -178,8 +178,8 @@ bool DevicePlugin::setLocale(const QLocale &locale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise use the system translations
|
// otherwise use the system translations
|
||||||
if (m_translator->load(locale, m_metaData.value("id").toString(), "-", GuhSettings::translationsPath(), ".qm")) {
|
if (m_translator->load(locale, m_metaData.value("id").toString(), "-", NymeaSettings::translationsPath(), ".qm")) {
|
||||||
qCDebug(dcDeviceManager()) << "* Load translation" << locale.name() << "for" << pluginName() << "from" << GuhSettings::translationsPath();
|
qCDebug(dcDeviceManager()) << "* Load translation" << locale.name() << "for" << pluginName() << "from" << NymeaSettings::translationsPath();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include "guhservice.h"
|
#include "guhservice.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ GuhService::~GuhService()
|
|||||||
void GuhService::start()
|
void GuhService::start()
|
||||||
{
|
{
|
||||||
// check if config directory for logfile exists
|
// check if config directory for logfile exists
|
||||||
if (!QDir().mkpath(GuhSettings::settingsPath())) {
|
if (!QDir().mkpath(NymeaSettings::settingsPath())) {
|
||||||
fprintf(stdout, "Could not create guh settings directory %s", qPrintable(GuhSettings::settingsPath()));
|
fprintf(stdout, "Could not create nymea settings directory %s", qPrintable(NymeaSettings::settingsPath()));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
qCDebug(dcApplication) << "=====================================";
|
qCDebug(dcApplication) << "=====================================";
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "guhservice.h"
|
#include "guhservice.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "guhdbusservice.h"
|
#include "guhdbusservice.h"
|
||||||
#include "guhapplication.h"
|
#include "guhapplication.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
@ -149,8 +149,8 @@ int main(int argc, char *argv[])
|
|||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
// 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(), "-", NymeaSettings::translationsPath(), ".qm"))
|
||||||
qWarning(dcApplication()) << "Could not find nymead 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 << NymeaSettings::translationsPath();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -252,8 +252,8 @@ int main(int argc, char *argv[])
|
|||||||
int userId = getuid();
|
int userId = getuid();
|
||||||
if (userId != 0) {
|
if (userId != 0) {
|
||||||
// check if config directory for logfile exists
|
// check if config directory for logfile exists
|
||||||
if (!QDir().mkpath(GuhSettings::settingsPath())) {
|
if (!QDir().mkpath(NymeaSettings::settingsPath())) {
|
||||||
fprintf(stdout, "Could not create guh settings directory %s", qPrintable(GuhSettings::settingsPath()));
|
fprintf(stdout, "Could not create nymea settings directory %s", qPrintable(NymeaSettings::settingsPath()));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
qCDebug(dcApplication) << "=====================================";
|
qCDebug(dcApplication) << "=====================================";
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "guhtestbase.h"
|
#include "guhtestbase.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -1196,7 +1196,7 @@ void TestDevices::removeDevice()
|
|||||||
QFETCH(DeviceId, deviceId);
|
QFETCH(DeviceId, deviceId);
|
||||||
QFETCH(DeviceManager::DeviceError, deviceError);
|
QFETCH(DeviceManager::DeviceError, deviceError);
|
||||||
|
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
if (deviceError == DeviceManager::DeviceErrorNoError) {
|
if (deviceError == DeviceManager::DeviceErrorNoError) {
|
||||||
settings.beginGroup(m_mockDeviceId.toString());
|
settings.beginGroup(m_mockDeviceId.toString());
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "guhtestbase.h"
|
#include "guhtestbase.h"
|
||||||
#include "mocktcpserver.h"
|
#include "mocktcpserver.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "logging/logengine.h"
|
#include "logging/logengine.h"
|
||||||
@ -130,18 +130,18 @@ void GuhTestBase::initTestCase()
|
|||||||
|
|
||||||
// If testcase asserts cleanup won't do. Lets clear any previous test run settings leftovers
|
// If testcase asserts cleanup won't do. Lets clear any previous test run settings leftovers
|
||||||
qDebug() << "Reset test settings";
|
qDebug() << "Reset test settings";
|
||||||
GuhSettings rulesSettings(GuhSettings::SettingsRoleRules);
|
NymeaSettings rulesSettings(NymeaSettings::SettingsRoleRules);
|
||||||
rulesSettings.clear();
|
rulesSettings.clear();
|
||||||
GuhSettings deviceSettings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings deviceSettings(NymeaSettings::SettingsRoleDevices);
|
||||||
deviceSettings.clear();
|
deviceSettings.clear();
|
||||||
GuhSettings pluginSettings(GuhSettings::SettingsRolePlugins);
|
NymeaSettings pluginSettings(NymeaSettings::SettingsRolePlugins);
|
||||||
pluginSettings.clear();
|
pluginSettings.clear();
|
||||||
GuhSettings statesSettings(GuhSettings::SettingsRoleDeviceStates);
|
NymeaSettings statesSettings(NymeaSettings::SettingsRoleDeviceStates);
|
||||||
statesSettings.clear();
|
statesSettings.clear();
|
||||||
|
|
||||||
// Reset to default settings
|
// Reset to default settings
|
||||||
GuhSettings guhdSettings(GuhSettings::SettingsRoleGlobal);
|
NymeaSettings nymeadSettings(NymeaSettings::SettingsRoleGlobal);
|
||||||
guhdSettings.clear();
|
nymeadSettings.clear();
|
||||||
|
|
||||||
// debug categories
|
// debug categories
|
||||||
// logging filers for core and libnymea
|
// logging filers for core and libnymea
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "guhtestbase.h"
|
#include "guhtestbase.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "guhsettings.h"
|
#include "nymeasettings.h"
|
||||||
#include "logging/logentry.h"
|
#include "logging/logentry.h"
|
||||||
#include "logging/logvaluetool.h"
|
#include "logging/logvaluetool.h"
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
@ -582,7 +582,7 @@ void TestLogging::testHouseKeeping()
|
|||||||
QVERIFY2(response.toMap().value("params").toMap().value("logEntries").toList().count() > 0, "Couldn't find state change event in log...");
|
QVERIFY2(response.toMap().value("params").toMap().value("logEntries").toList().count() > 0, "Couldn't find state change event in log...");
|
||||||
|
|
||||||
// Manually delete this device from config
|
// Manually delete this device from config
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
settings.remove(deviceId.toString());
|
settings.remove(deviceId.toString());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|||||||
@ -58,14 +58,14 @@ void TestLoggingLoading::initTestCase()
|
|||||||
void TestLoggingLoading::testLogMigration()
|
void TestLoggingLoading::testLogMigration()
|
||||||
{
|
{
|
||||||
// Create LogEngine with log db from resource file
|
// Create LogEngine with log db from resource file
|
||||||
QString temporaryDbName = GuhSettings::settingsPath() + "/guhd-v2.sqlite";
|
QString temporaryDbName = NymeaSettings::settingsPath() + "/nymead-v2.sqlite";
|
||||||
|
|
||||||
if (QFile::exists(temporaryDbName))
|
if (QFile::exists(temporaryDbName))
|
||||||
QVERIFY(QFile(temporaryDbName).remove());
|
QVERIFY(QFile(temporaryDbName).remove());
|
||||||
|
|
||||||
// Copy v2 log db from resources to default settings path and set permissions
|
// Copy v2 log db from resources to default settings path and set permissions
|
||||||
qDebug() << "Copy logdb v2 to" << temporaryDbName;
|
qDebug() << "Copy logdb v2 to" << temporaryDbName;
|
||||||
QVERIFY(QFile::copy(":/guhd-v2.sqlite", temporaryDbName));
|
QVERIFY(QFile::copy(":/nymead-v2.sqlite", temporaryDbName));
|
||||||
QVERIFY(QFile::setPermissions(temporaryDbName, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther));
|
QVERIFY(QFile::setPermissions(temporaryDbName, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther));
|
||||||
|
|
||||||
LogEngine *logEngine = new LogEngine(temporaryDbName, this);
|
LogEngine *logEngine = new LogEngine(temporaryDbName, this);
|
||||||
@ -80,8 +80,8 @@ void TestLoggingLoading::testLogMigration()
|
|||||||
void TestLoggingLoading::testLogfileRotation()
|
void TestLoggingLoading::testLogfileRotation()
|
||||||
{
|
{
|
||||||
// Create LogEngine with log db from resource file
|
// Create LogEngine with log db from resource file
|
||||||
QString temporaryDbName = GuhSettings::settingsPath() + "/guhd-broken.sqlite";
|
QString temporaryDbName = NymeaSettings::settingsPath() + "/nymead-broken.sqlite";
|
||||||
QString rotatedDbName = GuhSettings::settingsPath() + "/guhd-broken.sqlite.1";
|
QString rotatedDbName = NymeaSettings::settingsPath() + "/nymead-broken.sqlite.1";
|
||||||
|
|
||||||
// Remove the files if there are some left
|
// Remove the files if there are some left
|
||||||
if (QFile::exists(temporaryDbName))
|
if (QFile::exists(temporaryDbName))
|
||||||
@ -92,7 +92,7 @@ void TestLoggingLoading::testLogfileRotation()
|
|||||||
|
|
||||||
// Copy broken log db from resources to default settings path and set permissions
|
// Copy broken log db from resources to default settings path and set permissions
|
||||||
qDebug() << "Copy broken log db to" << temporaryDbName;
|
qDebug() << "Copy broken log db to" << temporaryDbName;
|
||||||
QVERIFY(QFile::copy(":/guhd-broken.sqlite", temporaryDbName));
|
QVERIFY(QFile::copy(":/nymead-broken.sqlite", temporaryDbName));
|
||||||
QVERIFY(QFile::setPermissions(temporaryDbName, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther));
|
QVERIFY(QFile::setPermissions(temporaryDbName, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther));
|
||||||
|
|
||||||
QVERIFY(!QFile::exists(rotatedDbName));
|
QVERIFY(!QFile::exists(rotatedDbName));
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
#include "guhtestbase.h"
|
#include "guhtestbase.h"
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "guhsettings.h"
|
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|||||||
@ -2270,7 +2270,7 @@ void TestRules::testHousekeeping()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manually delete this device from config
|
// Manually delete this device from config
|
||||||
GuhSettings settings(GuhSettings::SettingsRoleDevices);
|
NymeaSettings settings(NymeaSettings::SettingsRoleDevices);
|
||||||
settings.beginGroup("DeviceConfig");
|
settings.beginGroup("DeviceConfig");
|
||||||
settings.remove(deviceId.toString());
|
settings.remove(deviceId.toString());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|||||||
@ -381,7 +381,7 @@ void TestWebserver::getFiles_data()
|
|||||||
QTest::newRow("get /../../etc/passwd") << "/../../etc/passwd" << 404;
|
QTest::newRow("get /../../etc/passwd") << "/../../etc/passwd" << 404;
|
||||||
QTest::newRow("get /../../") << "/../../" << 403;
|
QTest::newRow("get /../../") << "/../../" << 403;
|
||||||
QTest::newRow("get /../") << "/../" << 403;
|
QTest::newRow("get /../") << "/../" << 403;
|
||||||
QTest::newRow("get /etc/guh/guhd.conf") << "/etc/guh/guhd.conf" << 404;
|
QTest::newRow("get /etc/guh/nymead.conf") << "/etc/guh/nymead.conf" << 404;
|
||||||
QTest::newRow("get /etc/sudoers") << "/etc/sudoers" << 404;
|
QTest::newRow("get /etc/sudoers") << "/etc/sudoers" << 404;
|
||||||
QTest::newRow("get /root/.ssh/id_rsa.pub") << "/root/.ssh/id_rsa.pub" << 404;
|
QTest::newRow("get /root/.ssh/id_rsa.pub") << "/root/.ssh/id_rsa.pub" << 404;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user