Improve some debug prints in nymeaconfiguration
This commit is contained in:
parent
06688c2cd2
commit
483b794421
@ -38,6 +38,10 @@
|
|||||||
#include "jsonrpc/jsonrpcclient.h"
|
#include "jsonrpc/jsonrpcclient.h"
|
||||||
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
|
||||||
|
#include "logging.h"
|
||||||
|
NYMEA_LOGGING_CATEGORY(dcNymeaConfiguration, "NymeaConfiguration")
|
||||||
|
|
||||||
NymeaConfiguration::NymeaConfiguration(JsonRpcClient *client, QObject *parent):
|
NymeaConfiguration::NymeaConfiguration(JsonRpcClient *client, QObject *parent):
|
||||||
JsonHandler(parent),
|
JsonHandler(parent),
|
||||||
@ -396,16 +400,16 @@ void NymeaConfiguration::notificationReceived(const QVariantMap ¬ification)
|
|||||||
QString notif = notification.value("notification").toString();
|
QString notif = notification.value("notification").toString();
|
||||||
if (notif == "Configuration.BasicConfigurationChanged") {
|
if (notif == "Configuration.BasicConfigurationChanged") {
|
||||||
QVariantMap params = notification.value("params").toMap().value("basicConfiguration").toMap();
|
QVariantMap params = notification.value("params").toMap().value("basicConfiguration").toMap();
|
||||||
qDebug() << "notif" << params;
|
|
||||||
m_debugServerEnabled = params.value("debugServerEnabled").toBool();
|
m_debugServerEnabled = params.value("debugServerEnabled").toBool();
|
||||||
emit debugServerEnabledChanged();
|
emit debugServerEnabledChanged();
|
||||||
m_serverName = params.value("serverName").toString();
|
m_serverName = params.value("serverName").toString();
|
||||||
emit serverNameChanged();
|
emit serverNameChanged();
|
||||||
|
qCDebug(dcNymeaConfiguration()) << "Basic configuration changed. Server name:" << m_serverName << "Debug server enabled:" << m_debugServerEnabled;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (notif == "Configuration.CloudConfigurationChanged") {
|
if (notif == "Configuration.CloudConfigurationChanged") {
|
||||||
QVariantMap params = notification.value("params").toMap().value("cloudConfiguration").toMap();
|
QVariantMap params = notification.value("params").toMap().value("cloudConfiguration").toMap();
|
||||||
qDebug() << "notif" << params;
|
qCDebug(dcNymeaConfiguration()) << "Cloud coniguration changed" << params;
|
||||||
m_cloudEnabled = params.value("enabled").toBool();
|
m_cloudEnabled = params.value("enabled").toBool();
|
||||||
emit cloudEnabledChanged();
|
emit cloudEnabledChanged();
|
||||||
return;
|
return;
|
||||||
@ -493,17 +497,19 @@ void NymeaConfiguration::notificationReceived(const QVariantMap ¬ification)
|
|||||||
policy->setPassword(policyMap.value("password").toString());
|
policy->setPassword(policyMap.value("password").toString());
|
||||||
policy->setAllowedPublishTopicFilters(policyMap.value("allowedPublishTopicFilters").toStringList());
|
policy->setAllowedPublishTopicFilters(policyMap.value("allowedPublishTopicFilters").toStringList());
|
||||||
policy->setAllowedSubscribeTopicFilters(policyMap.value("allowedSubscribeTopicFilters").toStringList());
|
policy->setAllowedSubscribeTopicFilters(policyMap.value("allowedSubscribeTopicFilters").toStringList());
|
||||||
qDebug() << "MQTT policy added" << policy->clientId() << policy->username() << policy->password();
|
qCDebug(dcNymeaConfiguration()) << "MQTT policy changed" << policy->clientId() << policy->username() << policy->password();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (notif == "Configuration.MqttPolicyRemoved") {
|
if (notif == "Configuration.MqttPolicyRemoved") {
|
||||||
MqttPolicy* policy = m_mqttPolicies->getPolicy(notification.value("params").toMap().value("clientId").toString());
|
MqttPolicy* policy = m_mqttPolicies->getPolicy(notification.value("params").toMap().value("clientId").toString());
|
||||||
if (!policy) {
|
if (!policy) {
|
||||||
qWarning() << "Reveived a policy removed notification for apolicy we don't know";
|
qCWarning(dcNymeaConfiguration()) << "Reveived a policy removed notification for apolicy we don't know";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
qCDebug(dcNymeaConfiguration()) << "MQTT policy removed" << policy->clientId() << policy->username() << policy->password();
|
||||||
m_mqttPolicies->removePolicy(policy);
|
m_mqttPolicies->removePolicy(policy);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Unhandled Configuration notification" << notif << notification;
|
qCWarning(dcNymeaConfiguration) << "Unhandled Configuration notification" << qUtf8Printable(QJsonDocument::fromVariant(notification).toJson());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,6 +121,7 @@ int ThingManager::addThing(const QUuid &thingClassId, const QString &name, const
|
|||||||
|
|
||||||
void ThingManager::notificationReceived(const QVariantMap &data)
|
void ThingManager::notificationReceived(const QVariantMap &data)
|
||||||
{
|
{
|
||||||
|
qCDebug(dcThingManager()) << "ThingManager notifications received:" << qUtf8Printable(QJsonDocument::fromVariant(data).toJson());
|
||||||
QString notification = data.value("notification").toString();
|
QString notification = data.value("notification").toString();
|
||||||
if (notification == "Integrations.StateChanged") {
|
if (notification == "Integrations.StateChanged") {
|
||||||
Thing *thing = m_things->getThing(data.value("params").toMap().value("thingId").toUuid());
|
Thing *thing = m_things->getThing(data.value("params").toMap().value("thingId").toUuid());
|
||||||
@ -163,7 +164,7 @@ void ThingManager::notificationReceived(const QVariantMap &data)
|
|||||||
thing->deleteLater();
|
thing->deleteLater();
|
||||||
} else if (notification == "Integrations.ThingChanged") {
|
} else if (notification == "Integrations.ThingChanged") {
|
||||||
QUuid thingId = data.value("params").toMap().value("thing").toMap().value("id").toUuid();
|
QUuid thingId = data.value("params").toMap().value("thing").toMap().value("id").toUuid();
|
||||||
// qDebug() << "Thing changed notification" << thingId << data.value("params").toMap();
|
qCDebug(dcThingManager()) << "Thing changed notification" << thingId << data.value("params").toMap();
|
||||||
Thing *oldThing = m_things->getThing(thingId);
|
Thing *oldThing = m_things->getThing(thingId);
|
||||||
if (!oldThing) {
|
if (!oldThing) {
|
||||||
qWarning() << "Received a thing changed notification for a thing we don't know";
|
qWarning() << "Received a thing changed notification for a thing we don't know";
|
||||||
|
|||||||
Reference in New Issue
Block a user