Merge PR #296: Fix AWS testing environment at app startup
This commit is contained in:
commit
a235cec7cb
@ -156,6 +156,10 @@ bool AWSClient::confirmationPending() const
|
|||||||
|
|
||||||
void AWSClient::login(const QString &username, const QString &password)
|
void AWSClient::login(const QString &username, const QString &password)
|
||||||
{
|
{
|
||||||
|
if (m_usedConfig.isEmpty()) {
|
||||||
|
qDebug() << "AWS config not set. Not logging in.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (m_loginInProgress) {
|
if (m_loginInProgress) {
|
||||||
qWarning() << "Login already pending...";
|
qWarning() << "Login already pending...";
|
||||||
return;
|
return;
|
||||||
@ -195,7 +199,7 @@ void AWSClient::login(const QString &username, const QString &password)
|
|||||||
QJsonDocument jsonDoc = QJsonDocument::fromVariant(params);
|
QJsonDocument jsonDoc = QJsonDocument::fromVariant(params);
|
||||||
QByteArray payload = jsonDoc.toJson(QJsonDocument::Compact);
|
QByteArray payload = jsonDoc.toJson(QJsonDocument::Compact);
|
||||||
|
|
||||||
qDebug() << "Logging in to AWS as user:" << username;
|
qDebug() << "Logging in to AWS as user:" << username << "with config" << m_usedConfig;
|
||||||
|
|
||||||
QNetworkReply *reply = m_nam->post(request, payload);
|
QNetworkReply *reply = m_nam->post(request, payload);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply, username, password]() {
|
connect(reply, &QNetworkReply::finished, this, [this, reply, username, password]() {
|
||||||
|
|||||||
@ -215,7 +215,7 @@ private:
|
|||||||
QList<QueuedCall> m_callQueue;
|
QList<QueuedCall> m_callQueue;
|
||||||
|
|
||||||
QHash<QString, AWSConfiguration> m_configs;
|
QHash<QString, AWSConfiguration> m_configs;
|
||||||
QString m_usedConfig = "Community";
|
QString m_usedConfig = "";
|
||||||
AWSDevices *m_devices;
|
AWSDevices *m_devices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,6 @@ void NymeaDiscovery::setAwsClient(AWSClient *awsClient)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_awsClient) {
|
if (m_awsClient) {
|
||||||
m_awsClient->fetchDevices();
|
|
||||||
connect(m_awsClient, &AWSClient::devicesFetched, this, &NymeaDiscovery::syncCloudDevices);
|
connect(m_awsClient, &AWSClient::devicesFetched, this, &NymeaDiscovery::syncCloudDevices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,8 +136,8 @@ Connection *NymeaConnection::currentConnection() const
|
|||||||
|
|
||||||
void NymeaConnection::sendData(const QByteArray &data)
|
void NymeaConnection::sendData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
|
// qDebug() << "sending data:" << data;
|
||||||
if (connected()) {
|
if (connected()) {
|
||||||
// qDebug() << "sending data:" << data;
|
|
||||||
m_currentTransport->sendData(data);
|
m_currentTransport->sendData(data);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Connection: Not connected. Cannot send.";
|
qWarning() << "Connection: Not connected. Cannot send.";
|
||||||
@ -629,6 +629,8 @@ bool NymeaConnection::isConnectionBearerAvailable(Connection::BearerType connect
|
|||||||
return true;
|
return true;
|
||||||
case Connection::BearerTypeNone:
|
case Connection::BearerTypeNone:
|
||||||
return false;
|
return false;
|
||||||
|
case Connection::BearerTypeLoopback:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -310,6 +310,10 @@ void JsonRpcClient::setNotificationsEnabled()
|
|||||||
namespaces.append(nameSpace);
|
namespaces.append(nameSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_connection->connected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap params;
|
QVariantMap params;
|
||||||
|
|
||||||
if (ensureServerVersion("3.1")) {
|
if (ensureServerVersion("3.1")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user