add a power interface and use that for lights

This commit is contained in:
Michael Zanetti 2018-02-12 11:55:11 +01:00
parent 167ac6f3c3
commit 213db704a4
4 changed files with 14 additions and 9 deletions

View File

@ -25,6 +25,7 @@
<file>connectable.json</file> <file>connectable.json</file>
<file>inputtrigger.json</file> <file>inputtrigger.json</file>
<file>outputtrigger.json</file> <file>outputtrigger.json</file>
<file>power.json</file>
</qresource> </qresource>
<qresource prefix="/"/> <qresource prefix="/"/>
</RCC> </RCC>

View File

@ -1,9 +1,3 @@
{ {
"states": [ "extends": "power"
{
"name": "power",
"type": "bool",
"writable": true
}
]
} }

View File

@ -0,0 +1,9 @@
{
"states": [
{
"name": "power",
"type": "bool",
"writable": true
}
]
}

View File

@ -241,11 +241,12 @@ void TestDevices::verifyInterfaces()
QVERIFY(!mockDevice.isEmpty()); QVERIFY(!mockDevice.isEmpty());
QVariantList interfaces = mockDevice.value("interfaces").toList(); QVariantList interfaces = mockDevice.value("interfaces").toList();
// Must contain gateway, light and battery, but must not contain mediacontroller as the device manager should filter // Must contain gateway, power, light and battery, but must not contain mediacontroller as the device manager should filter
// that away because it doesn't implement all the required states. // that away because it doesn't implement all the required states.
QCOMPARE(interfaces.count(), 3); QCOMPARE(interfaces.count(), 4);
QVERIFY(interfaces.contains("gateway")); QVERIFY(interfaces.contains("gateway"));
QVERIFY(interfaces.contains("battery")); QVERIFY(interfaces.contains("battery"));
QVERIFY(interfaces.contains("power"));
QVERIFY(interfaces.contains("light")); QVERIFY(interfaces.contains("light"));
QVERIFY(!interfaces.contains("mediacontroller")); QVERIFY(!interfaces.contains("mediacontroller"));
} }