Add factory reset network method

pull/459/head
Simon Stürz 2020-11-09 15:30:16 +01:00 committed by Michael Zanetti
parent a171879db7
commit e2735428b8
3 changed files with 18 additions and 1 deletions

View File

@ -97,6 +97,13 @@ void ZigbeeManager::setPermitJoin(const QUuid &networkUuid, uint duration)
m_client->sendCommand("Zigbee.SetPermitJoin", params, this, "setPermitJoinResponse");
}
void ZigbeeManager::factoryResetNetwork(const QUuid &networkUuid)
{
QVariantMap params;
params.insert("networkUuid", networkUuid);
m_client->sendCommand("Zigbee.FactoryResetNetwork", params, this, "factoryResetNetworkResponse");
}
void ZigbeeManager::init()
{
// FIXME: load only when used
@ -145,6 +152,11 @@ void ZigbeeManager::setPermitJoinResponse(int commandId, const QVariantMap &para
qDebug() << "Zigbee set permit join network response" << commandId << params;
}
void ZigbeeManager::factoryResetNetworkResponse(int commandId, const QVariantMap &params)
{
qDebug() << "Zigbee factory reset network response" << commandId << params;
}
void ZigbeeManager::notificationReceived(const QVariantMap &notification)
{
QString notificationString = notification.value("notification").toString();

View File

@ -58,6 +58,7 @@ public:
Q_INVOKABLE void addNetwork(const QString &serialPort, uint baudRate, ZigbeeAdapter::ZigbeeBackendType backendType);
Q_INVOKABLE void removeNetwork(const QUuid &networkUuid);
Q_INVOKABLE void setPermitJoin(const QUuid &networkUuid, uint duration = 120);
Q_INVOKABLE void factoryResetNetwork(const QUuid &networkUuid);
void init();
@ -70,6 +71,7 @@ private:
Q_INVOKABLE void addNetworkResponse(int commandId, const QVariantMap &params);
Q_INVOKABLE void removeNetworkResponse(int commandId, const QVariantMap &params);
Q_INVOKABLE void setPermitJoinResponse(int commandId, const QVariantMap &params);
Q_INVOKABLE void factoryResetNetworkResponse(int commandId, const QVariantMap &params);
Q_INVOKABLE void notificationReceived(const QVariantMap &notification);

View File

@ -114,7 +114,10 @@ SettingsPageBase {
Layout.leftMargin: app.margins
Layout.rightMargin: app.margins
text: qsTr("Factory reset controller")
onClicked: print("Reset clicked")
onClicked: {
engine.zigbeeManager.factoryResetNetwork(root.network.networkUuid)
pageStack.pop()
}
}
}