implement connectable interface in networkdetector

This commit is contained in:
Michael Zanetti 2018-03-13 18:07:19 +01:00
parent 8244dd439d
commit a54c075489
2 changed files with 6 additions and 4 deletions

View File

@ -141,9 +141,9 @@ void DevicePluginNetworkDetector::deviceReachableChanged(bool reachable)
{ {
DeviceMonitor *monitor = static_cast<DeviceMonitor*>(sender()); DeviceMonitor *monitor = static_cast<DeviceMonitor*>(sender());
Device *device = m_monitors.value(monitor); Device *device = m_monitors.value(monitor);
if (device->stateValue(networkDeviceInRangeStateTypeId).toBool() != reachable) { if (device->stateValue(networkDeviceConnectedStateTypeId).toBool() != reachable) {
qCDebug(dcNetworkDetector()) << "Device" << device->paramValue(networkDeviceMacAddressParamTypeId).toString() << "reachable changed" << reachable; qCDebug(dcNetworkDetector()) << "Device" << device->paramValue(networkDeviceMacAddressParamTypeId).toString() << "reachable changed" << reachable;
device->setStateValue(networkDeviceInRangeStateTypeId, reachable); device->setStateValue(networkDeviceConnectedStateTypeId, reachable);
} }
} }

View File

@ -17,6 +17,7 @@
"Device", "Device",
"Sensor" "Sensor"
], ],
"interfaces": ["connectable"],
"primaryStateTypeId": "cb43e1b5-4f61-4538-bfa2-c33055c542cf", "primaryStateTypeId": "cb43e1b5-4f61-4538-bfa2-c33055c542cf",
"createMethods": ["user", "discovery"], "createMethods": ["user", "discovery"],
"paramTypes": [ "paramTypes": [
@ -38,11 +39,12 @@
"stateTypes": [ "stateTypes": [
{ {
"id": "cb43e1b5-4f61-4538-bfa2-c33055c542cf", "id": "cb43e1b5-4f61-4538-bfa2-c33055c542cf",
"name": "inRange", "name": "connected",
"displayName": "Device in network", "displayName": "Device in network",
"displayNameEvent": "Device in network changed", "displayNameEvent": "Device in network changed",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false,
"cached": false
} }
] ]
} }