mirror of https://github.com/nymea/nymea.git
make use of parent mechanism in mock device
parent
12ff672216
commit
661a75a988
|
|
@ -1370,6 +1370,7 @@ void DeviceManager::onAutoDevicesAppeared(const DeviceClassId &deviceClassId, co
|
|||
{
|
||||
DeviceClass deviceClass = findDeviceClass(deviceClassId);
|
||||
if (!deviceClass.isValid()) {
|
||||
qCWarning(dcDeviceManager()) << "Auto device appeared for an unknown DeviceClass. Ignoring...";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device)
|
|||
return DeviceManager::DeviceSetupStatusSuccess;
|
||||
} else if (device->deviceClassId() == mockChildDeviceClassId) {
|
||||
qCDebug(dcMockDevice) << "Setup Child mock device" << device->params();
|
||||
device->setParentId(DeviceId(device->params().paramValue(mockChildParentUuidParamTypeId).toString()));
|
||||
return DeviceManager::DeviceSetupStatusSuccess;
|
||||
} else if (device->deviceClassId() == mockInputTypeDeviceClassId) {
|
||||
qCDebug(dcMockDevice) << "Setup InputType mock device" << device->params();
|
||||
|
|
@ -303,14 +302,14 @@ DeviceManager::DeviceError DevicePluginMock::executeAction(Device *device, const
|
|||
}
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
} else if (device->deviceClassId() == mockParentDeviceClassId) {
|
||||
if (action.actionTypeId() == mockParentBoolValueParentActionTypeId) {
|
||||
device->setStateValue(mockParentBoolValueParentStateTypeId, action.param(mockParentBoolValueParentStateParamTypeId).value().toBool());
|
||||
if (action.actionTypeId() == mockParentBoolValueActionTypeId) {
|
||||
device->setStateValue(mockParentBoolValueStateTypeId, action.param(mockParentBoolValueStateParamTypeId).value().toBool());
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
} else if (device->deviceClassId() == mockChildDeviceClassId) {
|
||||
if (action.actionTypeId() == mockChildBoolValueParentActionTypeId) {
|
||||
device->setStateValue(mockChildBoolValueParentStateTypeId, action.param(mockChildBoolValueParentStateParamTypeId).value().toBool());
|
||||
if (action.actionTypeId() == mockChildBoolValueActionTypeId) {
|
||||
device->setStateValue(mockChildBoolValueStateTypeId, action.param(mockChildBoolValueStateParamTypeId).value().toBool());
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
|
|
@ -458,11 +457,7 @@ void DevicePluginMock::onDisplayPinPairingFinished()
|
|||
void DevicePluginMock::onChildDeviceDiscovered(const DeviceId &parentId)
|
||||
{
|
||||
qCDebug(dcMockDevice) << "Child device discovered for parent" << parentId.toString();
|
||||
DeviceDescriptor mockDescriptor(mockChildDeviceClassId, "Child Mock Device (Auto created)");
|
||||
ParamList params;
|
||||
params.append(Param(mockChildParentUuidParamTypeId, parentId));
|
||||
mockDescriptor.setParams(params);
|
||||
|
||||
DeviceDescriptor mockDescriptor(mockChildDeviceClassId, "Child Mock Device (Auto created)", "Child Mock Device (Auto created)", parentId);
|
||||
emit autoDevicesAppeared(mockChildDeviceClassId, QList<DeviceDescriptor>() << mockDescriptor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@
|
|||
"stateTypes": [
|
||||
{
|
||||
"id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0",
|
||||
"name": "boolValueParent",
|
||||
"name": "boolValue",
|
||||
"displayName": "bool value",
|
||||
"displayNameEvent": "bool value changed",
|
||||
"displayNameAction": "Set bool value",
|
||||
|
|
@ -545,23 +545,15 @@
|
|||
"name": "mockChild",
|
||||
"displayName": "Mock Device (Child)",
|
||||
"createMethods": ["auto"],
|
||||
"paramTypes": [],
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
],
|
||||
"paramTypes": [
|
||||
{
|
||||
"id": "104b5288-404e-42d3-bf38-e40682e75681",
|
||||
"name": "parentUuid",
|
||||
"displayName": "parent uuid",
|
||||
"type": "QUuid",
|
||||
"readOnly": true
|
||||
}
|
||||
],
|
||||
"stateTypes": [
|
||||
{
|
||||
"id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0",
|
||||
"name": "boolValueParent",
|
||||
"name": "boolValue",
|
||||
"displayName": "bool value",
|
||||
"displayNameEvent": "bool value changed",
|
||||
"displayNameAction": "Set bool value",
|
||||
|
|
|
|||
Loading…
Reference in New Issue