mirror of https://github.com/nymea/nymea.git
AWS disconnect fixes
parent
46a61e3ccc
commit
f563be8d40
|
|
@ -187,6 +187,10 @@ void AWSConnector::disconnectAWS()
|
|||
m_shouldReconnect = false;
|
||||
if (isConnected()) {
|
||||
m_client->Disconnect(std::chrono::seconds(2));
|
||||
m_client.reset();
|
||||
m_networkConnection.reset();
|
||||
qCDebug(dcAWS()) << "Disconnected from AWS.";
|
||||
emit disconnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,12 +206,18 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent):
|
|||
params.insert("language", JsonTypes::basicTypeToString(JsonTypes::String));
|
||||
setParams("LanguageChanged", params);
|
||||
|
||||
params.clear(); returns.clear();
|
||||
setDescription("CloudConfigurationChanged", "Emitted whenever the cloud configuration is changed.");
|
||||
params.insert("enabled", JsonTypes::basicTypeToString(JsonTypes::Bool));
|
||||
setParams("CloudConfigurationChanged", params);
|
||||
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::serverNameChanged, this, &ConfigurationHandler::onBasicConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::timeZoneChanged, this, &ConfigurationHandler::onBasicConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::localeChanged, this, &ConfigurationHandler::onBasicConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::tcpServerConfigurationChanged, this, &ConfigurationHandler::onTcpServerConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::webServerConfigurationChanged, this, &ConfigurationHandler::onWebServerConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::webSocketServerConfigurationChanged, this, &ConfigurationHandler::onWebSocketServerConfigurationChanged);
|
||||
connect(GuhCore::instance()->configuration(), &GuhConfiguration::cloudEnabledChanged, this, &ConfigurationHandler::onCloudConfigurationChanged);
|
||||
connect(GuhCore::instance()->deviceManager(), &DeviceManager::languageUpdated, this, &ConfigurationHandler::onLanguageChanged);
|
||||
}
|
||||
|
||||
|
|
@ -442,6 +448,16 @@ void ConfigurationHandler::onWebSocketServerConfigurationChanged(const QString &
|
|||
emit WebSocketServerConfigurationChanged(params);
|
||||
}
|
||||
|
||||
void ConfigurationHandler::onCloudConfigurationChanged(bool enabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
qCDebug(dcJanus()) << "Notification: cloud configuration changed";
|
||||
QVariantMap cloudConfiguration;
|
||||
cloudConfiguration.insert("enabled", enabled);
|
||||
params.insert("cloudConfiguration", cloudConfiguration);
|
||||
emit CloudConfigurationChanged(params);
|
||||
}
|
||||
|
||||
void ConfigurationHandler::onLanguageChanged()
|
||||
{
|
||||
QVariantMap params;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ signals:
|
|||
void TcpServerConfigurationChanged(const QVariantMap ¶ms);
|
||||
void WebServerConfigurationChanged(const QVariantMap ¶ms);
|
||||
void WebSocketServerConfigurationChanged(const QVariantMap ¶ms);
|
||||
void CloudConfigurationChanged(const QVariantMap ¶ms);
|
||||
void LanguageChanged(const QVariantMap ¶ms);
|
||||
|
||||
private slots:
|
||||
|
|
@ -61,6 +62,7 @@ private slots:
|
|||
void onTcpServerConfigurationChanged(const QString &id);
|
||||
void onWebServerConfigurationChanged(const QString &id);
|
||||
void onWebSocketServerConfigurationChanged(const QString &id);
|
||||
void onCloudConfigurationChanged(bool enabled);
|
||||
void onLanguageChanged();
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
echo "usage: $0 host <true|false>"
|
||||
else
|
||||
(echo '{"id":1, "method":"Configuration.SetCloudEnabled", "params":{"enabled": "'$2'"}}'; sleep 10) | nc $1 2222
|
||||
fi
|
||||
Loading…
Reference in New Issue