Rework battery interface

pull/402/head
Michael Zanetti 2021-03-09 23:56:05 +01:00
parent 96ae3cd01a
commit d46ef1c5fa
6 changed files with 27 additions and 16 deletions

View File

@ -4,6 +4,30 @@
"name": "batteryCritical",
"type": "bool",
"logged": true
},
{
"name": "batteryLevel",
"type": "int",
"minValue": 0,
"maxValue": 100,
"unit": "Percentage",
"optional": true,
"logged": true
},
{
"name": "pluggedIn",
"type": "bool",
"optional": true
},
{
"name": "charging",
"type": "bool",
"optional": true
},
{
"name": "discharging",
"type": "bool",
"optional": true
}
]
}

View File

@ -1,12 +0,0 @@
{
"extends": "battery",
"states": [
{
"name": "batteryLevel",
"type": "int",
"minValue": 0,
"maxValue": 100,
"unit": "Percentage"
}
]
}

View File

@ -24,7 +24,6 @@
<file>mediametadataprovider.json</file>
<file>mediaplayer.json</file>
<file>battery.json</file>
<file>batterylevel.json</file>
<file>button.json</file>
<file>multibutton.json</file>
<file>simplebutton.json</file>

View File

@ -30,7 +30,7 @@
"id": "753f0d32-0468-4d08-82ed-1964aab03298",
"name": "mock",
"displayName": "Mock Thing",
"interfaces": ["system", "light", "batterylevel", "wirelessconnectable", "update"],
"interfaces": ["system", "light", "battery", "wirelessconnectable", "update"],
"createMethods": ["user", "discovery"],
"browsable": true,
"discoveryParamTypes": [

View File

@ -327,7 +327,7 @@ void TestDevices::verifyInterfaces()
QVERIFY(!mockDevice.isEmpty());
QVariantList interfaces = mockDevice.value("interfaces").toList();
QVariantList expectedInterfaces = {"system", "light", "power", "batterylevel", "battery", "wirelessconnectable", "connectable", "update"};
QVariantList expectedInterfaces = {"system", "light", "power", "battery", "wirelessconnectable", "connectable", "update"};
qCDebug(dcTests()) << interfaces;
qCDebug(dcTests()) << expectedInterfaces;
QCOMPARE(interfaces, expectedInterfaces);

View File

@ -339,7 +339,7 @@ void TestIntegrations::verifyInterfaces()
QVERIFY(!mock.isEmpty());
QVariantList interfaces = mock.value("interfaces").toList();
QVariantList expectedInterfaces = {"system", "light", "power", "batterylevel", "battery", "wirelessconnectable", "connectable", "update"};
QVariantList expectedInterfaces = {"system", "light", "power", "battery", "wirelessconnectable", "connectable", "update"};
qCDebug(dcTests()) << interfaces;
qCDebug(dcTests()) << expectedInterfaces;
QCOMPARE(interfaces, expectedInterfaces);