fix pairing with hue plugin
This commit is contained in:
parent
9d9b228b88
commit
7a63045999
@ -259,14 +259,14 @@ void DevicePluginPhilipsHue::discoveryDone(const QList<QHostAddress> &bridges)
|
|||||||
emit devicesDiscovered(hueDeviceClassId, deviceDescriptors);
|
emit devicesDiscovered(hueDeviceClassId, deviceDescriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginPhilipsHue::createUserFinished(int id, const QVariantMap &response)
|
void DevicePluginPhilipsHue::createUserFinished(int id, const QVariant &response)
|
||||||
{
|
{
|
||||||
qDebug() << "createuser response" << response;
|
qDebug() << "createuser response" << response;
|
||||||
|
|
||||||
PairingInfo pairingInfo = m_pairings.take(id);
|
PairingInfo pairingInfo = m_pairings.take(id);
|
||||||
if (response.contains("error")) {
|
if (response.toMap().contains("error")) {
|
||||||
qDebug() << "Failed to pair Hue bridge:" << response.value("error").toMap().value("description");
|
qDebug() << "Failed to pair Hue bridge:" << response.toMap().value("error").toMap().value("description");
|
||||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure, "Pairing failed:" + response.value("error").toMap().value("description").toString());
|
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure, "Pairing failed:" + response.toMap().value("error").toMap().value("description").toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,19 +277,19 @@ void DevicePluginPhilipsHue::createUserFinished(int id, const QVariantMap &respo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginPhilipsHue::getLightsFinished(int id, const QVariantMap ¶ms)
|
void DevicePluginPhilipsHue::getLightsFinished(int id, const QVariant ¶ms)
|
||||||
{
|
{
|
||||||
qDebug() << "getlightsfinished" << params;
|
qDebug() << "getlightsfinished" << params;
|
||||||
PairingInfo pairingInfo = m_pairings.take(id);
|
PairingInfo pairingInfo = m_pairings.take(id);
|
||||||
|
|
||||||
if (params.count() == 0) {
|
if (params.toMap().count() == 0) {
|
||||||
qWarning() << "No light bulbs found on this hue bridge... Cannot proceed with pairing.";
|
qWarning() << "No light bulbs found on this hue bridge... Cannot proceed with pairing.";
|
||||||
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure, "No light bulbs found on this Hue bridge.");
|
emit pairingFinished(pairingInfo.pairingTransactionId, DeviceManager::DeviceSetupStatusFailure, "No light bulbs found on this Hue bridge.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store a list of all known Lights
|
// Store a list of all known Lights
|
||||||
foreach (const QString &lightId, params.keys()) {
|
foreach (const QString &lightId, params.toMap().keys()) {
|
||||||
Light *light = new Light(QHostAddress(pairingInfo.ipParam.value().toString()), pairingInfo.usernameParam.value().toString(), lightId.toInt(), this);
|
Light *light = new Light(QHostAddress(pairingInfo.ipParam.value().toString()), pairingInfo.usernameParam.value().toString(), lightId.toInt(), this);
|
||||||
m_unconfiguredLights.insert(lightId.toInt(), light);
|
m_unconfiguredLights.insert(lightId.toInt(), light);
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ void DevicePluginPhilipsHue::getLightsFinished(int id, const QVariantMap ¶ms
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginPhilipsHue::getFinished(int id, const QVariantMap ¶ms)
|
void DevicePluginPhilipsHue::getFinished(int id, const QVariant ¶ms)
|
||||||
{
|
{
|
||||||
qDebug() << "got lights" << params;
|
qDebug() << "got lights" << params;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,9 +58,9 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void discoveryDone(const QList<QHostAddress> &bridges);
|
void discoveryDone(const QList<QHostAddress> &bridges);
|
||||||
|
|
||||||
void createUserFinished(int id, const QVariantMap ¶ms);
|
void createUserFinished(int id, const QVariant ¶ms);
|
||||||
void getLightsFinished(int id, const QVariantMap ¶ms);
|
void getLightsFinished(int id, const QVariant ¶ms);
|
||||||
void getFinished(int id, const QVariantMap ¶ms);
|
void getFinished(int id, const QVariant ¶ms);
|
||||||
|
|
||||||
void lightStateChanged();
|
void lightStateChanged();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user