AWS disconnect fixes

pull/135/head
Michael Zanetti 2017-11-22 10:23:38 +01:00
parent 46a61e3ccc
commit f563be8d40
4 changed files with 29 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -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;

View File

@ -54,6 +54,7 @@ signals:
void TcpServerConfigurationChanged(const QVariantMap &params);
void WebServerConfigurationChanged(const QVariantMap &params);
void WebSocketServerConfigurationChanged(const QVariantMap &params);
void CloudConfigurationChanged(const QVariantMap &params);
void LanguageChanged(const QVariantMap &params);
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();
};

View File

@ -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