remove post setup

This commit is contained in:
Simon Stürz 2016-01-20 17:00:29 +01:00 committed by Michael Zanetti
parent 6203139e92
commit cfc965489f
3 changed files with 14 additions and 21 deletions

View File

@ -107,15 +107,6 @@ DeviceManager::DeviceSetupStatus DevicePluginAwattar::setupDevice(Device *device
return DeviceManager::DeviceSetupStatusAsync;
}
void DevicePluginAwattar::postSetupDevice(Device *device)
{
if (device != m_device)
return;
searchHeatPumps();
updateData();
}
void DevicePluginAwattar::deviceRemoved(Device *device)
{
Q_UNUSED(device)
@ -139,7 +130,6 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
// check HTTP status code
if (status != 200) {
qCWarning(dcAwattar) << "Setup reply HTTP error:" << status << reply->errorString();
if (m_setupRetry == 3) {
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusFailure);
m_setupRetry = 0;
@ -166,8 +156,14 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
return;
}
Q_UNUSED(jsonDoc)
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusSuccess);
// get data
searchHeatPumps();
updateData();
} else if (m_updatePrice.contains(reply)) {
m_updatePrice.removeAll(reply);
@ -234,6 +230,9 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
void DevicePluginAwattar::guhTimer()
{
if (!m_device)
return;
updateData();
searchHeatPumps();
}
@ -378,7 +377,7 @@ void DevicePluginAwattar::processPumpSearchData(const QByteArray &data)
}
}
QNetworkReply *DevicePluginAwattar::requestPriceData(const QString &token)
QNetworkReply *DevicePluginAwattar:: requestPriceData(const QString &token)
{
QByteArray data = QString(token + ":").toUtf8().toBase64();
QString header = "Basic " + data;
@ -404,7 +403,6 @@ void DevicePluginAwattar::updateData()
m_updatePrice.append(requestPriceData(m_token));
}
void DevicePluginAwattar::searchHeatPumps()
{
QHostAddress rplAddress = QHostAddress(configuration().paramValue("RPL address").toString());

View File

@ -40,24 +40,20 @@ public:
DeviceManager::HardwareResources requiredHardware() const override;
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
void postSetupDevice(Device *device) override;
void startMonitoringAutoDevices() override;
void deviceRemoved(Device *device) override;
void networkManagerReplyReady(QNetworkReply *reply) override;
void guhTimer() override;
private:
Device *m_device;
QList<HeatPump *> m_heatPumps;
QList<QNetworkReply *> m_asyncSetup;
QList<QNetworkReply *> m_searchPumpReplies;
QList<QNetworkReply *> m_updatePrice;
QList<QNetworkReply *> m_updateUserData;
Device *m_device;
QList<HeatPump *> m_heatPumps;
QString m_token;
QString m_userUuid;
int m_setupRetry;
@ -73,7 +69,6 @@ private:
void searchHeatPumps();
bool heatPumpExists(const QHostAddress &pumpAddress);
private slots:
void connectionTest();
void onHeatPumpReachableChanged();

View File

@ -37,8 +37,8 @@ public:
QHostAddress address() const;
bool reachable() const;
void setSgMode(const int &sgMode);
void setLed(const bool &power);
private: