remove post setup
This commit is contained in:
parent
6203139e92
commit
cfc965489f
@ -107,15 +107,6 @@ DeviceManager::DeviceSetupStatus DevicePluginAwattar::setupDevice(Device *device
|
|||||||
return DeviceManager::DeviceSetupStatusAsync;
|
return DeviceManager::DeviceSetupStatusAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginAwattar::postSetupDevice(Device *device)
|
|
||||||
{
|
|
||||||
if (device != m_device)
|
|
||||||
return;
|
|
||||||
|
|
||||||
searchHeatPumps();
|
|
||||||
updateData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DevicePluginAwattar::deviceRemoved(Device *device)
|
void DevicePluginAwattar::deviceRemoved(Device *device)
|
||||||
{
|
{
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
@ -139,7 +130,6 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
|
|||||||
// check HTTP status code
|
// check HTTP status code
|
||||||
if (status != 200) {
|
if (status != 200) {
|
||||||
qCWarning(dcAwattar) << "Setup reply HTTP error:" << status << reply->errorString();
|
qCWarning(dcAwattar) << "Setup reply HTTP error:" << status << reply->errorString();
|
||||||
|
|
||||||
if (m_setupRetry == 3) {
|
if (m_setupRetry == 3) {
|
||||||
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusFailure);
|
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusFailure);
|
||||||
m_setupRetry = 0;
|
m_setupRetry = 0;
|
||||||
@ -166,8 +156,14 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_UNUSED(jsonDoc)
|
||||||
|
|
||||||
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusSuccess);
|
emit deviceSetupFinished(m_device, DeviceManager::DeviceSetupStatusSuccess);
|
||||||
|
|
||||||
|
// get data
|
||||||
|
searchHeatPumps();
|
||||||
|
updateData();
|
||||||
|
|
||||||
} else if (m_updatePrice.contains(reply)) {
|
} else if (m_updatePrice.contains(reply)) {
|
||||||
|
|
||||||
m_updatePrice.removeAll(reply);
|
m_updatePrice.removeAll(reply);
|
||||||
@ -234,6 +230,9 @@ void DevicePluginAwattar::networkManagerReplyReady(QNetworkReply *reply)
|
|||||||
|
|
||||||
void DevicePluginAwattar::guhTimer()
|
void DevicePluginAwattar::guhTimer()
|
||||||
{
|
{
|
||||||
|
if (!m_device)
|
||||||
|
return;
|
||||||
|
|
||||||
updateData();
|
updateData();
|
||||||
searchHeatPumps();
|
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();
|
QByteArray data = QString(token + ":").toUtf8().toBase64();
|
||||||
QString header = "Basic " + data;
|
QString header = "Basic " + data;
|
||||||
@ -404,7 +403,6 @@ void DevicePluginAwattar::updateData()
|
|||||||
m_updatePrice.append(requestPriceData(m_token));
|
m_updatePrice.append(requestPriceData(m_token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DevicePluginAwattar::searchHeatPumps()
|
void DevicePluginAwattar::searchHeatPumps()
|
||||||
{
|
{
|
||||||
QHostAddress rplAddress = QHostAddress(configuration().paramValue("RPL address").toString());
|
QHostAddress rplAddress = QHostAddress(configuration().paramValue("RPL address").toString());
|
||||||
|
|||||||
@ -40,24 +40,20 @@ public:
|
|||||||
DeviceManager::HardwareResources requiredHardware() const override;
|
DeviceManager::HardwareResources requiredHardware() const override;
|
||||||
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
||||||
|
|
||||||
void postSetupDevice(Device *device) override;
|
|
||||||
|
|
||||||
void startMonitoringAutoDevices() override;
|
|
||||||
|
|
||||||
void deviceRemoved(Device *device) override;
|
void deviceRemoved(Device *device) override;
|
||||||
void networkManagerReplyReady(QNetworkReply *reply) override;
|
void networkManagerReplyReady(QNetworkReply *reply) override;
|
||||||
|
|
||||||
void guhTimer() override;
|
void guhTimer() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Device *m_device;
|
||||||
|
QList<HeatPump *> m_heatPumps;
|
||||||
|
|
||||||
QList<QNetworkReply *> m_asyncSetup;
|
QList<QNetworkReply *> m_asyncSetup;
|
||||||
QList<QNetworkReply *> m_searchPumpReplies;
|
QList<QNetworkReply *> m_searchPumpReplies;
|
||||||
QList<QNetworkReply *> m_updatePrice;
|
QList<QNetworkReply *> m_updatePrice;
|
||||||
QList<QNetworkReply *> m_updateUserData;
|
QList<QNetworkReply *> m_updateUserData;
|
||||||
|
|
||||||
Device *m_device;
|
|
||||||
QList<HeatPump *> m_heatPumps;
|
|
||||||
|
|
||||||
QString m_token;
|
QString m_token;
|
||||||
QString m_userUuid;
|
QString m_userUuid;
|
||||||
int m_setupRetry;
|
int m_setupRetry;
|
||||||
@ -73,7 +69,6 @@ private:
|
|||||||
void searchHeatPumps();
|
void searchHeatPumps();
|
||||||
bool heatPumpExists(const QHostAddress &pumpAddress);
|
bool heatPumpExists(const QHostAddress &pumpAddress);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void connectionTest();
|
void connectionTest();
|
||||||
void onHeatPumpReachableChanged();
|
void onHeatPumpReachableChanged();
|
||||||
|
|||||||
@ -37,8 +37,8 @@ public:
|
|||||||
|
|
||||||
QHostAddress address() const;
|
QHostAddress address() const;
|
||||||
bool reachable() const;
|
bool reachable() const;
|
||||||
|
|
||||||
void setSgMode(const int &sgMode);
|
void setSgMode(const int &sgMode);
|
||||||
|
|
||||||
void setLed(const bool &power);
|
void setLed(const bool &power);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user