From 2fbbaeda97126af1a307481d4753bf0d5e0cca4f Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 3 Mar 2020 15:08:22 +0100 Subject: [PATCH] More work --- libnymea-core/jsonrpc/actionhandler.cpp | 2 +- libnymea-core/jsonrpc/devicehandler.cpp | 39 +- libnymea-core/jsonrpc/devicehandler.h | 2 +- libnymea-core/jsonrpc/integrationshandler.cpp | 527 ++-- libnymea-core/jsonrpc/integrationshandler.h | 53 +- libnymea-core/libnymea-core.pro | 4 +- libnymea/integrations/pluginmetadata.cpp | 10 +- plugins/mock/devicepluginmock.cpp | 364 +-- plugins/mock/devicepluginmock.json | 42 +- plugins/mock/extern-plugininfo.h | 400 +-- plugins/mock/httpdaemon.cpp | 16 +- plugins/mock/plugininfo.h | 1332 +++++----- tests/auto/actions/testactions.cpp | 6 +- tests/auto/auto.pro | 1 + tests/auto/devices/testdevices.cpp | 395 ++- tests/auto/events/testevents.cpp | 4 +- tests/auto/integrations/integrations.pro | 5 + tests/auto/integrations/testintegrations.cpp | 2153 +++++++++++++++++ tests/auto/jsonrpc/testjsonrpc.cpp | 218 +- tests/auto/logging/testlogging.cpp | 37 +- tests/auto/rules/testrules.cpp | 132 +- tests/auto/states/teststates.cpp | 2 +- tests/auto/timemanager/testtimemanager.cpp | 12 +- tests/testlib/nymeatestbase.cpp | 17 +- tests/testlib/nymeatestbase.h | 7 +- .../plugininfocompiler.cpp | 20 +- 26 files changed, 4015 insertions(+), 1785 deletions(-) create mode 100644 tests/auto/integrations/integrations.pro create mode 100644 tests/auto/integrations/testintegrations.cpp diff --git a/libnymea-core/jsonrpc/actionhandler.cpp b/libnymea-core/jsonrpc/actionhandler.cpp index 7f56626c..21915436 100644 --- a/libnymea-core/jsonrpc/actionhandler.cpp +++ b/libnymea-core/jsonrpc/actionhandler.cpp @@ -110,7 +110,7 @@ JsonReply* ActionHandler::ExecuteAction(const QVariantMap ¶ms, const JsonCon ThingActionInfo *info = NymeaCore::instance()->executeAction(action); connect(info, &ThingActionInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + data.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); if (!info->displayMessage().isEmpty()) { data.insert("displayMessage", info->translatedDisplayMessage(locale)); } diff --git a/libnymea-core/jsonrpc/devicehandler.cpp b/libnymea-core/jsonrpc/devicehandler.cpp index 834c1cf6..c7d4a11e 100644 --- a/libnymea-core/jsonrpc/devicehandler.cpp +++ b/libnymea-core/jsonrpc/devicehandler.cpp @@ -75,6 +75,7 @@ DeviceHandler::DeviceHandler(QObject *parent) : registerObject(); registerObject(); registerObject(); + registerObject(); registerObject(); registerObject(); registerObject(); @@ -426,12 +427,16 @@ JsonReply *DeviceHandler::GetDiscoveredDevices(const QVariantMap ¶ms, const ThingDiscoveryInfo *info = NymeaCore::instance()->thingManager()->discoverThings(thingClassId, discoveryParams); connect(info, &ThingDiscoveryInfo::finished, reply, [this, reply, info, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); if (info->status() == Device::ThingErrorNoError) { QVariantList deviceDescriptorList; - foreach (const ThingDescriptor &deviceDescriptor, info->thingDescriptors()) { - deviceDescriptorList.append(pack(deviceDescriptor)); + foreach (const ThingDescriptor &thingDescriptor, info->thingDescriptors()) { + QVariantMap packedDescriptor = pack(thingDescriptor).toMap(); + if (packedDescriptor.contains("thingId")) { + packedDescriptor.insert("deviceId", packedDescriptor.value("thingId")); + } + deviceDescriptorList.append(packedDescriptor); } returns.insert("deviceDescriptors", deviceDescriptorList); } @@ -468,7 +473,7 @@ JsonReply *DeviceHandler::GetPluginConfiguration(const QVariantMap ¶ms) cons IntegrationPlugin *plugin = NymeaCore::instance()->thingManager()->plugins().findById(PluginId(params.value("pluginId").toString())); if (!plugin) { - returns.insert("deviceError", enumValueName(Device::ThingErrorPluginNotFound).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(Device::ThingErrorPluginNotFound).replace("Thing", "Device")); return createReply(returns); } @@ -477,7 +482,7 @@ JsonReply *DeviceHandler::GetPluginConfiguration(const QVariantMap ¶ms) cons paramVariantList.append(pack(param)); } returns.insert("configuration", paramVariantList); - returns.insert("deviceError", enumValueName(Device::ThingErrorNoError).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(Device::ThingErrorNoError).replace("Thing", "Device")); return createReply(returns); } @@ -487,7 +492,7 @@ JsonReply* DeviceHandler::SetPluginConfiguration(const QVariantMap ¶ms) PluginId pluginId = PluginId(params.value("pluginId").toString()); ParamList pluginParams = unpack(params.value("configuration")); Device::ThingError result = NymeaCore::instance()->thingManager()->setPluginConfig(pluginId, pluginParams); - returns.insert("deviceError",enumValueName(result).replace("ThingError", "DeviceError")); + returns.insert("deviceError",enumValueName(result).replace("Thing", "Device")); return createReply(returns); } @@ -509,7 +514,7 @@ JsonReply* DeviceHandler::AddConfiguredDevice(const QVariantMap ¶ms, const J } connect(info, &ThingSetupInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); if (!info->displayMessage().isEmpty()) { returns.insert("displayMessage", info->translatedDisplayMessage(locale)); @@ -547,7 +552,7 @@ JsonReply *DeviceHandler::PairDevice(const QVariantMap ¶ms, const JsonContex connect(info, &ThingPairingInfo::finished, jsonReply, [jsonReply, info, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); returns.insert("pairingTransactionId", info->transactionId().toString()); if (info->status() == Device::ThingErrorNoError) { @@ -583,7 +588,7 @@ JsonReply *DeviceHandler::ConfirmPairing(const QVariantMap ¶ms, const JsonCo connect(info, &ThingPairingInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + returns.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); if (!info->displayMessage().isEmpty()) { returns.insert("displayMessage", info->translatedDisplayMessage(locale)); } @@ -683,7 +688,7 @@ JsonReply* DeviceHandler::RemoveConfiguredDevice(const QVariantMap ¶ms) if (params.contains("removePolicy")) { RuleEngine::RemovePolicy removePolicy = params.value("removePolicy").toString() == "RemovePolicyCascade" ? RuleEngine::RemovePolicyCascade : RuleEngine::RemovePolicyUpdate; Device::ThingError status = NymeaCore::instance()->removeConfiguredThing(thingId, removePolicy); - returns.insert("deviceError", enumValueName(status)); + returns.insert("deviceError", enumValueName(status).replace("Thing", "Device")); return createReply(returns); } @@ -833,7 +838,7 @@ JsonReply *DeviceHandler::ExecuteAction(const QVariantMap ¶ms, const JsonCon ThingActionInfo *info = NymeaCore::instance()->executeAction(action); connect(info, &ThingActionInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + data.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); if (!info->displayMessage().isEmpty()) { data.insert("displayMessage", info->translatedDisplayMessage(locale)); } @@ -855,7 +860,7 @@ JsonReply *DeviceHandler::ExecuteBrowserItem(const QVariantMap ¶ms) BrowserActionInfo *info = NymeaCore::instance()->executeBrowserItem(action); connect(info, &BrowserActionInfo::finished, jsonReply, [info, jsonReply](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status()).replace("ThingError", "DeviceError")); + data.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); jsonReply->setData(data); jsonReply->finished(); }); @@ -876,7 +881,7 @@ JsonReply *DeviceHandler::ExecuteBrowserItemAction(const QVariantMap ¶ms) BrowserItemActionInfo *info = NymeaCore::instance()->executeBrowserItemAction(browserItemAction); connect(info, &BrowserItemActionInfo::finished, jsonReply, [info, jsonReply](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status())); + data.insert("deviceError", enumValueName(info->status()).replace("Thing", "Device")); jsonReply->setData(data); jsonReply->finished(); }); @@ -938,15 +943,19 @@ void DeviceHandler::deviceAddedNotification(Thing *thing) { QVariantMap params; QVariantMap deviceMap = pack(thing).toMap(); + // Patch in deviceClassId deviceMap.insert("deviceClassId", deviceMap.value("thingClassId")); params.insert("device", deviceMap); emit DeviceAdded(params); } -void DeviceHandler::deviceChangedNotification(Thing *device) +void DeviceHandler::deviceChangedNotification(Thing *thing) { QVariantMap params; - params.insert("device", pack(device)); + QVariantMap deviceMap = pack(thing).toMap(); + // Patch in deviceClassId + deviceMap.insert("deviceClassId", deviceMap.value("thingClassId")); + params.insert("device", deviceMap); emit DeviceChanged(params); } diff --git a/libnymea-core/jsonrpc/devicehandler.h b/libnymea-core/jsonrpc/devicehandler.h index 18a2f947..908f66f6 100644 --- a/libnymea-core/jsonrpc/devicehandler.h +++ b/libnymea-core/jsonrpc/devicehandler.h @@ -190,7 +190,7 @@ private slots: void deviceAddedNotification(Thing *thing); - void deviceChangedNotification(Thing *device); + void deviceChangedNotification(Thing *thing); void deviceSettingChangedNotification(const ThingId &thingId, const ParamTypeId ¶mTypeId, const QVariant &value); diff --git a/libnymea-core/jsonrpc/integrationshandler.cpp b/libnymea-core/jsonrpc/integrationshandler.cpp index 9b8f0536..778463f3 100644 --- a/libnymea-core/jsonrpc/integrationshandler.cpp +++ b/libnymea-core/jsonrpc/integrationshandler.cpp @@ -48,10 +48,9 @@ namespace nymeaserver { -/*! Constructs a new \l DeviceHandler with the given \a parent. */ -IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *parent) : +IntegrationsHandler::IntegrationsHandler(ThingManager *thingManager, QObject *parent) : JsonHandler(parent), - m_deviceManager(deviceManager) + m_thingManager(thingManager) { // Enums registerEnum(); @@ -79,8 +78,8 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p registerObject(); registerUncreatableObject(); - // Regsitering browseritem manually for now. Not sure how to deal with the - // polymorphism in int (e.g MediaBrowserItem) + // Registering browseritem manually for now. Not sure how to deal with the + // polymorphism in it (e.g MediaBrowserItem) QVariantMap browserItem; browserItem.insert("id", enumValueName(String)); browserItem.insert("displayName", enumValueName(String)); @@ -99,13 +98,14 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p QString description; QVariantMap returns; QVariantMap params; description = "Returns a list of supported Vendors."; returns.insert("vendors", objectRef()); - registerMethod("GetSupportedVendors", description, params, returns); + registerMethod("GetVendors", description, params, returns); params.clear(); returns.clear(); - description = "Returns a list of supported Device classes, optionally filtered by vendorId."; + description = "Returns a list of supported thing classes, optionally filtered by vendorId."; params.insert("o:vendorId", enumValueName(Uuid)); - returns.insert("deviceClasses", objectRef()); - registerMethod("GetSupportedDevices", description, params, returns); + returns.insert("thingError", enumRef()); + returns.insert("o:thingClasses", objectRef()); + registerMethod("GetThingClasses", description, params, returns); params.clear(); returns.clear(); description = "Returns a list of loaded plugins."; @@ -115,7 +115,7 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p params.clear(); returns.clear(); description = "Get a plugin's params."; params.insert("pluginId", enumValueName(Uuid)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:configuration", objectRef()); registerMethod("GetPluginConfiguration", description, params, returns); @@ -123,55 +123,56 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p description = "Set a plugin's params."; params.insert("pluginId", enumValueName(Uuid)); params.insert("configuration", objectRef()); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); registerMethod("SetPluginConfiguration", description, params, returns); params.clear(); returns.clear(); - description = "Add a configured device with a setupMethod of SetupMethodJustAdd. " - "For devices with a setupMethod different than SetupMethodJustAdd, use PairDevice. " - "Devices with CreateMethodJustAdd require all parameters to be supplied here. " - "Devices with CreateMethodDiscovery require the use of a deviceDescriptorId. For discovered " - "devices params are not required and will be taken from the DeviceDescriptor, however, they " - "may be overridden by supplying deviceParams."; + description = "Add a new thing to the system. " + "Only things with a setupMethod of SetupMethodJustAdd can be added this way. " + "For things with a setupMethod different than SetupMethodJustAdd, use PairThing. " + "Things with CreateMethodJustAdd require all parameters to be supplied here. " + "Things with CreateMethodDiscovery require the use of a thingDescriptorId. For discovered " + "things, params are not required and will be taken from the ThingDescriptor, however, they " + "may be overridden by supplying thingParams."; params.insert("thingClassId", enumValueName(Uuid)); params.insert("name", enumValueName(String)); - params.insert("o:deviceDescriptorId", enumValueName(Uuid)); - params.insert("o:deviceParams", objectRef()); - returns.insert("deviceError", enumRef()); - returns.insert("o:deviceId", enumValueName(Uuid)); + params.insert("o:thingDescriptorId", enumValueName(Uuid)); + params.insert("o:thingParams", objectRef()); + returns.insert("thingError", enumRef()); + returns.insert("o:thingId", enumValueName(Uuid)); returns.insert("o:displayMessage", enumValueName(String)); - registerMethod("AddConfiguredDevice", description, params, returns); + registerMethod("AddThing", description, params, returns); params.clear(); returns.clear(); - description = "Pair a device. " - "Use this to set up or reconfigure devices for DeviceClasses with a setupMethod different than SetupMethodJustAdd. " - "Depending on the CreateMethod and whether a new devices is set up or an existing one is reconfigured, different parameters " - "are required:\n" - "CreateMethodJustAdd takes the thingClassId and the parameters you want to have with that device.\n" - "CreateMethodDiscovery requires the use of a deviceDescriptorId, previously obtained with DiscoverDevices. Optionally, " - "parameters can be overridden with the give deviceParams.\n" - "If an existing device should be reconfigured, the deviceId of said device should be given additionally.\n" - "If success is true, the return values will contain a pairingTransactionId, a displayMessage and " - "the setupMethod. Depending on the setupMethod, the application should present the use an appropriate login mask, " - "that is, For SetupMethodDisplayPin the user should enter a pin that is displayed on the device, for SetupMethodEnterPin the " - "application should present the given PIN so the user can enter it on the device. For SetupMethodPushButton, the displayMessage " - "shall be presented to the user as informational hints to press a button on the device. For SetupMethodUserAndPassword a login " - "mask for a user and password login should be presented to the user. In case of SetupMethodOAuth, an OAuth URL will be returned " - "which shall be opened in a web view to allow the user logging in.\n" - "Once the login procedure has completed, the application shall proceed with ConfirmPairing, providing the results of the pairing " - "procedure."; - params.insert("o:ThingClassId", enumValueName(Uuid)); + description = "Pair a new thing. " + "Use this to set up or reconfigure things for ThingClasses with a setupMethod different than SetupMethodJustAdd. " + "Depending on the CreateMethod and whether a new thing is set up or an existing one is reconfigured, different parameters " + "are required:\n" + "CreateMethodJustAdd takes the thingClassId and the parameters you want to have with that thing.\n" + "CreateMethodDiscovery requires the use of a thingDescriptorId, previously obtained with DiscoverThings. Optionally, " + "parameters can be overridden with the give thingParams.\n" + "If an existing thing should be reconfigured, the thingId of said thing should be given additionally.\n" + "If success is true, the return values will contain a pairingTransactionId, a displayMessage and " + "the setupMethod. Depending on the setupMethod, the application should present the use an appropriate login mask, " + "that is, For SetupMethodDisplayPin the user should enter a pin that is displayed on the device or online service, for SetupMethodEnterPin the " + "application should present the given PIN so the user can enter it on the device or online service. For SetupMethodPushButton, the displayMessage " + "shall be presented to the user as informational hints to press a button on the device. For SetupMethodUserAndPassword a login " + "mask for a user and password login should be presented to the user. In case of SetupMethodOAuth, an OAuth URL will be returned " + "which shall be opened in a web view to allow the user logging in.\n" + "Once the login procedure has completed, the application shall proceed with ConfirmPairing, providing the results of the pairing " + "procedure."; + params.insert("o:thingClassId", enumValueName(Uuid)); params.insert("o:name", enumValueName(String)); - params.insert("o:deviceDescriptorId", enumValueName(Uuid)); - params.insert("o:deviceParams", objectRef()); - params.insert("o:deviceId", enumValueName(Uuid)); - returns.insert("deviceError", enumRef()); + params.insert("o:thingDescriptorId", enumValueName(Uuid)); + params.insert("o:thingParams", objectRef()); + params.insert("o:thingId", enumValueName(Uuid)); + returns.insert("thingError", enumRef()); returns.insert("o:setupMethod", enumRef()); returns.insert("o:pairingTransactionId", enumValueName(Uuid)); returns.insert("o:displayMessage", enumValueName(String)); returns.insert("o:oAuthUrl", enumValueName(String)); returns.insert("o:pin", enumValueName(String)); - registerMethod("PairDevice", description, params, returns); + registerMethod("PairThing", description, params, returns); params.clear(); returns.clear(); description = "Confirm an ongoing pairing. For SetupMethodUserAndPassword, provide the username in the \"username\" field " @@ -181,64 +182,63 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p params.insert("pairingTransactionId", enumValueName(Uuid)); params.insert("o:username", enumValueName(String)); params.insert("o:secret", enumValueName(String)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:displayMessage", enumValueName(String)); - returns.insert("o:deviceId", enumValueName(Uuid)); + returns.insert("o:thingId", enumValueName(Uuid)); registerMethod("ConfirmPairing", description, params, returns); - // FIXME: Add thingError!!! params.clear(); returns.clear(); - description = "Returns a list of configured devices, optionally filtered by deviceId."; - params.insert("o:deviceId", enumValueName(Uuid)); - returns.insert("devices", objectRef()); - registerMethod("GetConfiguredDevices", description, params, returns); + description = "Returns a list of configured things, optionally filtered by thingId."; + params.insert("o:thingId", enumValueName(Uuid)); + returns.insert("o:things", objectRef()); + returns.insert("thingError", enumRef()); + registerMethod("GetThings", description, params, returns); params.clear(); returns.clear(); - description = "Performs a device discovery and returns the results. This function may take a while to return. " - "Note that this method will include all the found devices, that is, including devices that may " - "already have been added. Those devices will have deviceId set to the device id of the already " - "added device. Such results may be used to reconfigure existing devices and might be filtered " - "in cases where only unknown devices are of interest."; + description = "Performs a thing discovery for things of the given thingClassId and returns the results. " + "This function may take a while to return. Note that this method will include all the found " + "things, that is, including things that may already have been added. Those things will have " + "thingId set to the id of the already added thing. Such results may be used to reconfigure " + "existing things and might be filtered in cases where only unknown things are of interest."; params.insert("thingClassId", enumValueName(Uuid)); params.insert("o:discoveryParams", objectRef()); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:displayMessage", enumValueName(String)); - returns.insert("o:deviceDescriptors", objectRef()); - registerMethod("GetDiscoveredDevices", description, params, returns); + returns.insert("o:thingDescriptors", objectRef()); + registerMethod("DiscoverThings", description, params, returns); params.clear(); returns.clear(); - description = "Reconfigure a device. This comes down to removing and recreating a device with new parameters " - "but keeping its device id the same (and with that keeping rules, tags etc). For devices with " - "create method CreateMethodDiscovery, a discovery (GetDiscoveredDevices) shall be performed first " - "and this method is to be called with a deviceDescriptorId of the re-discovered device instead of " - "the deviceId directly. Device parameters will be taken from the discovery, but can be overridden " - "individually here by providing them in the deviceParams parameter. Only writable parameters can " - "be changed."; - params.insert("o:deviceId", enumValueName(Uuid)); - params.insert("o:deviceDescriptorId", enumValueName(Uuid)); - params.insert("o:deviceParams", objectRef()); - returns.insert("deviceError", enumRef()); + description = "Reconfigure a thing. This comes down to removing and recreating a thing with new parameters " + "but keeping its thing id the same (and with that keeping rules, tags etc). For things with " + "create method CreateMethodDiscovery, a discovery (DiscoverThings) shall be performed first " + "and this method is to be called with a thingDescriptorId of the re-discovered thing instead of " + "the thingId directly. Thing parameters will be taken from the discovery, but can be overridden " + "individually here by providing them in the thingParams parameter. Only writable parameters can " + "be changed."; + params.insert("o:thingId", enumValueName(Uuid)); + params.insert("o:thingDescriptorId", enumValueName(Uuid)); + params.insert("o:thingParams", objectRef()); + returns.insert("thingError", enumRef()); returns.insert("o:displayMessage", enumValueName(String)); - registerMethod("ReconfigureDevice", description, params, returns); + registerMethod("ReconfigureThing", description, params, returns); params.clear(); returns.clear(); - description = "Edit the name of a device. This method does not change the " - "configuration of the device."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Edit the name of a thing."; + params.insert("thingId", enumValueName(Uuid)); params.insert("name", enumValueName(String)); - returns.insert("deviceError", enumRef()); - registerMethod("EditDevice", description, params, returns); + returns.insert("thingError", enumRef()); + registerMethod("EditThing", description, params, returns); params.clear(); returns.clear(); - description = "Change the settings of a device."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Change the settings of a thing."; + params.insert("thingId", enumValueName(Uuid)); params.insert("settings", objectRef()); - returns.insert("deviceError", enumRef()); - registerMethod("SetDeviceSettings", description, params, returns); + returns.insert("thingError", enumRef()); + registerMethod("SetThingSettings", description, params, returns); params.clear(); returns.clear(); - description = "Remove a device from the system."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Remove a thing from the system."; + params.insert("thingId", enumValueName(Uuid)); params.insert("o:removePolicy", enumRef()); QVariantMap policy; policy.insert("ruleId", enumValueName(Uuid)); @@ -246,9 +246,9 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p QVariantList removePolicyList; removePolicyList.append(policy); params.insert("o:removePolicyList", removePolicyList); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:ruleIds", QVariantList() << enumValueName(Uuid)); - registerMethod("RemoveConfiguredDevice", description, params, returns); + registerMethod("RemoveThing", description, params, returns); params.clear(); returns.clear(); description = "Get event types for a specified thingClassId."; @@ -269,90 +269,95 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p registerMethod("GetStateTypes", description, params, returns); params.clear(); returns.clear(); - description = "Get the value of the given device and the given stateType"; - params.insert("deviceId", enumValueName(Uuid)); + description = "Get the value of the given thing and the given stateType"; + params.insert("thingId", enumValueName(Uuid)); params.insert("stateTypeId", enumValueName(Uuid)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:value", enumValueName(Variant)); registerMethod("GetStateValue", description, params, returns); params.clear(); returns.clear(); - description = "Get all the state values of the given device."; - params.insert("deviceId", enumValueName(Uuid)); - returns.insert("deviceError", enumRef()); + description = "Get all the state values of the given thing."; + params.insert("thingId", enumValueName(Uuid)); + returns.insert("thingError", enumRef()); returns.insert("o:values", objectRef()); registerMethod("GetStateValues", description, params, returns); params.clear(); returns.clear(); - description = "Browse a device. If a DeviceClass indicates a device is browsable, this method will return the BrowserItems. If no parameter besides the deviceId is used, the root node of this device will be returned. Any returned item which is browsable can be passed as node. Results will be children of the given node."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Browse a thing. " + "If a ThingClass indicates a thing is browsable, this method will return the BrowserItems. If no " + "parameter besides the thingId is used, the root node of this thingwill be returned. Any " + "returned item which is browsable can be passed as node. Results will be children of the given node."; + params.insert("thingId", enumValueName(Uuid)); params.insert("o:itemId", enumValueName(String)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("items", QVariantList() << objectRef("BrowserItem")); - registerMethod("BrowseDevice", description, params, returns); + registerMethod("BrowseThing", description, params, returns); params.clear(); returns.clear(); - description = "Get a single item from the browser. This won't give any more info on an item than a regular browseDevice call, but it allows to fetch details of an item if only the ID is known."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Get a single item from the browser. " + "This won't give any more info on an item than a regular BrowseThing call, but it allows to fetch " + "details of an item if only the ID is known."; + params.insert("thingId", enumValueName(Uuid)); params.insert("o:itemId", enumValueName(String)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:item", objectRef("BrowserItem")); registerMethod("GetBrowserItem", description, params, returns); params.clear(); returns.clear(); description = "Execute a single action."; params.insert("actionTypeId", enumValueName(Uuid)); - params.insert("deviceId", enumValueName(Uuid)); + params.insert("thingId", enumValueName(Uuid)); params.insert("o:params", objectRef()); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); returns.insert("o:displayMessage", enumValueName(String)); registerMethod("ExecuteAction", description, params, returns); params.clear(); returns.clear(); - description = "Execute the item identified by itemId on the given device."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Execute the item identified by itemId on the given thing."; + params.insert("thingId", enumValueName(Uuid)); params.insert("itemId", enumValueName(String)); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); registerMethod("ExecuteBrowserItem", description, params, returns); params.clear(); returns.clear(); - description = "Execute the action for the browser item identified by actionTypeId and the itemId on the given device."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Execute the action for the browser item identified by actionTypeId and the itemId on the given thing."; + params.insert("thingId", enumValueName(Uuid)); params.insert("itemId", enumValueName(String)); params.insert("actionTypeId", enumValueName(Uuid)); params.insert("o:params", objectRef()); - returns.insert("deviceError", enumRef()); + returns.insert("thingError", enumRef()); registerMethod("ExecuteBrowserItemAction", description, params, returns); // Notifications params.clear(); returns.clear(); - description = "Emitted whenever a State of a device changes."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Emitted whenever a state of a thing changes."; + params.insert("thingId", enumValueName(Uuid)); params.insert("stateTypeId", enumValueName(Uuid)); params.insert("value", enumValueName(Variant)); registerNotification("StateChanged", description, params); params.clear(); returns.clear(); - description = "Emitted whenever a Device was removed."; - params.insert("deviceId", enumValueName(Uuid)); - registerNotification("DeviceRemoved", description, params); + description = "Emitted whenever a thing was removed."; + params.insert("thingId", enumValueName(Uuid)); + registerNotification("ThingRemoved", description, params); params.clear(); returns.clear(); - description = "Emitted whenever a Device was added."; - params.insert("device", objectRef()); - registerNotification("DeviceAdded", description, params); + description = "Emitted whenever a thing was added."; + params.insert("thing", objectRef()); + registerNotification("ThingAdded", description, params); params.clear(); returns.clear(); - description = "Emitted whenever the params or name of a Device are changed (by EditDevice or ReconfigureDevice)."; - params.insert("device", objectRef()); - registerNotification("DeviceChanged", description, params); + description = "Emitted whenever the params or name of a thing are changed (by EditThing or ReconfigureThing)."; + params.insert("thing", objectRef()); + registerNotification("ThingChanged", description, params); params.clear(); returns.clear(); - description = "Emitted whenever the setting of a Device is changed."; - params.insert("deviceId", enumValueName(Uuid)); + description = "Emitted whenever the setting of a thing is changed."; + params.insert("thingId", enumValueName(Uuid)); params.insert("paramTypeId", enumValueName(Uuid)); params.insert("value", enumValueName(Variant)); - registerNotification("DeviceSettingChanged", description, params); + registerNotification("ThingSettingChanged", description, params); params.clear(); returns.clear(); description = "Emitted whenever a plugin's configuration is changed."; @@ -373,24 +378,22 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *deviceManager, QObject *p connect(NymeaCore::instance(), &NymeaCore::pluginConfigChanged, this, &IntegrationsHandler::pluginConfigChanged); connect(NymeaCore::instance(), &NymeaCore::thingStateChanged, this, &IntegrationsHandler::thingStateChanged); connect(NymeaCore::instance(), &NymeaCore::thingRemoved, this, &IntegrationsHandler::thingRemovedNotification); - connect(NymeaCore::instance(), &NymeaCore::thingAdded, this, &IntegrationsHandler::deviceAddedNotification); - connect(NymeaCore::instance(), &NymeaCore::thingChanged, this, &IntegrationsHandler::deviceChangedNotification); - connect(NymeaCore::instance(), &NymeaCore::thingSettingChanged, this, &IntegrationsHandler::deviceSettingChangedNotification); + connect(NymeaCore::instance(), &NymeaCore::thingAdded, this, &IntegrationsHandler::thingAddedNotification); + connect(NymeaCore::instance(), &NymeaCore::thingChanged, this, &IntegrationsHandler::thingChangedNotification); + connect(NymeaCore::instance(), &NymeaCore::thingSettingChanged, this, &IntegrationsHandler::thingSettingChangedNotification); } -/*! Returns the name of the \l{IntegrationsHandler}. In this case \b Devices.*/ QString IntegrationsHandler::name() const { return "Integrations"; } -JsonReply* IntegrationsHandler::GetSupportedVendors(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetVendors(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - + Q_UNUSED(params) QVariantList vendors; foreach (const Vendor &vendor, NymeaCore::instance()->thingManager()->supportedVendors()) { - Vendor translatedVendor = NymeaCore::instance()->thingManager()->translateVendor(vendor, locale); + Vendor translatedVendor = NymeaCore::instance()->thingManager()->translateVendor(vendor, context.locale()); vendors.append(pack(translatedVendor)); } @@ -399,42 +402,54 @@ JsonReply* IntegrationsHandler::GetSupportedVendors(const QVariantMap ¶ms) c return createReply(returns); } -JsonReply* IntegrationsHandler::GetSupportedDevices(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetThingClasses(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - VendorId vendorId = VendorId(params.value("vendorId").toString()); QVariantMap returns; - QVariantList deviceClasses; - foreach (const ThingClass &deviceClass, NymeaCore::instance()->thingManager()->supportedThings(vendorId)) { - ThingClass translatedDeviceClass = NymeaCore::instance()->thingManager()->translateThingClass(deviceClass, locale); - deviceClasses.append(pack(translatedDeviceClass)); + QVariantList thingClasses; + + if (params.contains("vendorId")) { + VendorId vendorId = VendorId(params.value("vendorId").toString()); + if (m_thingManager->supportedVendors().findById(vendorId).id().isNull()) { + qCWarning(dcThingManager()) << "No such vendor:" << vendorId; + return createReply(statusToReply(Thing::ThingErrorVendorNotFound)); + } + foreach (const ThingClass &thingClass, NymeaCore::instance()->thingManager()->supportedThings(vendorId)) { + ThingClass translatedThingClass = NymeaCore::instance()->thingManager()->translateThingClass(thingClass, context.locale()); + thingClasses.append(pack(translatedThingClass)); + } + } else { + foreach (const ThingClass &thingClass, NymeaCore::instance()->thingManager()->supportedThings()) { + ThingClass translatedThingClass = NymeaCore::instance()->thingManager()->translateThingClass(thingClass, context.locale()); + thingClasses.append(pack(translatedThingClass)); + } } - returns.insert("deviceClasses", deviceClasses); + returns.insert("thingError", enumValueName(Thing::ThingErrorNoError)); + returns.insert("thingClasses", thingClasses); return createReply(returns); } -JsonReply *IntegrationsHandler::GetDiscoveredDevices(const QVariantMap ¶ms) const +JsonReply *IntegrationsHandler::DiscoverThings(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); + QLocale locale = context.locale(); QVariantMap returns; ThingClassId thingClassId = ThingClassId(params.value("thingClassId").toString()); ParamList discoveryParams = unpack(params.value("discoveryParams")); - JsonReply *reply = createAsyncReply("GetDiscoveredDevices"); + JsonReply *reply = createAsyncReply("DiscoverThings"); ThingDiscoveryInfo *info = NymeaCore::instance()->thingManager()->discoverThings(thingClassId, discoveryParams); connect(info, &ThingDiscoveryInfo::finished, reply, [this, reply, info, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status())); + returns.insert("thingError", enumValueName(info->status())); if (info->status() == Thing::ThingErrorNoError) { - QVariantList deviceDescriptorList; - foreach (const ThingDescriptor &deviceDescriptor, info->thingDescriptors()) { - deviceDescriptorList.append(pack(deviceDescriptor)); + QVariantList thingDescriptorList; + foreach (const ThingDescriptor &thingDescriptor, info->thingDescriptors()) { + thingDescriptorList.append(pack(thingDescriptor)); } - returns.insert("deviceDescriptors", deviceDescriptorList); + returns.insert("thingDescriptors", thingDescriptorList); } if (!info->displayMessage().isEmpty()) { @@ -448,14 +463,13 @@ JsonReply *IntegrationsHandler::GetDiscoveredDevices(const QVariantMap ¶ms) return reply; } -JsonReply* IntegrationsHandler::GetPlugins(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetPlugins(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - + Q_UNUSED(params) QVariantList plugins; foreach (IntegrationPlugin* plugin, NymeaCore::instance()->thingManager()->plugins()) { QVariantMap packedPlugin = pack(*plugin).toMap(); - packedPlugin["displayName"] = NymeaCore::instance()->thingManager()->translate(plugin->pluginId(), plugin->pluginDisplayName(), locale); + packedPlugin["displayName"] = NymeaCore::instance()->thingManager()->translate(plugin->pluginId(), plugin->pluginDisplayName(), context.locale()); plugins.append(packedPlugin); } @@ -470,7 +484,7 @@ JsonReply *IntegrationsHandler::GetPluginConfiguration(const QVariantMap ¶ms IntegrationPlugin *plugin = NymeaCore::instance()->thingManager()->plugins().findById(PluginId(params.value("pluginId").toString())); if (!plugin) { - returns.insert("deviceError", enumValueName(Thing::ThingErrorPluginNotFound)); + returns.insert("thingError", enumValueName(Thing::ThingErrorPluginNotFound)); return createReply(returns); } @@ -479,7 +493,7 @@ JsonReply *IntegrationsHandler::GetPluginConfiguration(const QVariantMap ¶ms paramVariantList.append(pack(param)); } returns.insert("configuration", paramVariantList); - returns.insert("deviceError", enumValueName(Thing::ThingErrorNoError)); + returns.insert("thingError", enumValueName(Thing::ThingErrorNoError)); return createReply(returns); } @@ -489,36 +503,36 @@ JsonReply* IntegrationsHandler::SetPluginConfiguration(const QVariantMap ¶ms PluginId pluginId = PluginId(params.value("pluginId").toString()); ParamList pluginParams = unpack(params.value("configuration")); Thing::ThingError result = NymeaCore::instance()->thingManager()->setPluginConfig(pluginId, pluginParams); - returns.insert("deviceError",enumValueName(result)); + returns.insert("thingError",enumValueName(result)); return createReply(returns); } -JsonReply* IntegrationsHandler::AddConfiguredDevice(const QVariantMap ¶ms) +JsonReply* IntegrationsHandler::AddThing(const QVariantMap ¶ms, const JsonContext &context) { ThingClassId ThingClassId(params.value("thingClassId").toString()); - QString deviceName = params.value("name").toString(); - ParamList deviceParams = unpack(params.value("deviceParams")); - ThingDescriptorId deviceDescriptorId(params.value("deviceDescriptorId").toString()); - QLocale locale = params.value("locale").toLocale(); + QString thingName = params.value("name").toString(); + ParamList thingParams = unpack(params.value("thingParams")); + ThingDescriptorId thingDescriptorId(params.value("thingDescriptorId").toString()); + QLocale locale = context.locale(); - JsonReply *jsonReply = createAsyncReply("AddConfiguredDevice"); + JsonReply *jsonReply = createAsyncReply("AddThing"); ThingSetupInfo *info; - if (deviceDescriptorId.isNull()) { - info = NymeaCore::instance()->thingManager()->addConfiguredThing(ThingClassId, deviceParams, deviceName); + if (thingDescriptorId.isNull()) { + info = NymeaCore::instance()->thingManager()->addConfiguredThing(ThingClassId, thingParams, thingName); } else { - info = NymeaCore::instance()->thingManager()->addConfiguredThing(deviceDescriptorId, deviceParams, deviceName); + info = NymeaCore::instance()->thingManager()->addConfiguredThing(thingDescriptorId, thingParams, thingName); } connect(info, &ThingSetupInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status())); + returns.insert("thingError", enumValueName(info->status())); if (!info->displayMessage().isEmpty()) { returns.insert("displayMessage", info->translatedDisplayMessage(locale)); } if(info->status() == Thing::ThingErrorNoError) { - returns.insert("deviceId", info->thing()->id()); + returns.insert("thingId", info->thing()->id()); } jsonReply->setData(returns); jsonReply->finished(); @@ -527,29 +541,29 @@ JsonReply* IntegrationsHandler::AddConfiguredDevice(const QVariantMap ¶ms) return jsonReply; } -JsonReply *IntegrationsHandler::PairDevice(const QVariantMap ¶ms) +JsonReply *IntegrationsHandler::PairThing(const QVariantMap ¶ms, const JsonContext &context) { - QString deviceName = params.value("name").toString(); - ParamList deviceParams = unpack(params.value("deviceParams")); - QLocale locale = params.value("locale").toLocale(); + QString thingName = params.value("name").toString(); + ParamList thingParams = unpack(params.value("thingParams")); + QLocale locale = context.locale(); ThingPairingInfo *info; - if (params.contains("deviceDescriptorId")) { - ThingDescriptorId deviceDescriptorId = ThingDescriptorId(params.value("deviceDescriptorId").toString()); - info = NymeaCore::instance()->thingManager()->pairThing(deviceDescriptorId, deviceParams, deviceName); - } else if (params.contains("deviceId")) { - ThingId deviceId = ThingId(params.value("deviceId").toString()); - info = NymeaCore::instance()->thingManager()->pairThing(deviceId, deviceParams, deviceName); + if (params.contains("thingDescriptorId")) { + ThingDescriptorId thingDescriptorId = ThingDescriptorId(params.value("thingDescriptorId").toString()); + info = NymeaCore::instance()->thingManager()->pairThing(thingDescriptorId, thingParams, thingName); + } else if (params.contains("thingId")) { + ThingId thingId = ThingId(params.value("thingId").toString()); + info = NymeaCore::instance()->thingManager()->pairThing(thingId, thingParams, thingName); } else { ThingClassId thingClassId(params.value("thingClassId").toString()); - info = NymeaCore::instance()->thingManager()->pairThing(thingClassId, deviceParams, deviceName); + info = NymeaCore::instance()->thingManager()->pairThing(thingClassId, thingParams, thingName); } - JsonReply *jsonReply = createAsyncReply("PairDevice"); + JsonReply *jsonReply = createAsyncReply("PairThing"); connect(info, &ThingPairingInfo::finished, jsonReply, [jsonReply, info, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status())); + returns.insert("thingError", enumValueName(info->status())); returns.insert("pairingTransactionId", info->transactionId().toString()); if (info->status() == Thing::ThingErrorNoError) { @@ -585,12 +599,12 @@ JsonReply *IntegrationsHandler::ConfirmPairing(const QVariantMap ¶ms) connect(info, &ThingPairingInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status())); + returns.insert("thingError", enumValueName(info->status())); if (!info->displayMessage().isEmpty()) { returns.insert("displayMessage", info->translatedDisplayMessage(locale)); } if (info->status() == Thing::ThingErrorNoError) { - returns.insert("deviceId", info->thingId().toString()); + returns.insert("thingId", info->thingId().toString()); } jsonReply->setData(returns); jsonReply->finished(); @@ -599,52 +613,63 @@ JsonReply *IntegrationsHandler::ConfirmPairing(const QVariantMap ¶ms) return jsonReply; } -JsonReply* IntegrationsHandler::GetConfiguredDevices(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetThings(const QVariantMap ¶ms, const JsonContext &context) const { QVariantMap returns; - QVariantList configuredDeviceList; - if (params.contains("deviceId")) { - Thing *device = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("deviceId").toString())); - if (!device) { - returns.insert("deviceError", enumValueName(Thing::ThingErrorThingNotFound)); + QVariantList things; + if (params.contains("thingId")) { + Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("thingId").toString())); + if (!thing) { + returns.insert("thingError", enumValueName(Thing::ThingErrorThingNotFound)); return createReply(returns); } else { - configuredDeviceList.append(pack(device)); + QVariantMap packedThing = pack(thing).toMap(); + QString translatedSetupStatus = NymeaCore::instance()->thingManager()->translate(thing->pluginId(), thing->setupDisplayMessage(), context.locale()); + if (!translatedSetupStatus.isEmpty()) { + packedThing["setupDisplayMessage"] = translatedSetupStatus; + } + things.append(packedThing); } } else { - foreach (Thing *device, NymeaCore::instance()->thingManager()->configuredThings()) { - configuredDeviceList.append(pack(device)); + foreach (Thing *thing, NymeaCore::instance()->thingManager()->configuredThings()) { + QVariantMap packedThing = pack(thing).toMap(); + QString translatedSetupStatus = NymeaCore::instance()->thingManager()->translate(thing->pluginId(), thing->setupDisplayMessage(), context.locale()); + if (!translatedSetupStatus.isEmpty()) { + packedThing["setupDisplayMessage"] = translatedSetupStatus; + } + things.append(packedThing); } } - returns.insert("devices", configuredDeviceList); + returns.insert("thingError", enumValueName(Thing::ThingErrorNoError)); + returns.insert("things", things); return createReply(returns); } -JsonReply *IntegrationsHandler::ReconfigureDevice(const QVariantMap ¶ms) +JsonReply *IntegrationsHandler::ReconfigureThing(const QVariantMap ¶ms, const JsonContext &context) { - ThingId thingId = ThingId(params.value("deviceId").toString()); - ParamList deviceParams = unpack(params.value("deviceParams")); - ThingDescriptorId deviceDescriptorId(params.value("deviceDescriptorId").toString()); - QLocale locale = params.value("locale").toLocale(); + ThingId thingId = ThingId(params.value("thingId").toString()); + ParamList thingParams = unpack(params.value("thingParams")); + ThingDescriptorId thingDescriptorId(params.value("thingDescriptorId").toString()); + QLocale locale = context.locale(); - JsonReply *jsonReply = createAsyncReply("ReconfigureDevice"); + JsonReply *jsonReply = createAsyncReply("ReconfigureThing"); ThingSetupInfo *info; - if (!deviceDescriptorId.isNull()) { - info = NymeaCore::instance()->thingManager()->reconfigureThing(deviceDescriptorId, deviceParams); + if (!thingDescriptorId.isNull()) { + info = NymeaCore::instance()->thingManager()->reconfigureThing(thingDescriptorId, thingParams); } else if (!thingId.isNull()){ - info = NymeaCore::instance()->thingManager()->reconfigureThing(thingId, deviceParams); + info = NymeaCore::instance()->thingManager()->reconfigureThing(thingId, thingParams); } else { - qCWarning(dcJsonRpc()) << "Either deviceId or deviceDescriptorId are required"; + qCWarning(dcJsonRpc()) << "Either thingId or thingDescriptorId are required"; QVariantMap ret; - ret.insert("deviceError", enumValueName(Thing::ThingErrorMissingParameter)); + ret.insert("thingError", enumValueName(Thing::ThingErrorMissingParameter)); return createReply(ret); } connect(info, &ThingSetupInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap returns; - returns.insert("deviceError", enumValueName(info->status())); + returns.insert("thingError", enumValueName(info->status())); returns.insert("displayMessage", info->translatedDisplayMessage(locale)); jsonReply->setData(returns); jsonReply->finished(); @@ -654,28 +679,28 @@ JsonReply *IntegrationsHandler::ReconfigureDevice(const QVariantMap ¶ms) return jsonReply; } -JsonReply *IntegrationsHandler::EditDevice(const QVariantMap ¶ms) +JsonReply *IntegrationsHandler::EditThing(const QVariantMap ¶ms) { - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); QString name = params.value("name").toString(); - qCDebug(dcJsonRpc()) << "Edit device" << thingId << name; + qCDebug(dcJsonRpc()) << "Edit thing" << thingId << name; Thing::ThingError status = NymeaCore::instance()->thingManager()->editThing(thingId, name); return createReply(statusToReply(status)); } -JsonReply* IntegrationsHandler::RemoveConfiguredDevice(const QVariantMap ¶ms) +JsonReply* IntegrationsHandler::RemoveThing(const QVariantMap ¶ms) { QVariantMap returns; - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); // global removePolicy has priority if (params.contains("removePolicy")) { RuleEngine::RemovePolicy removePolicy = params.value("removePolicy").toString() == "RemovePolicyCascade" ? RuleEngine::RemovePolicyCascade : RuleEngine::RemovePolicyUpdate; Thing::ThingError status = NymeaCore::instance()->removeConfiguredThing(thingId, removePolicy); - returns.insert("deviceError", enumValueName(status)); + returns.insert("thingError", enumValueName(status)); return createReply(returns); } @@ -687,7 +712,7 @@ JsonReply* IntegrationsHandler::RemoveConfiguredDevice(const QVariantMap ¶ms } QPair > status = NymeaCore::instance()->removeConfiguredThing(thingId, removePolicyList); - returns.insert("deviceError", enumValueName(status.first)); + returns.insert("thingError", enumValueName(status.first)); if (!status.second.isEmpty()) { QVariantList ruleIdList; @@ -700,53 +725,47 @@ JsonReply* IntegrationsHandler::RemoveConfiguredDevice(const QVariantMap ¶ms return createReply(returns); } -JsonReply *IntegrationsHandler::SetDeviceSettings(const QVariantMap ¶ms) +JsonReply *IntegrationsHandler::SetThingSettings(const QVariantMap ¶ms) { - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); ParamList settings = unpack(params.value("settings")); Thing::ThingError status = NymeaCore::instance()->thingManager()->setThingSettings(thingId, settings); return createReply(statusToReply(status)); } -JsonReply* IntegrationsHandler::GetEventTypes(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetEventTypes(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - - ThingClass deviceClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); - ThingClass translatedDeviceClass = NymeaCore::instance()->thingManager()->translateThingClass(deviceClass, locale); + ThingClass thingClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); + ThingClass translatedThingClass = NymeaCore::instance()->thingManager()->translateThingClass(thingClass, context.locale()); QVariantMap returns; - returns.insert("eventTypes", pack(translatedDeviceClass.eventTypes())); + returns.insert("eventTypes", pack(translatedThingClass.eventTypes())); return createReply(returns); } -JsonReply* IntegrationsHandler::GetActionTypes(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetActionTypes(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - - ThingClass deviceClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); - ThingClass translatedDeviceClass = NymeaCore::instance()->thingManager()->translateThingClass(deviceClass, locale); + ThingClass thingClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); + ThingClass translatedThingClass = NymeaCore::instance()->thingManager()->translateThingClass(thingClass, context.locale()); QVariantMap returns; - returns.insert("actionTypes", pack(translatedDeviceClass.actionTypes())); + returns.insert("actionTypes", pack(translatedThingClass.actionTypes())); return createReply(returns); } -JsonReply* IntegrationsHandler::GetStateTypes(const QVariantMap ¶ms) const +JsonReply* IntegrationsHandler::GetStateTypes(const QVariantMap ¶ms, const JsonContext &context) const { - QLocale locale = params.value("locale").toLocale(); - - ThingClass deviceClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); - ThingClass translatedDeviceClass = NymeaCore::instance()->thingManager()->translateThingClass(deviceClass, locale); + ThingClass thingClass = NymeaCore::instance()->thingManager()->findThingClass(ThingClassId(params.value("thingClassId").toString())); + ThingClass translatedThingClass = NymeaCore::instance()->thingManager()->translateThingClass(thingClass, context.locale()); QVariantMap returns; - returns.insert("stateTypes", pack(translatedDeviceClass.stateTypes())); + returns.insert("stateTypes", pack(translatedThingClass.stateTypes())); return createReply(returns); } JsonReply* IntegrationsHandler::GetStateValue(const QVariantMap ¶ms) const { - Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("deviceId").toString())); + Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("thingId").toString())); if (!thing) { return createReply(statusToReply(Thing::ThingErrorThingNotFound)); } @@ -762,7 +781,7 @@ JsonReply* IntegrationsHandler::GetStateValue(const QVariantMap ¶ms) const JsonReply *IntegrationsHandler::GetStateValues(const QVariantMap ¶ms) const { - Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("deviceId").toString())); + Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(ThingId(params.value("thingId").toString())); if (!thing) { return createReply(statusToReply(Thing::ThingErrorThingNotFound)); } @@ -772,14 +791,14 @@ JsonReply *IntegrationsHandler::GetStateValues(const QVariantMap ¶ms) const return createReply(returns); } -JsonReply *IntegrationsHandler::BrowseDevice(const QVariantMap ¶ms) const +JsonReply *IntegrationsHandler::BrowseThing(const QVariantMap ¶ms, const JsonContext &context) const { - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); QString itemId = params.value("itemId").toString(); - JsonReply *jsonReply = createAsyncReply("BrowseDevice"); + JsonReply *jsonReply = createAsyncReply("BrowseThing"); - BrowseResult *result = NymeaCore::instance()->thingManager()->browseThing(thingId, itemId, params.value("locale").toLocale()); + BrowseResult *result = NymeaCore::instance()->thingManager()->browseThing(thingId, itemId, context.locale()); connect(result, &BrowseResult::finished, jsonReply, [this, jsonReply, result](){ QVariantMap returns = statusToReply(result->status()); @@ -795,15 +814,15 @@ JsonReply *IntegrationsHandler::BrowseDevice(const QVariantMap ¶ms) const return jsonReply; } -JsonReply *IntegrationsHandler::GetBrowserItem(const QVariantMap ¶ms) const +JsonReply *IntegrationsHandler::GetBrowserItem(const QVariantMap ¶ms, const JsonContext &context) const { QVariantMap returns; - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); QString itemId = params.value("itemId").toString(); JsonReply *jsonReply = createAsyncReply("GetBrowserItem"); - BrowserItemResult *result = NymeaCore::instance()->thingManager()->browserItemDetails(thingId, itemId, params.value("locale").toLocale()); + BrowserItemResult *result = NymeaCore::instance()->thingManager()->browserItemDetails(thingId, itemId, context.locale()); connect(result, &BrowserItemResult::finished, jsonReply, [this, jsonReply, result](){ QVariantMap params = statusToReply(result->status()); if (result->status() == Thing::ThingErrorNoError) { @@ -816,12 +835,12 @@ JsonReply *IntegrationsHandler::GetBrowserItem(const QVariantMap ¶ms) const return jsonReply; } -JsonReply *IntegrationsHandler::ExecuteAction(const QVariantMap ¶ms) +JsonReply *IntegrationsHandler::ExecuteAction(const QVariantMap ¶ms, const JsonContext &context) { - ThingId thingId(params.value("deviceId").toString()); + ThingId thingId(params.value("thingId").toString()); ActionTypeId actionTypeId(params.value("actionTypeId").toString()); ParamList actionParams = unpack(params.value("params")); - QLocale locale = params.value("locale").toLocale(); + QLocale locale = context.locale(); Action action(actionTypeId, thingId); action.setParams(actionParams); @@ -831,7 +850,7 @@ JsonReply *IntegrationsHandler::ExecuteAction(const QVariantMap ¶ms) ThingActionInfo *info = NymeaCore::instance()->executeAction(action); connect(info, &ThingActionInfo::finished, jsonReply, [info, jsonReply, locale](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status())); + data.insert("thingError", enumValueName(info->status())); if (!info->displayMessage().isEmpty()) { data.insert("displayMessage", info->translatedDisplayMessage(locale)); } @@ -844,7 +863,7 @@ JsonReply *IntegrationsHandler::ExecuteAction(const QVariantMap ¶ms) JsonReply *IntegrationsHandler::ExecuteBrowserItem(const QVariantMap ¶ms) { - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); QString itemId = params.value("itemId").toString(); BrowserAction action(thingId, itemId); @@ -853,7 +872,7 @@ JsonReply *IntegrationsHandler::ExecuteBrowserItem(const QVariantMap ¶ms) BrowserActionInfo *info = NymeaCore::instance()->executeBrowserItem(action); connect(info, &BrowserActionInfo::finished, jsonReply, [info, jsonReply](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status())); + data.insert("thingError", enumValueName(info->status())); jsonReply->setData(data); jsonReply->finished(); }); @@ -863,7 +882,7 @@ JsonReply *IntegrationsHandler::ExecuteBrowserItem(const QVariantMap ¶ms) JsonReply *IntegrationsHandler::ExecuteBrowserItemAction(const QVariantMap ¶ms) { - ThingId thingId = ThingId(params.value("deviceId").toString()); + ThingId thingId = ThingId(params.value("thingId").toString()); QString itemId = params.value("itemId").toString(); ActionTypeId actionTypeId = ActionTypeId(params.value("actionTypeId").toString()); ParamList paramList = unpack(params.value("params")); @@ -874,7 +893,7 @@ JsonReply *IntegrationsHandler::ExecuteBrowserItemAction(const QVariantMap ¶ BrowserItemActionInfo *info = NymeaCore::instance()->executeBrowserItemAction(browserItemAction); connect(info, &BrowserItemActionInfo::finished, jsonReply, [info, jsonReply](){ QVariantMap data; - data.insert("deviceError", enumValueName(info->status())); + data.insert("thingError", enumValueName(info->status())); jsonReply->setData(data); jsonReply->finished(); }); @@ -929,36 +948,36 @@ void IntegrationsHandler::thingRemovedNotification(const ThingId &thingId) { QVariantMap params; params.insert("thingId", thingId); - emit DeviceRemoved(params); + emit ThingRemoved(params); } -void IntegrationsHandler::deviceAddedNotification(Thing *device) +void IntegrationsHandler::thingAddedNotification(Thing *thing) { QVariantMap params; - params.insert("device", pack(device)); - emit DeviceAdded(params); + params.insert("thing", pack(thing)); + emit ThingAdded(params); } -void IntegrationsHandler::deviceChangedNotification(Thing *device) +void IntegrationsHandler::thingChangedNotification(Thing *thing) { QVariantMap params; - params.insert("device", pack(device)); - emit DeviceChanged(params); + params.insert("thing", pack(thing)); + emit ThingChanged(params); } -void IntegrationsHandler::deviceSettingChangedNotification(const ThingId &thingId, const ParamTypeId ¶mTypeId, const QVariant &value) +void IntegrationsHandler::thingSettingChangedNotification(const ThingId &thingId, const ParamTypeId ¶mTypeId, const QVariant &value) { QVariantMap params; - params.insert("deviceId", thingId); + params.insert("thingId", thingId); params.insert("paramTypeId", paramTypeId.toString()); params.insert("value", value); - emit DeviceSettingChanged(params); + emit ThingSettingChanged(params); } QVariantMap IntegrationsHandler::statusToReply(Thing::ThingError status) const { QVariantMap returns; - returns.insert("deviceError", enumValueName(status)); + returns.insert("thingError", enumValueName(status)); return returns; } diff --git a/libnymea-core/jsonrpc/integrationshandler.h b/libnymea-core/jsonrpc/integrationshandler.h index a2d39d5a..de97c0ab 100644 --- a/libnymea-core/jsonrpc/integrationshandler.h +++ b/libnymea-core/jsonrpc/integrationshandler.h @@ -40,36 +40,35 @@ class IntegrationsHandler : public JsonHandler { Q_OBJECT public: - explicit IntegrationsHandler(ThingManager *deviceManager, QObject *parent = nullptr); + explicit IntegrationsHandler(ThingManager *thingManager, QObject *parent = nullptr); QString name() const override; - Q_INVOKABLE JsonReply *GetSupportedVendors(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetSupportedDevices(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetDiscoveredDevices(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetPlugins(const QVariantMap ¶ms) const; + Q_INVOKABLE JsonReply *GetVendors(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *GetThingClasses(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *DiscoverThings(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *GetPlugins(const QVariantMap ¶ms, const JsonContext &context) const; Q_INVOKABLE JsonReply *GetPluginConfiguration(const QVariantMap ¶ms) const; Q_INVOKABLE JsonReply *SetPluginConfiguration(const QVariantMap ¶ms); - - Q_INVOKABLE JsonReply *AddConfiguredDevice(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *PairDevice(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply *AddThing(const QVariantMap ¶ms, const JsonContext &context); + Q_INVOKABLE JsonReply *PairThing(const QVariantMap ¶ms, const JsonContext &context); Q_INVOKABLE JsonReply *ConfirmPairing(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *GetConfiguredDevices(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *ReconfigureDevice(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *EditDevice(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *RemoveConfiguredDevice(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *SetDeviceSettings(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply *GetThings(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *ReconfigureThing(const QVariantMap ¶ms, const JsonContext &context); + Q_INVOKABLE JsonReply *EditThing(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply *RemoveThing(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply *SetThingSettings(const QVariantMap ¶ms); - Q_INVOKABLE JsonReply *GetEventTypes(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetActionTypes(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetStateTypes(const QVariantMap ¶ms) const; + Q_INVOKABLE JsonReply *GetEventTypes(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *GetActionTypes(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *GetStateTypes(const QVariantMap ¶ms, const JsonContext &context) const; Q_INVOKABLE JsonReply *GetStateValue(const QVariantMap ¶ms) const; Q_INVOKABLE JsonReply *GetStateValues(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *BrowseDevice(const QVariantMap ¶ms) const; - Q_INVOKABLE JsonReply *GetBrowserItem(const QVariantMap ¶ms) const; + Q_INVOKABLE JsonReply *BrowseThing(const QVariantMap ¶ms, const JsonContext &context) const; + Q_INVOKABLE JsonReply *GetBrowserItem(const QVariantMap ¶ms, const JsonContext &context) const; - Q_INVOKABLE JsonReply *ExecuteAction(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply *ExecuteAction(const QVariantMap ¶ms, const JsonContext &context); Q_INVOKABLE JsonReply *ExecuteBrowserItem(const QVariantMap ¶ms); Q_INVOKABLE JsonReply *ExecuteBrowserItemAction(const QVariantMap ¶ms); @@ -78,10 +77,10 @@ public: signals: void PluginConfigurationChanged(const QVariantMap ¶ms); void StateChanged(const QVariantMap ¶ms); - void DeviceRemoved(const QVariantMap ¶ms); - void DeviceAdded(const QVariantMap ¶ms); - void DeviceChanged(const QVariantMap ¶ms); - void DeviceSettingChanged(const QVariantMap ¶ms); + void ThingRemoved(const QVariantMap ¶ms); + void ThingAdded(const QVariantMap ¶ms); + void ThingChanged(const QVariantMap ¶ms); + void ThingSettingChanged(const QVariantMap ¶ms); void EventTriggered(const QVariantMap ¶ms); private slots: @@ -91,14 +90,14 @@ private slots: void thingRemovedNotification(const ThingId &thingId); - void deviceAddedNotification(Thing *device); + void thingAddedNotification(Thing *thing); - void deviceChangedNotification(Thing *device); + void thingChangedNotification(Thing *thing); - void deviceSettingChangedNotification(const ThingId &thingId, const ParamTypeId ¶mTypeId, const QVariant &value); + void thingSettingChangedNotification(const ThingId &thingId, const ParamTypeId ¶mTypeId, const QVariant &value); private: - ThingManager *m_deviceManager = nullptr; + ThingManager *m_thingManager = nullptr; QVariantMap statusToReply(Thing::ThingError status) const; }; diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index 495d83ae..b0a85f77 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -17,7 +17,6 @@ RESOURCES += $$top_srcdir/icons.qrc \ HEADERS += nymeacore.h \ integrations/plugininfocache.h \ - integrations/scriptintegrationplugin.h \ integrations/thingmanagerimplementation.h \ integrations/translator.h \ experiences/experiencemanager.h \ @@ -104,7 +103,6 @@ HEADERS += nymeacore.h \ SOURCES += nymeacore.cpp \ integrations/plugininfocache.cpp \ - integrations/scriptintegrationplugin.cpp \ integrations/thingmanagerimplementation.cpp \ integrations/translator.cpp \ experiences/experiencemanager.cpp \ @@ -189,6 +187,8 @@ SOURCES += nymeacore.cpp \ versionAtLeast(QT_VERSION, 5.12.0) { HEADERS += \ + integrations/scriptintegrationplugin.h SOURCES += \ + integrations/scriptintegrationplugin.cpp } diff --git a/libnymea/integrations/pluginmetadata.cpp b/libnymea/integrations/pluginmetadata.cpp index 4dc70eef..65af11dd 100644 --- a/libnymea/integrations/pluginmetadata.cpp +++ b/libnymea/integrations/pluginmetadata.cpp @@ -194,9 +194,9 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) // Check mandatory fields if (!verificationResult.first.isEmpty()) { - m_validationErrors.append("Device class has missing fields: \"" + verificationResult.first.join("\", \"") + "\"\n" + qUtf8Printable(QJsonDocument::fromVariant(thingClassObject.toVariantMap()).toJson(QJsonDocument::Indented))); + m_validationErrors.append("Thing class has missing fields: \"" + verificationResult.first.join("\", \"") + "\"\n" + qUtf8Printable(QJsonDocument::fromVariant(thingClassObject.toVariantMap()).toJson(QJsonDocument::Indented))); hasError = true; - // Stop parsing this deviceClass as we rely on mandatory fields being around. + // Stop parsing this thingClass as we rely on mandatory fields being around. continue; } @@ -210,11 +210,11 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) } if (thingClassId.isNull()) { - m_validationErrors.append("Device class \"" + thingClassName + "\" has invalid UUID: " + thingClassObject.value("id").toString()); + m_validationErrors.append("Thing class \"" + thingClassName + "\" has invalid UUID: " + thingClassObject.value("id").toString()); hasError = true; } if (!verifyDuplicateUuid(thingClassId)) { - m_validationErrors.append("Device class \"" + thingClassName + "\" has duplicate UUID: " + thingClassName); + m_validationErrors.append("Thing class \"" + thingClassName + "\" has duplicate UUID: " + thingClassName); hasError = true; } @@ -306,7 +306,7 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) // Check mandatory fields if (!verificationResult.first.isEmpty()) { - m_validationErrors.append("Device class \"" + thingClass.name() + "\" has missing properties \"" + verificationResult.first.join("\", \"") + "\" in stateType definition\n" + qUtf8Printable(QJsonDocument::fromVariant(st.toVariantMap()).toJson(QJsonDocument::Indented))); + m_validationErrors.append("Thing class \"" + thingClass.name() + "\" has missing properties \"" + verificationResult.first.join("\", \"") + "\" in stateType definition\n" + qUtf8Printable(QJsonDocument::fromVariant(st.toVariantMap()).toJson(QJsonDocument::Indented))); hasError = true; // Not processing further as mandatory fields are expected to be here continue; diff --git a/plugins/mock/devicepluginmock.cpp b/plugins/mock/devicepluginmock.cpp index 9c3899fb..b85ed7ed 100644 --- a/plugins/mock/devicepluginmock.cpp +++ b/plugins/mock/devicepluginmock.cpp @@ -84,7 +84,7 @@ DevicePluginMock::~DevicePluginMock() void DevicePluginMock::discoverThings(ThingDiscoveryInfo *info) { if (info->thingClassId() == mockThingClassId) { - qCDebug(dcMockDevice) << "starting mock discovery:" << info->params(); + qCDebug(dcMock()) << "starting mock discovery:" << info->params(); m_discoveredDeviceCount = info->params().paramValue(mockDiscoveryResultCountParamTypeId).toInt(); QTimer::singleShot(1000, info, [this, info](){ generateDiscoveredDevices(info); @@ -92,39 +92,39 @@ void DevicePluginMock::discoverThings(ThingDiscoveryInfo *info) return; } - if (info->thingClassId() == mockPushButtonThingClassId) { - qCDebug(dcMockDevice) << "starting mock push button discovery:" << info->params(); - m_discoveredDeviceCount = info->params().paramValue(mockPushButtonDiscoveryResultCountParamTypeId).toInt(); + if (info->thingClassId() == pushButtonMockThingClassId) { + qCDebug(dcMock()) << "starting mock push button discovery:" << info->params(); + m_discoveredDeviceCount = info->params().paramValue(pushButtonMockDiscoveryResultCountParamTypeId).toInt(); QTimer::singleShot(1000, info, [this, info]() { generateDiscoveredPushButtonDevices(info); }); return; } - if (info->thingClassId() == mockDisplayPinThingClassId) { - qCDebug(dcMockDevice) << "starting mock display pin discovery:" << info->params(); - m_discoveredDeviceCount = info->params().paramValue(mockDisplayPinDiscoveryResultCountParamTypeId).toInt(); + if (info->thingClassId() == displayPinMockThingClassId) { + qCDebug(dcMock()) << "starting mock display pin discovery:" << info->params(); + m_discoveredDeviceCount = info->params().paramValue(displayPinMockDiscoveryResultCountParamTypeId).toInt(); QTimer::singleShot(1000, info, [this, info]() { generateDiscoveredDisplayPinDevices(info); }); return; } - if (info->thingClassId() == mockParentThingClassId) { - qCDebug(dcMockDevice()) << "Starting discovery for mock device parent"; + if (info->thingClassId() == parentMockThingClassId) { + qCDebug(dcMock()) << "Starting discovery for mocked parent thing"; QTimer::singleShot(1000, info, [info](){ - ThingDescriptor descriptor(mockParentThingClassId, "Mock Parent (Discovered)"); + ThingDescriptor descriptor(parentMockThingClassId, "Mocked Thing Parent (Discovered)"); info->addThingDescriptor(descriptor); info->finish(Thing::ThingErrorNoError); }); return; } - if (info->thingClassId() == mockChildThingClassId) { + if (info->thingClassId() == childMockThingClassId) { QTimer::singleShot(1000, info, [this, info](){ - if (!myThings().filterByThingClassId(mockParentThingClassId).isEmpty()) { - Thing *parent = myThings().filterByThingClassId(mockParentThingClassId).first(); - ThingDescriptor descriptor(mockChildThingClassId, "Mock Child (Discovered)", QString(), parent->id()); + if (!myThings().filterByThingClassId(parentMockThingClassId).isEmpty()) { + Thing *parent = myThings().filterByThingClassId(parentMockThingClassId).first(); + ThingDescriptor descriptor(childMockThingClassId, "Mocked Thing Child (Discovered)", QString(), parent->id()); info->addThingDescriptor(descriptor); } info->finish(Thing::ThingErrorNoError); @@ -132,10 +132,10 @@ void DevicePluginMock::discoverThings(ThingDiscoveryInfo *info) return; } - if (info->thingClassId() == mockUserAndPassThingClassId) { + if (info->thingClassId() == userAndPassMockThingClassId) { QTimer::singleShot(1000, info, [this, info](){ - if (myThings().filterByThingClassId(mockUserAndPassThingClassId).isEmpty()) { - ThingDescriptor descriptor(mockUserAndPassThingClassId, "Mock User & Password (Discovered)", QString()); + if (myThings().filterByThingClassId(userAndPassMockThingClassId).isEmpty()) { + ThingDescriptor descriptor(userAndPassMockThingClassId, "Mocked Thing User & Password (Discovered)", QString()); info->addThingDescriptor(descriptor); } info->finish(Thing::ThingErrorNoError); @@ -143,27 +143,27 @@ void DevicePluginMock::discoverThings(ThingDiscoveryInfo *info) return; } - qCWarning(dcMockDevice()) << "Cannot discover for ThingClassId" << info->thingClassId(); + qCWarning(dcMock()) << "Cannot discover for ThingClassId" << info->thingClassId(); info->finish(Thing::ThingErrorThingNotFound); } void DevicePluginMock::setupThing(ThingSetupInfo *info) { - if (info->thing()->thingClassId() == mockThingClassId || info->thing()->thingClassId() == mockDeviceAutoThingClassId) { + if (info->thing()->thingClassId() == mockThingClassId || info->thing()->thingClassId() == autoMockThingClassId) { bool async = false; bool broken = false; if (info->thing()->thingClassId() == mockThingClassId) { - async = info->thing()->paramValue(mockDeviceAsyncParamTypeId).toBool(); - broken = info->thing()->paramValue(mockDeviceBrokenParamTypeId).toBool(); + async = info->thing()->paramValue(mockThingAsyncParamTypeId).toBool(); + broken = info->thing()->paramValue(mockThingBrokenParamTypeId).toBool(); } else { - async = info->thing()->paramValue(mockDeviceAutoDeviceAsyncParamTypeId).toBool(); - broken = info->thing()->paramValue(mockDeviceAutoDeviceBrokenParamTypeId).toBool(); + async = info->thing()->paramValue(autoMockThingAsyncParamTypeId).toBool(); + broken = info->thing()->paramValue(autoMockThingBrokenParamTypeId).toBool(); } - qCDebug(dcMockDevice()) << "SetupDevice for" << info->thing()->name() << "Async:" << async << "Broken:" << broken; + qCDebug(dcMock()) << "SetupThing for" << info->thing()->name() << "Async:" << async << "Broken:" << broken; if (!async && broken) { - qCWarning(dcMockDevice) << "This device is intentionally broken."; - info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("This mock device is intentionally broken.")); + qCWarning(dcMock()) << "This thing is intentionally broken."; + info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("This mocked thing is intentionally broken.")); return; } @@ -172,7 +172,7 @@ void DevicePluginMock::setupThing(ThingSetupInfo *info) m_daemons.insert(info->thing(), daemon); if (!daemon->isListening()) { - qCWarning(dcMockDevice) << "HTTP port opening failed:" << info->thing()->paramValue(mockDeviceHttpportParamTypeId).toInt(); + qCWarning(dcMock()) << "HTTP port opening failed:" << info->thing()->paramValue(mockThingHttpportParamTypeId).toInt(); info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("Failed to open HTTP port. Port in use?")); return; } @@ -188,83 +188,83 @@ void DevicePluginMock::setupThing(ThingSetupInfo *info) if (async) { Thing *device = info->thing(); QTimer::singleShot(1000, device, [info](){ - qCDebug(dcMockDevice) << "Finishing device setup for mock device" << info->thing()->name(); - if (info->thing()->paramValue(mockDeviceBrokenParamTypeId).toBool()) { - info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("This mock device is intentionally broken.")); + qCDebug(dcMock()) << "Finishing thing setup for mocked thing" << info->thing()->name(); + if (info->thing()->paramValue(mockThingBrokenParamTypeId).toBool()) { + info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("This mocked thing is intentionally broken.")); } else { info->finish(Thing::ThingErrorNoError); } }); return; } - qCDebug(dcMockDevice()) << "Setup complete" << info->thing()->name(); + qCDebug(dcMock()) << "Setup complete" << info->thing()->name(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockPushButtonThingClassId) { - qCDebug(dcMockDevice) << "Setup PushButton mock device" << info->thing()->params(); + if (info->thing()->thingClassId() == pushButtonMockThingClassId) { + qCDebug(dcMock()) << "Setup PushButton mock thing" << info->thing()->params(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockDisplayPinThingClassId) { - qCDebug(dcMockDevice) << "Setup DisplayPin mock device" << info->thing()->params(); + if (info->thing()->thingClassId() == displayPinMockThingClassId) { + qCDebug(dcMock()) << "Setup DisplayPin mock thing" << info->thing()->params(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockParentThingClassId) { - qCDebug(dcMockDevice) << "Setup Parent mock device" << info->thing()->params(); + if (info->thing()->thingClassId() == parentMockThingClassId) { + qCDebug(dcMock()) << "Setup Parent mock thing" << info->thing()->params(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockChildThingClassId) { - qCDebug(dcMockDevice) << "Setup Child mock device" << info->thing()->params(); + if (info->thing()->thingClassId() == childMockThingClassId) { + qCDebug(dcMock()) << "Setup Child mock thing" << info->thing()->params(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockInputTypeThingClassId) { - qCDebug(dcMockDevice) << "Setup InputType mock device" << info->thing()->params(); + if (info->thing()->thingClassId() == inputTypeMockThingClassId) { + qCDebug(dcMock()) << "Setup InputType mock thing" << info->thing()->params(); info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockUserAndPassThingClassId) { - qCDebug(dcMockDevice()) << "Setup User and password mock device"; + if (info->thing()->thingClassId() == userAndPassMockThingClassId) { + qCDebug(dcMock()) << "Setup User and password mock thing"; info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockOAuthGoogleThingClassId) { - qCDebug(dcMockDevice()) << "Google OAuth setup complete"; + if (info->thing()->thingClassId() == oAuthGoogleMockThingClassId) { + qCDebug(dcMock()) << "Google OAuth setup complete"; info->finish(Thing::ThingErrorNoError); return; } - if (info->thing()->thingClassId() == mockOAuthSonosThingClassId) { - qCDebug(dcMockDevice()) << "Sonos OAuth setup complete"; + if (info->thing()->thingClassId() == oAuthSonosMockThingClassId) { + qCDebug(dcMock()) << "Sonos OAuth setup complete"; info->finish(Thing::ThingErrorNoError); return; } - qCWarning(dcMockDevice()) << "Unhandled device class" << info->thing()->thingClass(); + qCWarning(dcMock()) << "Unhandled thing class" << info->thing()->thingClass(); info->finish(Thing::ThingErrorThingClassNotFound); } void DevicePluginMock::postSetupThing(Thing *device) { - qCDebug(dcMockDevice) << "Postsetup mockdevice" << device->name(); - if (device->thingClassId() == mockParentThingClassId) { + qCDebug(dcMock()) << "Postsetup mock" << device->name(); + if (device->thingClassId() == parentMockThingClassId) { foreach (Thing *d, myThings()) { - if (d->thingClassId() == mockChildThingClassId && d->parentId() == device->id()) { + if (d->thingClassId() == childMockThingClassId && d->parentId() == device->id()) { return; } } - ThingDescriptor mockDescriptor(mockChildThingClassId, "Child Mock Device (Auto created)", "Child Mock Device (Auto created)", device->id()); + ThingDescriptor mockDescriptor(childMockThingClassId, "Mocked Thing Child (Auto created)", "Mocked Thing Child (Auto created)", device->id()); emit autoThingsAppeared(ThingDescriptors() << mockDescriptor); } } @@ -277,17 +277,17 @@ void DevicePluginMock::thingRemoved(Thing *device) void DevicePluginMock::startMonitoringAutoThings() { foreach (Thing *device, myThings()) { - if (device->thingClassId() == mockDeviceAutoThingClassId) { + if (device->thingClassId() == autoMockThingClassId) { return; // We already have a Auto Mock device... do nothing. } } - ThingDescriptor mockDescriptor(mockDeviceAutoThingClassId, "Mock Device (Auto created)"); + ThingDescriptor mockDescriptor(autoMockThingClassId, "Mocked Thing (Auto created)"); ParamList params; qsrand(QDateTime::currentMSecsSinceEpoch()); int port = 4242 + (qrand() % 1000); - Param param(mockDeviceAutoDeviceHttpportParamTypeId, port); + Param param(autoMockThingHttpportParamTypeId, port); params.append(param); mockDescriptor.setParams(params); @@ -299,27 +299,27 @@ void DevicePluginMock::startMonitoringAutoThings() void DevicePluginMock::startPairing(ThingPairingInfo *info) { - if (info->thingClassId() == mockPushButtonThingClassId) { - qCDebug(dcMockDevice) << "Push button. Pressing the button in 3 seconds."; + if (info->thingClassId() == pushButtonMockThingClassId) { + qCDebug(dcMock()) << "Push button. Pressing the button in 3 seconds."; info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Wait 3 second before you continue, the push button will be pressed automatically.")); m_pushbuttonPressed = false; QTimer::singleShot(3000, this, SLOT(onPushButtonPressed())); return; } - if (info->thingClassId() == mockDisplayPinThingClassId) { - qCDebug(dcMockDevice) << "Display pin!! The pin is 243681"; - info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.")); + if (info->thingClassId() == displayPinMockThingClassId) { + qCDebug(dcMock()) << "Display pin!! The pin is 243681"; + info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter the secret which normaly will be displayed on the device. For this mocked thing the pin is 243681.")); return; } - if (info->thingClassId() == mockUserAndPassThingClassId) { - qCDebug(dcMockDevice) << "User and password. Login is \"user\" and \"password\"."; - info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter login credentials for the mock device (\"user\" and \"password\").")); + if (info->thingClassId() == userAndPassMockThingClassId) { + qCDebug(dcMock()) << "User and password. Login is \"user\" and \"password\"."; + info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter login credentials for the mocked thing (\"user\" and \"password\").")); return; } - if (info->thingClassId() == mockOAuthSonosThingClassId) { + if (info->thingClassId() == oAuthSonosMockThingClassId) { QString clientId = "b15cbf8c-a39c-47aa-bd93-635a96e9696c"; QString clientSecret = "c086ba71-e562-430b-a52f-867c6482fd11"; @@ -332,14 +332,14 @@ void DevicePluginMock::startPairing(ThingPairingInfo *info) queryParams.addQueryItem("state", "ya-ya"); url.setQuery(queryParams); - qCDebug(dcMockDevice()) << "Sonos url:" << url; + qCDebug(dcMock()) << "Sonos url:" << url; info->setOAuthUrl(url); info->finish(Thing::ThingErrorNoError); return; } - if (info->thingClassId() == mockOAuthGoogleThingClassId) { + if (info->thingClassId() == oAuthGoogleMockThingClassId) { QString clientId= "937667874529-pr6s5ciu6sfnnqmt2sppvb6rokbkjjta.apps.googleusercontent.com"; QString clientSecret = "1ByBRmNqaK08VC54eEVcnGf1"; @@ -362,11 +362,11 @@ void DevicePluginMock::startPairing(ThingPairingInfo *info) void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &username, const QString &secret) { - qCDebug(dcMockDevice) << "Confirm pairing"; + qCDebug(dcMock()) << "Confirm pairing"; - if (info->thingClassId() == mockPushButtonThingClassId) { + if (info->thingClassId() == pushButtonMockThingClassId) { if (!m_pushbuttonPressed) { - qCDebug(dcMockDevice) << "PushButton not pressed yet!"; + qCDebug(dcMock()) << "PushButton not pressed yet!"; info->finish(Thing::ThingErrorAuthenticationFailure, QT_TR_NOOP("The push button has not been pressed.")); return; } @@ -377,21 +377,21 @@ void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &use return; } - if (info->thingClassId() == mockDisplayPinThingClassId) { + if (info->thingClassId() == displayPinMockThingClassId) { if (secret != "243681") { - qCWarning(dcMockDevice) << "Invalid pin:" << secret; + qCWarning(dcMock()) << "Invalid pin:" << secret; info->finish(Thing::ThingErrorAuthenticationFailure, QT_TR_NOOP("Invalid PIN!")); return; } QTimer::singleShot(500, this, [info](){ - qCDebug(dcMockDevice()) << "Pairing finished."; + qCDebug(dcMock()) << "Pairing finished."; info->finish(Thing::ThingErrorNoError); }); return; } - if (info->thingClassId() == mockUserAndPassThingClassId) { - qCDebug(dcMockDevice()) << "Credentials received:" << username << secret; + if (info->thingClassId() == userAndPassMockThingClassId) { + qCDebug(dcMock()) << "Credentials received:" << username << secret; if (username == "user" && secret == "password") { info->finish(Thing::ThingErrorNoError); return; @@ -402,11 +402,11 @@ void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &use } - if (info->thingClassId() == mockOAuthSonosThingClassId) { - qCDebug(dcMockDevice()) << "Secret is" << secret; + if (info->thingClassId() == oAuthSonosMockThingClassId) { + qCDebug(dcMock()) << "Secret is" << secret; QUrl url(secret); QUrlQuery query(url); - qCDebug(dcMockDevice()) << "Acess code is:" << query.queryItemValue("code"); + qCDebug(dcMock()) << "Acess code is:" << query.queryItemValue("code"); QString accessCode = query.queryItemValue("code"); @@ -432,10 +432,10 @@ void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &use reply->deleteLater(); QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll()); - qCDebug(dcMockDevice()) << "Sonos accessToken reply:" << this << reply->error() << reply->errorString() << jsonDoc.toJson(); - qCDebug(dcMockDevice()) << "Access token:" << jsonDoc.toVariant().toMap().value("access_token").toString(); - qCDebug(dcMockDevice()) << "expires at" << QDateTime::currentDateTime().addSecs(jsonDoc.toVariant().toMap().value("expires_in").toInt()).toString(); - qCDebug(dcMockDevice()) << "Refresh token:" << jsonDoc.toVariant().toMap().value("refresh_token").toString(); + qCDebug(dcMock()) << "Sonos accessToken reply:" << this << reply->error() << reply->errorString() << jsonDoc.toJson(); + qCDebug(dcMock()) << "Access token:" << jsonDoc.toVariant().toMap().value("access_token").toString(); + qCDebug(dcMock()) << "expires at" << QDateTime::currentDateTime().addSecs(jsonDoc.toVariant().toMap().value("expires_in").toInt()).toString(); + qCDebug(dcMock()) << "Refresh token:" << jsonDoc.toVariant().toMap().value("refresh_token").toString(); info->finish(Thing::ThingErrorNoError); }); @@ -443,11 +443,11 @@ void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &use } - if (info->thingClassId() == mockOAuthGoogleThingClassId) { - qCDebug(dcMockDevice()) << "Secret is" << secret; + if (info->thingClassId() == oAuthGoogleMockThingClassId) { + qCDebug(dcMock()) << "Secret is" << secret; QUrl url(secret); QUrlQuery query(url); - qCDebug(dcMockDevice()) << "Acess code is:" << query.queryItemValue("code"); + qCDebug(dcMock()) << "Acess code is:" << query.queryItemValue("code"); QString accessCode = query.queryItemValue("code"); @@ -472,29 +472,29 @@ void DevicePluginMock::confirmPairing(ThingPairingInfo *info, const QString &use reply->deleteLater(); QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll()); - qCDebug(dcMockDevice()) << "Sonos accessToken reply:" << this << reply->error() << reply->errorString() << jsonDoc.toJson(); - qCDebug(dcMockDevice()) << "Access token:" << jsonDoc.toVariant().toMap().value("access_token").toString(); - qCDebug(dcMockDevice()) << "expires at" << QDateTime::currentDateTime().addSecs(jsonDoc.toVariant().toMap().value("expires_in").toInt()).toString(); - qCDebug(dcMockDevice()) << "Refresh token:" << jsonDoc.toVariant().toMap().value("refresh_token").toString(); - qCDebug(dcMockDevice()) << "ID token:" << jsonDoc.toVariant().toMap().value("id_token").toString(); + qCDebug(dcMock()) << "Sonos accessToken reply:" << this << reply->error() << reply->errorString() << jsonDoc.toJson(); + qCDebug(dcMock()) << "Access token:" << jsonDoc.toVariant().toMap().value("access_token").toString(); + qCDebug(dcMock()) << "expires at" << QDateTime::currentDateTime().addSecs(jsonDoc.toVariant().toMap().value("expires_in").toInt()).toString(); + qCDebug(dcMock()) << "Refresh token:" << jsonDoc.toVariant().toMap().value("refresh_token").toString(); + qCDebug(dcMock()) << "ID token:" << jsonDoc.toVariant().toMap().value("id_token").toString(); info->finish(Thing::ThingErrorNoError); }); return; } - qCWarning(dcMockDevice) << "Invalid ThingClassId -> no pairing possible with this device"; + qCWarning(dcMock()) << "Invalid ThingClassId -> no pairing possible with this thing"; info->finish(Thing::ThingErrorThingClassNotFound); } void DevicePluginMock::browseThing(BrowseResult *result) { - qCDebug(dcMockDevice()) << "Browse device called" << result->thing(); + qCDebug(dcMock()) << "Browse thing called" << result->thing(); if (result->thing()->thingClassId() == mockThingClassId) { - if (result->thing()->paramValue(mockDeviceAsyncParamTypeId).toBool()) { + if (result->thing()->paramValue(mockThingAsyncParamTypeId).toBool()) { QTimer::singleShot(1000, result, [this, result]() { - if (result->thing()->paramValue(mockDeviceBrokenParamTypeId).toBool()) { + if (result->thing()->paramValue(mockThingBrokenParamTypeId).toBool()) { result->finish(Thing::ThingErrorHardwareFailure); return; } @@ -515,7 +515,7 @@ void DevicePluginMock::browseThing(BrowseResult *result) return; } - if (result->thing()->paramValue(mockDeviceBrokenParamTypeId).toBool()) { + if (result->thing()->paramValue(mockThingBrokenParamTypeId).toBool()) { result->finish(Thing::ThingErrorHardwareFailure); return; } @@ -567,7 +567,7 @@ void DevicePluginMock::executeAction(ThingActionInfo *info) } if (info->action().actionTypeId() == mockPowerActionTypeId) { - qCDebug(dcMockDevice()) << "Setting power to" << info->action().param(mockPowerActionPowerParamTypeId).value().toBool(); + qCDebug(dcMock()) << "Setting power to" << info->action().param(mockPowerActionPowerParamTypeId).value().toBool(); info->thing()->setStateValue(mockPowerStateTypeId, info->action().param(mockPowerActionPowerParamTypeId).value().toBool()); } m_daemons.value(info->thing())->actionExecuted(info->action().actionTypeId()); @@ -575,10 +575,10 @@ void DevicePluginMock::executeAction(ThingActionInfo *info) return; } - if (info->thing()->thingClassId() == mockDeviceAutoThingClassId) { - if (info->action().actionTypeId() == mockDeviceAutoMockActionAsyncActionTypeId || info->action().actionTypeId() == mockDeviceAutoMockActionAsyncBrokenActionTypeId) { + if (info->thing()->thingClassId() == autoMockThingClassId) { + if (info->action().actionTypeId() == autoMockMockActionAsyncActionTypeId || info->action().actionTypeId() == autoMockMockActionAsyncBrokenActionTypeId) { QTimer::singleShot(1000, info->thing(), [info](){ - if (info->action().actionTypeId() == mockDeviceAutoMockActionAsyncBrokenActionTypeId) { + if (info->action().actionTypeId() == autoMockMockActionAsyncBrokenActionTypeId) { info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("This mock action is intentionally broken.")); } else { info->finish(Thing::ThingErrorNoError); @@ -586,124 +586,124 @@ void DevicePluginMock::executeAction(ThingActionInfo *info) }); } - if (info->action().actionTypeId() == mockDeviceAutoMockActionBrokenActionTypeId) { + if (info->action().actionTypeId() == autoMockMockActionBrokenActionTypeId) { info->finish(Thing::ThingErrorSetupFailed); return; } m_daemons.value(info->thing())->actionExecuted(info->action().actionTypeId()); info->finish(Thing::ThingErrorNoError); - } else if (info->thing()->thingClassId() == mockPushButtonThingClassId) { - if (info->action().actionTypeId() == mockPushButtonColorActionTypeId) { - QString colorString = info->action().param(mockPushButtonColorActionColorParamTypeId).value().toString(); + } else if (info->thing()->thingClassId() == pushButtonMockThingClassId) { + if (info->action().actionTypeId() == pushButtonMockColorActionTypeId) { + QString colorString = info->action().param(pushButtonMockColorActionColorParamTypeId).value().toString(); QColor color(colorString); if (!color.isValid()) { - qCWarning(dcMockDevice) << "Invalid color parameter"; + qCWarning(dcMock()) << "Invalid color parameter"; info->finish(Thing::ThingErrorInvalidParameter); return; } - info->thing()->setStateValue(mockPushButtonColorStateTypeId, colorString); + info->thing()->setStateValue(pushButtonMockColorStateTypeId, colorString); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockPushButtonPercentageActionTypeId) { - info->thing()->setStateValue(mockPushButtonPercentageStateTypeId, info->action().param(mockPushButtonPercentageActionPercentageParamTypeId).value().toInt()); + } else if (info->action().actionTypeId() == pushButtonMockPercentageActionTypeId) { + info->thing()->setStateValue(pushButtonMockPercentageStateTypeId, info->action().param(pushButtonMockPercentageActionPercentageParamTypeId).value().toInt()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockPushButtonAllowedValuesActionTypeId) { - info->thing()->setStateValue(mockPushButtonAllowedValuesStateTypeId, info->action().param(mockPushButtonAllowedValuesActionAllowedValuesParamTypeId).value().toString()); + } else if (info->action().actionTypeId() == pushButtonMockAllowedValuesActionTypeId) { + info->thing()->setStateValue(pushButtonMockAllowedValuesStateTypeId, info->action().param(pushButtonMockAllowedValuesActionAllowedValuesParamTypeId).value().toString()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockPushButtonDoubleActionTypeId) { - info->thing()->setStateValue(mockPushButtonDoubleStateTypeId, info->action().param(mockPushButtonDoubleActionDoubleParamTypeId).value().toDouble()); + } else if (info->action().actionTypeId() == pushButtonMockDoubleActionTypeId) { + info->thing()->setStateValue(pushButtonMockDoubleStateTypeId, info->action().param(pushButtonMockDoubleActionDoubleParamTypeId).value().toDouble()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockPushButtonBoolActionTypeId) { - info->thing()->setStateValue(mockPushButtonBoolStateTypeId, info->action().param(mockPushButtonBoolActionBoolParamTypeId).value().toBool()); + } else if (info->action().actionTypeId() == pushButtonMockBoolActionTypeId) { + info->thing()->setStateValue(pushButtonMockBoolStateTypeId, info->action().param(pushButtonMockBoolActionBoolParamTypeId).value().toBool()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockPushButtonTimeoutActionTypeId) { + } else if (info->action().actionTypeId() == pushButtonMockTimeoutActionTypeId) { // Not finishing action intentionally... return; } info->finish(Thing::ThingErrorActionTypeNotFound); return; - } else if (info->thing()->thingClassId() == mockDisplayPinThingClassId) { - if (info->action().actionTypeId() == mockDisplayPinColorActionTypeId) { - QString colorString = info->action().param(mockDisplayPinColorActionColorParamTypeId).value().toString(); + } else if (info->thing()->thingClassId() == displayPinMockThingClassId) { + if (info->action().actionTypeId() == displayPinMockColorActionTypeId) { + QString colorString = info->action().param(displayPinMockColorActionColorParamTypeId).value().toString(); QColor color(colorString); if (!color.isValid()) { - qCWarning(dcMockDevice) << "Invalid color parameter"; + qCWarning(dcMock()) << "Invalid color parameter"; info->finish(Thing::ThingErrorInvalidParameter); return; } - info->thing()->setStateValue(mockDisplayPinColorStateTypeId, colorString); + info->thing()->setStateValue(displayPinMockColorStateTypeId, colorString); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockDisplayPinPercentageActionTypeId) { - info->thing()->setStateValue(mockDisplayPinPercentageStateTypeId, info->action().param(mockDisplayPinPercentageActionPercentageParamTypeId).value().toInt()); + } else if (info->action().actionTypeId() == displayPinMockPercentageActionTypeId) { + info->thing()->setStateValue(displayPinMockPercentageStateTypeId, info->action().param(displayPinMockPercentageActionPercentageParamTypeId).value().toInt()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockDisplayPinAllowedValuesActionTypeId) { - info->thing()->setStateValue(mockDisplayPinAllowedValuesStateTypeId, info->action().param(mockDisplayPinAllowedValuesActionAllowedValuesParamTypeId).value().toString()); + } else if (info->action().actionTypeId() == displayPinMockAllowedValuesActionTypeId) { + info->thing()->setStateValue(displayPinMockAllowedValuesStateTypeId, info->action().param(displayPinMockAllowedValuesActionAllowedValuesParamTypeId).value().toString()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockDisplayPinDoubleActionTypeId) { - info->thing()->setStateValue(mockDisplayPinDoubleStateTypeId, info->action().param(mockDisplayPinDoubleActionDoubleParamTypeId).value().toDouble()); + } else if (info->action().actionTypeId() == displayPinMockDoubleActionTypeId) { + info->thing()->setStateValue(displayPinMockDoubleStateTypeId, info->action().param(displayPinMockDoubleActionDoubleParamTypeId).value().toDouble()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockDisplayPinBoolActionTypeId) { - info->thing()->setStateValue(mockDisplayPinBoolStateTypeId, info->action().param(mockDisplayPinBoolActionBoolParamTypeId).value().toBool()); + } else if (info->action().actionTypeId() == displayPinMockBoolActionTypeId) { + info->thing()->setStateValue(displayPinMockBoolStateTypeId, info->action().param(displayPinMockBoolActionBoolParamTypeId).value().toBool()); info->finish(Thing::ThingErrorNoError); return; - } else if (info->action().actionTypeId() == mockDisplayPinTimeoutActionTypeId) { + } else if (info->action().actionTypeId() == displayPinMockTimeoutActionTypeId) { // Not finishing action intentionally... return; } info->finish(Thing::ThingErrorActionTypeNotFound); return; - } else if (info->thing()->thingClassId() == mockParentThingClassId) { - if (info->action().actionTypeId() == mockParentBoolValueActionTypeId) { - info->thing()->setStateValue(mockParentBoolValueStateTypeId, info->action().param(mockParentBoolValueActionBoolValueParamTypeId).value().toBool()); + } else if (info->thing()->thingClassId() == parentMockThingClassId) { + if (info->action().actionTypeId() == parentMockBoolValueActionTypeId) { + info->thing()->setStateValue(parentMockBoolValueStateTypeId, info->action().param(parentMockBoolValueActionBoolValueParamTypeId).value().toBool()); info->finish(Thing::ThingErrorNoError); return; } info->finish(Thing::ThingErrorActionTypeNotFound); return; - } else if (info->thing()->thingClassId() == mockChildThingClassId) { - if (info->action().actionTypeId() == mockChildBoolValueActionTypeId) { - info->thing()->setStateValue(mockChildBoolValueStateTypeId, info->action().param(mockChildBoolValueActionBoolValueParamTypeId).value().toBool()); + } else if (info->thing()->thingClassId() == childMockThingClassId) { + if (info->action().actionTypeId() == childMockBoolValueActionTypeId) { + info->thing()->setStateValue(childMockBoolValueStateTypeId, info->action().param(childMockBoolValueActionBoolValueParamTypeId).value().toBool()); info->finish(Thing::ThingErrorNoError); return; } info->finish(Thing::ThingErrorActionTypeNotFound); return; - } else if (info->thing()->thingClassId() == mockInputTypeThingClassId) { - if (info->action().actionTypeId() == mockInputTypeWritableBoolActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableBoolStateTypeId, info->action().param(mockInputTypeWritableBoolActionWritableBoolParamTypeId).value().toULongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableIntActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableIntStateTypeId, info->action().param(mockInputTypeWritableIntActionWritableIntParamTypeId).value().toLongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableIntMinMaxActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableIntMinMaxStateTypeId, info->action().param(mockInputTypeWritableIntMinMaxActionWritableIntMinMaxParamTypeId).value().toLongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableUIntActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableUIntStateTypeId, info->action().param(mockInputTypeWritableUIntActionWritableUIntParamTypeId).value().toULongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableUIntMinMaxActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableUIntMinMaxStateTypeId, info->action().param(mockInputTypeWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId).value().toLongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableDoubleActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableDoubleStateTypeId, info->action().param(mockInputTypeWritableDoubleActionWritableDoubleParamTypeId).value().toDouble()); - } else if (info->action().actionTypeId() == mockInputTypeWritableDoubleMinMaxActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableDoubleMinMaxStateTypeId, info->action().param(mockInputTypeWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId).value().toDouble()); - } else if (info->action().actionTypeId() == mockInputTypeWritableStringActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableStringStateTypeId, info->action().param(mockInputTypeWritableStringActionWritableStringParamTypeId).value().toString()); - } else if (info->action().actionTypeId() == mockInputTypeWritableStringSelectionActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableStringSelectionStateTypeId, info->action().param(mockInputTypeWritableStringSelectionActionWritableStringSelectionParamTypeId).value().toString()); - } else if (info->action().actionTypeId() == mockInputTypeWritableColorActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableColorStateTypeId, info->action().param(mockInputTypeWritableColorActionWritableColorParamTypeId).value().toString()); - } else if (info->action().actionTypeId() == mockInputTypeWritableTimeActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableTimeStateTypeId, info->action().param(mockInputTypeWritableTimeActionWritableTimeParamTypeId).value().toTime()); - } else if (info->action().actionTypeId() == mockInputTypeWritableTimestampIntActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableTimestampIntStateTypeId, info->action().param(mockInputTypeWritableTimestampIntActionWritableTimestampIntParamTypeId).value().toLongLong()); - } else if (info->action().actionTypeId() == mockInputTypeWritableTimestampUIntActionTypeId) { - info->thing()->setStateValue(mockInputTypeWritableTimestampUIntStateTypeId, info->action().param(mockInputTypeWritableTimestampUIntActionWritableTimestampUIntParamTypeId).value().toULongLong()); + } else if (info->thing()->thingClassId() == inputTypeMockThingClassId) { + if (info->action().actionTypeId() == inputTypeMockWritableBoolActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableBoolStateTypeId, info->action().param(inputTypeMockWritableBoolActionWritableBoolParamTypeId).value().toULongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableIntActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableIntStateTypeId, info->action().param(inputTypeMockWritableIntActionWritableIntParamTypeId).value().toLongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableIntMinMaxActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableIntMinMaxStateTypeId, info->action().param(inputTypeMockWritableIntMinMaxActionWritableIntMinMaxParamTypeId).value().toLongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableUIntActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableUIntStateTypeId, info->action().param(inputTypeMockWritableUIntActionWritableUIntParamTypeId).value().toULongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableUIntMinMaxActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableUIntMinMaxStateTypeId, info->action().param(inputTypeMockWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId).value().toLongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableDoubleActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableDoubleStateTypeId, info->action().param(inputTypeMockWritableDoubleActionWritableDoubleParamTypeId).value().toDouble()); + } else if (info->action().actionTypeId() == inputTypeMockWritableDoubleMinMaxActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableDoubleMinMaxStateTypeId, info->action().param(inputTypeMockWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId).value().toDouble()); + } else if (info->action().actionTypeId() == inputTypeMockWritableStringActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableStringStateTypeId, info->action().param(inputTypeMockWritableStringActionWritableStringParamTypeId).value().toString()); + } else if (info->action().actionTypeId() == inputTypeMockWritableStringSelectionActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableStringSelectionStateTypeId, info->action().param(inputTypeMockWritableStringSelectionActionWritableStringSelectionParamTypeId).value().toString()); + } else if (info->action().actionTypeId() == inputTypeMockWritableColorActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableColorStateTypeId, info->action().param(inputTypeMockWritableColorActionWritableColorParamTypeId).value().toString()); + } else if (info->action().actionTypeId() == inputTypeMockWritableTimeActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableTimeStateTypeId, info->action().param(inputTypeMockWritableTimeActionWritableTimeParamTypeId).value().toTime()); + } else if (info->action().actionTypeId() == inputTypeMockWritableTimestampIntActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableTimestampIntStateTypeId, info->action().param(inputTypeMockWritableTimestampIntActionWritableTimestampIntParamTypeId).value().toLongLong()); + } else if (info->action().actionTypeId() == inputTypeMockWritableTimestampUIntActionTypeId) { + info->thing()->setStateValue(inputTypeMockWritableTimestampUIntStateTypeId, info->action().param(inputTypeMockWritableTimestampUIntActionWritableTimestampUIntParamTypeId).value().toULongLong()); } return; @@ -713,9 +713,9 @@ void DevicePluginMock::executeAction(ThingActionInfo *info) void DevicePluginMock::executeBrowserItem(BrowserActionInfo *info) { - qCDebug(dcMockDevice()) << "ExecuteBrowserItem called" << info->browserAction().itemId(); - bool broken = info->thing()->paramValue(mockDeviceBrokenParamTypeId).toBool(); - bool async = info->thing()->paramValue(mockDeviceAsyncParamTypeId).toBool(); + qCDebug(dcMock()) << "ExecuteBrowserItem called" << info->browserAction().itemId(); + bool broken = info->thing()->paramValue(mockThingBrokenParamTypeId).toBool(); + bool async = info->thing()->paramValue(mockThingAsyncParamTypeId).toBool(); VirtualFsNode *node = m_virtualFs->findNode(info->browserAction().itemId()); if (!node) { @@ -745,7 +745,7 @@ void DevicePluginMock::executeBrowserItem(BrowserActionInfo *info) void DevicePluginMock::executeBrowserItemAction(BrowserItemActionInfo *info) { - qCDebug(dcMockDevice()) << "TODO" << info << info->browserItemAction().id(); + qCDebug(dcMock()) << "TODO" << info << info->browserItemAction().id(); if (info->browserItemAction().actionTypeId() == mockAddToFavoritesBrowserItemActionTypeId) { VirtualFsNode *node = m_virtualFs->findNode(info->browserItemAction().itemId()); @@ -803,7 +803,7 @@ void DevicePluginMock::triggerEvent(const EventTypeId &id) Event event(id, device->id()); - qCDebug(dcMockDevice) << "Emitting event " << event.eventTypeId(); + qCDebug(dcMock) << "Emitting event " << event.eventTypeId(); emit emitEvent(event); } @@ -814,7 +814,7 @@ void DevicePluginMock::onDisappear() return; } Thing *device = m_daemons.key(daemon); - qCDebug(dcMockDevice) << "Emitting autoDeviceDisappeared for device" << device->id(); + qCDebug(dcMock) << "Emitting autoDeviceDisappeared for device" << device->id(); emit autoThingDisappeared(device->id()); } @@ -825,15 +825,15 @@ void DevicePluginMock::onReconfigureAutoDevice() return; Thing *device = m_daemons.key(daemon); - qCDebug(dcMockDevice()) << "Reconfigure auto device for" << device << device->params(); + qCDebug(dcMock()) << "Reconfigure auto device for" << device << device->params(); - int currentPort = device->params().paramValue(mockDeviceAutoDeviceHttpportParamTypeId).toInt(); + int currentPort = device->params().paramValue(autoMockThingHttpportParamTypeId).toInt(); // Note: the reconfigure makes the http server listen on port + 1 ParamList params; - params.append(Param(mockDeviceAutoDeviceHttpportParamTypeId, currentPort + 1)); + params.append(Param(autoMockThingHttpportParamTypeId, currentPort + 1)); - ThingDescriptor deviceDescriptor(mockDeviceAutoThingClassId); + ThingDescriptor deviceDescriptor(autoMockThingClassId); deviceDescriptor.setTitle(device->name() + " (reconfigured)"); deviceDescriptor.setDescription("This auto device was reconfigured"); deviceDescriptor.setThingId(device->id()); @@ -847,11 +847,11 @@ void DevicePluginMock::generateDiscoveredDevices(ThingDiscoveryInfo *info) if (m_discoveredDeviceCount > 0) { ThingDescriptor d1(mockThingClassId, "Mock Device 1 (Discovered)", "55555"); ParamList params; - Param httpParam(mockDeviceHttpportParamTypeId, "55555"); + Param httpParam(mockThingHttpportParamTypeId, "55555"); params.append(httpParam); d1.setParams(params); foreach (Thing *d, myThings()) { - if (d->thingClassId() == mockThingClassId && d->paramValue(mockDeviceHttpportParamTypeId).toInt() == 55555) { + if (d->thingClassId() == mockThingClassId && d->paramValue(mockThingHttpportParamTypeId).toInt() == 55555) { d1.setThingId(d->id()); break; } @@ -862,11 +862,11 @@ void DevicePluginMock::generateDiscoveredDevices(ThingDiscoveryInfo *info) if (m_discoveredDeviceCount > 1) { ThingDescriptor d2(mockThingClassId, "Mock Device 2 (Discovered)", "55556"); ParamList params; - Param httpParam(mockDeviceHttpportParamTypeId, "55556"); + Param httpParam(mockThingHttpportParamTypeId, "55556"); params.append(httpParam); d2.setParams(params); foreach (Thing *d, myThings()) { - if (d->thingClassId() == mockThingClassId && d->paramValue(mockDeviceHttpportParamTypeId).toInt() == 55556) { + if (d->thingClassId() == mockThingClassId && d->paramValue(mockThingHttpportParamTypeId).toInt() == 55556) { d2.setThingId(d->id()); break; } @@ -880,23 +880,23 @@ void DevicePluginMock::generateDiscoveredDevices(ThingDiscoveryInfo *info) void DevicePluginMock::generateDiscoveredPushButtonDevices(ThingDiscoveryInfo *info) { if (m_discoveredDeviceCount > 0) { - ThingDescriptor d1(mockPushButtonThingClassId, "Mock Device (Push Button)", "1"); + ThingDescriptor d1(pushButtonMockThingClassId, "Mocked Thing (Push Button)", "1"); info->addThingDescriptor(d1); } if (m_discoveredDeviceCount > 1) { - ThingDescriptor d2(mockPushButtonThingClassId, "Mock Device (Push Button)", "2"); + ThingDescriptor d2(pushButtonMockThingClassId, "Mocked Thhing (Push Button)", "2"); info->addThingDescriptor(d2); } - info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("This device will simulate a push button press in 3 seconds.")); + info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("This thing will simulate a push button press in 3 seconds.")); } void DevicePluginMock::generateDiscoveredDisplayPinDevices(ThingDiscoveryInfo *info) { if (m_discoveredDeviceCount > 0) { - ThingDescriptor d1(mockDisplayPinThingClassId, "Mock Device (Display Pin)", "1"); + ThingDescriptor d1(displayPinMockThingClassId, "Mocked Thing (Display Pin)", "1"); foreach (Thing *existingDev, myThings()) { - if (existingDev->thingClassId() == mockDisplayPinThingClassId) { + if (existingDev->thingClassId() == displayPinMockThingClassId) { d1.setThingId(existingDev->id()); break; } @@ -905,10 +905,10 @@ void DevicePluginMock::generateDiscoveredDisplayPinDevices(ThingDiscoveryInfo *i } if (m_discoveredDeviceCount > 1) { - ThingDescriptor d2(mockDisplayPinThingClassId, "Mock Device (Display Pin)", "2"); + ThingDescriptor d2(displayPinMockThingClassId, "Mocked Thing (Display Pin)", "2"); int count = 0; foreach (Thing *existingDev, myThings()) { - if (existingDev->thingClassId() == mockDisplayPinThingClassId && ++count > 1) { + if (existingDev->thingClassId() == displayPinMockThingClassId && ++count > 1) { d2.setThingId(existingDev->id()); break; } @@ -921,7 +921,7 @@ void DevicePluginMock::generateDiscoveredDisplayPinDevices(ThingDiscoveryInfo *i void DevicePluginMock::onPushButtonPressed() { - qCDebug(dcMockDevice) << "PushButton pressed (automatically)"; + qCDebug(dcMock) << "PushButton pressed (automatically)"; m_pushbuttonPressed = true; } diff --git a/plugins/mock/devicepluginmock.json b/plugins/mock/devicepluginmock.json index 0952d93a..b590e091 100644 --- a/plugins/mock/devicepluginmock.json +++ b/plugins/mock/devicepluginmock.json @@ -1,6 +1,6 @@ { - "name": "mockDevice", - "displayName": "Mock Devices", + "name": "mock", + "displayName": "Mocked things", "id": "727a4a9a-c187-446f-aadf-f1b2220607d1", "paramTypes": [ { @@ -29,7 +29,7 @@ { "id": "753f0d32-0468-4d08-82ed-1964aab03298", "name": "mock", - "displayName": "Mock Device", + "displayName": "Mock Thing", "interfaces": ["system", "light", "battery"], "createMethods": ["user", "discovery"], "browsable": true, @@ -210,8 +210,8 @@ }, { "id": "ab4257b3-7548-47ee-9bd4-7dc3004fd197", - "name": "mockDeviceAuto", - "displayName": "Mock Device (Auto created)", + "name": "autoMock", + "displayName": "Mocked Thing (Auto created)", "interfaces": ["system"], "createMethods": ["auto"], "paramTypes": [ @@ -321,8 +321,8 @@ }, { "id": "9e03144c-e436-4eea-82d9-ccb33ef778db", - "name": "mockPushButton", - "displayName": "Mock Device (Push Button)", + "name": "pushButtonMock", + "displayName": "Mocked Thing (Push Button)", "interfaces": ["system"], "createMethods": ["discovery"], "setupMethod": "pushButton", @@ -410,8 +410,8 @@ }, { "id": "296f1fd4-e893-46b2-8a42-50d1bceb8730", - "name": "mockDisplayPin", - "displayName": "Mock Device (Display Pin)", + "name": "displayPinMock", + "displayName": "Mocked Thing (Display Pin)", "interfaces": ["system"], "createMethods": ["discovery"], "setupMethod": "displayPin", @@ -509,8 +509,8 @@ }, { "id": "a71fbde9-9a38-4bf8-beab-c8aade2608ba", - "name": "mockParent", - "displayName": "Mock Device (Parent)", + "name": "parentMock", + "displayName": "Mocked Thing (Parent)", "interfaces": ["system"], "createMethods": ["user", "discovery"], "paramTypes": [ ], @@ -529,8 +529,8 @@ }, { "id": "40893c9f-bc47-40c1-8bf7-b390c7c1b4fc", - "name": "mockChild", - "displayName": "Mock Device (Child)", + "name": "childMock", + "displayName": "Mocked Thing (Child)", "createMethods": ["auto", "discovery"], "paramTypes": [], "stateTypes": [ @@ -548,8 +548,8 @@ }, { "id": "515ffdf1-55e5-498d-9abc-4e2fe768f3a9", - "name": "mockInputType", - "displayName": "Mock Device (InputTypes)", + "name": "inputTypeMock", + "displayName": "Mocked Thing (InputTypes)", "createMethods": ["user"], "paramTypes": [ { @@ -850,22 +850,22 @@ }, { "id": "805d1692-7bd0-449a-9d5c-43a332ff58f4", - "name": "mockOAuthGoogle", - "displayName": "Mock Device (Google OAuth)", + "name": "oAuthGoogleMock", + "displayName": "Mocked Thing (Google OAuth)", "createMethods": ["user"], "setupMethod": "oauth" }, { "id": "783c615b-7bd6-49a4-98b0-8d1deb3c7156", - "name": "mockOAuthSonos", - "displayName": "Mock Device (Sonos OAuth)", + "name": "oAuthSonosMock", + "displayName": "Mocked Thing (Sonos OAuth)", "createMethods": ["user"], "setupMethod": "oauth" }, { "id": "6fe07a77-9c07-4736-81e2-d504314bbcb9", - "name": "mockUserAndPass", - "displayName": "Mock Device (User & Password)", + "name": "userAndPassMock", + "displayName": "Mocked Thing (User & Password)", "createMethods": ["discovery", "user"], "setupMethod": "userandpassword" } diff --git a/plugins/mock/extern-plugininfo.h b/plugins/mock/extern-plugininfo.h index 6a2293c2..79b79c29 100644 --- a/plugins/mock/extern-plugininfo.h +++ b/plugins/mock/extern-plugininfo.h @@ -8,16 +8,16 @@ #include -Q_DECLARE_LOGGING_CATEGORY(dcMockDevice) +Q_DECLARE_LOGGING_CATEGORY(dcMock) extern PluginId pluginId; -extern ParamTypeId mockDevicePluginConfigParamIntParamTypeId; -extern ParamTypeId mockDevicePluginConfigParamBoolParamTypeId; +extern ParamTypeId mockPluginConfigParamIntParamTypeId; +extern ParamTypeId mockPluginConfigParamBoolParamTypeId; extern VendorId nymeaVendorId; extern ThingClassId mockThingClassId; -extern ParamTypeId mockDeviceHttpportParamTypeId; -extern ParamTypeId mockDeviceAsyncParamTypeId; -extern ParamTypeId mockDeviceBrokenParamTypeId; +extern ParamTypeId mockThingHttpportParamTypeId; +extern ParamTypeId mockThingAsyncParamTypeId; +extern ParamTypeId mockThingBrokenParamTypeId; extern ParamTypeId mockSettingsSetting1ParamTypeId; extern ParamTypeId mockDiscoveryResultCountParamTypeId; extern StateTypeId mockIntStateTypeId; @@ -52,199 +52,199 @@ extern ActionTypeId mockFailingActionTypeId; extern ActionTypeId mockAsyncFailingActionTypeId; extern ActionTypeId mockAddToFavoritesBrowserItemActionTypeId; extern ActionTypeId mockRemoveFromFavoritesBrowserItemActionTypeId; -extern ThingClassId mockDeviceAutoThingClassId; -extern ParamTypeId mockDeviceAutoDeviceHttpportParamTypeId; -extern ParamTypeId mockDeviceAutoDeviceAsyncParamTypeId; -extern ParamTypeId mockDeviceAutoDeviceBrokenParamTypeId; -extern StateTypeId mockDeviceAutoIntStateTypeId; -extern StateTypeId mockDeviceAutoBoolValueStateTypeId; -extern EventTypeId mockDeviceAutoIntEventTypeId; -extern ParamTypeId mockDeviceAutoIntEventIntParamTypeId; -extern EventTypeId mockDeviceAutoBoolValueEventTypeId; -extern ParamTypeId mockDeviceAutoBoolValueEventBoolValueParamTypeId; -extern EventTypeId mockDeviceAutoEvent1EventTypeId; -extern EventTypeId mockDeviceAutoEvent2EventTypeId; -extern ParamTypeId mockDeviceAutoEvent2EventIntParamParamTypeId; -extern ActionTypeId mockDeviceAutoWithParamsActionTypeId; -extern ParamTypeId mockDeviceAutoWithParamsActionMockActionParam1ParamTypeId; -extern ParamTypeId mockDeviceAutoWithParamsActionMockActionParam2ParamTypeId; -extern ActionTypeId mockDeviceAutoMockActionNoParmsActionTypeId; -extern ActionTypeId mockDeviceAutoMockActionAsyncActionTypeId; -extern ActionTypeId mockDeviceAutoMockActionBrokenActionTypeId; -extern ActionTypeId mockDeviceAutoMockActionAsyncBrokenActionTypeId; -extern ThingClassId mockPushButtonThingClassId; -extern ParamTypeId mockPushButtonDiscoveryResultCountParamTypeId; -extern StateTypeId mockPushButtonColorStateTypeId; -extern StateTypeId mockPushButtonPercentageStateTypeId; -extern StateTypeId mockPushButtonAllowedValuesStateTypeId; -extern StateTypeId mockPushButtonDoubleStateTypeId; -extern StateTypeId mockPushButtonBoolStateTypeId; -extern EventTypeId mockPushButtonColorEventTypeId; -extern ParamTypeId mockPushButtonColorEventColorParamTypeId; -extern EventTypeId mockPushButtonPercentageEventTypeId; -extern ParamTypeId mockPushButtonPercentageEventPercentageParamTypeId; -extern EventTypeId mockPushButtonAllowedValuesEventTypeId; -extern ParamTypeId mockPushButtonAllowedValuesEventAllowedValuesParamTypeId; -extern EventTypeId mockPushButtonDoubleEventTypeId; -extern ParamTypeId mockPushButtonDoubleEventDoubleParamTypeId; -extern EventTypeId mockPushButtonBoolEventTypeId; -extern ParamTypeId mockPushButtonBoolEventBoolParamTypeId; -extern ActionTypeId mockPushButtonColorActionTypeId; -extern ParamTypeId mockPushButtonColorActionColorParamTypeId; -extern ActionTypeId mockPushButtonPercentageActionTypeId; -extern ParamTypeId mockPushButtonPercentageActionPercentageParamTypeId; -extern ActionTypeId mockPushButtonAllowedValuesActionTypeId; -extern ParamTypeId mockPushButtonAllowedValuesActionAllowedValuesParamTypeId; -extern ActionTypeId mockPushButtonDoubleActionTypeId; -extern ParamTypeId mockPushButtonDoubleActionDoubleParamTypeId; -extern ActionTypeId mockPushButtonBoolActionTypeId; -extern ParamTypeId mockPushButtonBoolActionBoolParamTypeId; -extern ActionTypeId mockPushButtonTimeoutActionTypeId; -extern ThingClassId mockDisplayPinThingClassId; -extern ParamTypeId mockDisplayPinDevicePinParamTypeId; -extern ParamTypeId mockDisplayPinDiscoveryResultCountParamTypeId; -extern StateTypeId mockDisplayPinColorStateTypeId; -extern StateTypeId mockDisplayPinPercentageStateTypeId; -extern StateTypeId mockDisplayPinAllowedValuesStateTypeId; -extern StateTypeId mockDisplayPinDoubleStateTypeId; -extern StateTypeId mockDisplayPinBoolStateTypeId; -extern EventTypeId mockDisplayPinColorEventTypeId; -extern ParamTypeId mockDisplayPinColorEventColorParamTypeId; -extern EventTypeId mockDisplayPinPercentageEventTypeId; -extern ParamTypeId mockDisplayPinPercentageEventPercentageParamTypeId; -extern EventTypeId mockDisplayPinAllowedValuesEventTypeId; -extern ParamTypeId mockDisplayPinAllowedValuesEventAllowedValuesParamTypeId; -extern EventTypeId mockDisplayPinDoubleEventTypeId; -extern ParamTypeId mockDisplayPinDoubleEventDoubleParamTypeId; -extern EventTypeId mockDisplayPinBoolEventTypeId; -extern ParamTypeId mockDisplayPinBoolEventBoolParamTypeId; -extern ActionTypeId mockDisplayPinColorActionTypeId; -extern ParamTypeId mockDisplayPinColorActionColorParamTypeId; -extern ActionTypeId mockDisplayPinPercentageActionTypeId; -extern ParamTypeId mockDisplayPinPercentageActionPercentageParamTypeId; -extern ActionTypeId mockDisplayPinAllowedValuesActionTypeId; -extern ParamTypeId mockDisplayPinAllowedValuesActionAllowedValuesParamTypeId; -extern ActionTypeId mockDisplayPinDoubleActionTypeId; -extern ParamTypeId mockDisplayPinDoubleActionDoubleParamTypeId; -extern ActionTypeId mockDisplayPinBoolActionTypeId; -extern ParamTypeId mockDisplayPinBoolActionBoolParamTypeId; -extern ActionTypeId mockDisplayPinTimeoutActionTypeId; -extern ThingClassId mockParentThingClassId; -extern StateTypeId mockParentBoolValueStateTypeId; -extern EventTypeId mockParentBoolValueEventTypeId; -extern ParamTypeId mockParentBoolValueEventBoolValueParamTypeId; -extern ActionTypeId mockParentBoolValueActionTypeId; -extern ParamTypeId mockParentBoolValueActionBoolValueParamTypeId; -extern ThingClassId mockChildThingClassId; -extern StateTypeId mockChildBoolValueStateTypeId; -extern EventTypeId mockChildBoolValueEventTypeId; -extern ParamTypeId mockChildBoolValueEventBoolValueParamTypeId; -extern ActionTypeId mockChildBoolValueActionTypeId; -extern ParamTypeId mockChildBoolValueActionBoolValueParamTypeId; -extern ThingClassId mockInputTypeThingClassId; -extern ParamTypeId mockInputTypeDeviceTextLineParamTypeId; -extern ParamTypeId mockInputTypeDeviceTextAreaParamTypeId; -extern ParamTypeId mockInputTypeDevicePasswordParamTypeId; -extern ParamTypeId mockInputTypeDeviceSearchParamTypeId; -extern ParamTypeId mockInputTypeDeviceMailParamTypeId; -extern ParamTypeId mockInputTypeDeviceIp4ParamTypeId; -extern ParamTypeId mockInputTypeDeviceIp6ParamTypeId; -extern ParamTypeId mockInputTypeDeviceUrlParamTypeId; -extern ParamTypeId mockInputTypeDeviceMacParamTypeId; -extern StateTypeId mockInputTypeBoolStateTypeId; -extern StateTypeId mockInputTypeWritableBoolStateTypeId; -extern StateTypeId mockInputTypeIntStateTypeId; -extern StateTypeId mockInputTypeWritableIntStateTypeId; -extern StateTypeId mockInputTypeWritableIntMinMaxStateTypeId; -extern StateTypeId mockInputTypeUintStateTypeId; -extern StateTypeId mockInputTypeWritableUIntStateTypeId; -extern StateTypeId mockInputTypeWritableUIntMinMaxStateTypeId; -extern StateTypeId mockInputTypeDoubleStateTypeId; -extern StateTypeId mockInputTypeWritableDoubleStateTypeId; -extern StateTypeId mockInputTypeWritableDoubleMinMaxStateTypeId; -extern StateTypeId mockInputTypeStringStateTypeId; -extern StateTypeId mockInputTypeWritableStringStateTypeId; -extern StateTypeId mockInputTypeWritableStringSelectionStateTypeId; -extern StateTypeId mockInputTypeColorStateTypeId; -extern StateTypeId mockInputTypeWritableColorStateTypeId; -extern StateTypeId mockInputTypeTimeStateTypeId; -extern StateTypeId mockInputTypeWritableTimeStateTypeId; -extern StateTypeId mockInputTypeTimestampIntStateTypeId; -extern StateTypeId mockInputTypeWritableTimestampIntStateTypeId; -extern StateTypeId mockInputTypeTimestampUIntStateTypeId; -extern StateTypeId mockInputTypeWritableTimestampUIntStateTypeId; -extern EventTypeId mockInputTypeBoolEventTypeId; -extern ParamTypeId mockInputTypeBoolEventBoolParamTypeId; -extern EventTypeId mockInputTypeWritableBoolEventTypeId; -extern ParamTypeId mockInputTypeWritableBoolEventWritableBoolParamTypeId; -extern EventTypeId mockInputTypeIntEventTypeId; -extern ParamTypeId mockInputTypeIntEventIntParamTypeId; -extern EventTypeId mockInputTypeWritableIntEventTypeId; -extern ParamTypeId mockInputTypeWritableIntEventWritableIntParamTypeId; -extern EventTypeId mockInputTypeWritableIntMinMaxEventTypeId; -extern ParamTypeId mockInputTypeWritableIntMinMaxEventWritableIntMinMaxParamTypeId; -extern EventTypeId mockInputTypeUintEventTypeId; -extern ParamTypeId mockInputTypeUintEventUintParamTypeId; -extern EventTypeId mockInputTypeWritableUIntEventTypeId; -extern ParamTypeId mockInputTypeWritableUIntEventWritableUIntParamTypeId; -extern EventTypeId mockInputTypeWritableUIntMinMaxEventTypeId; -extern ParamTypeId mockInputTypeWritableUIntMinMaxEventWritableUIntMinMaxParamTypeId; -extern EventTypeId mockInputTypeDoubleEventTypeId; -extern ParamTypeId mockInputTypeDoubleEventDoubleParamTypeId; -extern EventTypeId mockInputTypeWritableDoubleEventTypeId; -extern ParamTypeId mockInputTypeWritableDoubleEventWritableDoubleParamTypeId; -extern EventTypeId mockInputTypeWritableDoubleMinMaxEventTypeId; -extern ParamTypeId mockInputTypeWritableDoubleMinMaxEventWritableDoubleMinMaxParamTypeId; -extern EventTypeId mockInputTypeStringEventTypeId; -extern ParamTypeId mockInputTypeStringEventStringParamTypeId; -extern EventTypeId mockInputTypeWritableStringEventTypeId; -extern ParamTypeId mockInputTypeWritableStringEventWritableStringParamTypeId; -extern EventTypeId mockInputTypeWritableStringSelectionEventTypeId; -extern ParamTypeId mockInputTypeWritableStringSelectionEventWritableStringSelectionParamTypeId; -extern EventTypeId mockInputTypeColorEventTypeId; -extern ParamTypeId mockInputTypeColorEventColorParamTypeId; -extern EventTypeId mockInputTypeWritableColorEventTypeId; -extern ParamTypeId mockInputTypeWritableColorEventWritableColorParamTypeId; -extern EventTypeId mockInputTypeTimeEventTypeId; -extern ParamTypeId mockInputTypeTimeEventTimeParamTypeId; -extern EventTypeId mockInputTypeWritableTimeEventTypeId; -extern ParamTypeId mockInputTypeWritableTimeEventWritableTimeParamTypeId; -extern EventTypeId mockInputTypeTimestampIntEventTypeId; -extern ParamTypeId mockInputTypeTimestampIntEventTimestampIntParamTypeId; -extern EventTypeId mockInputTypeWritableTimestampIntEventTypeId; -extern ParamTypeId mockInputTypeWritableTimestampIntEventWritableTimestampIntParamTypeId; -extern EventTypeId mockInputTypeTimestampUIntEventTypeId; -extern ParamTypeId mockInputTypeTimestampUIntEventTimestampUIntParamTypeId; -extern EventTypeId mockInputTypeWritableTimestampUIntEventTypeId; -extern ParamTypeId mockInputTypeWritableTimestampUIntEventWritableTimestampUIntParamTypeId; -extern ActionTypeId mockInputTypeWritableBoolActionTypeId; -extern ParamTypeId mockInputTypeWritableBoolActionWritableBoolParamTypeId; -extern ActionTypeId mockInputTypeWritableIntActionTypeId; -extern ParamTypeId mockInputTypeWritableIntActionWritableIntParamTypeId; -extern ActionTypeId mockInputTypeWritableIntMinMaxActionTypeId; -extern ParamTypeId mockInputTypeWritableIntMinMaxActionWritableIntMinMaxParamTypeId; -extern ActionTypeId mockInputTypeWritableUIntActionTypeId; -extern ParamTypeId mockInputTypeWritableUIntActionWritableUIntParamTypeId; -extern ActionTypeId mockInputTypeWritableUIntMinMaxActionTypeId; -extern ParamTypeId mockInputTypeWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId; -extern ActionTypeId mockInputTypeWritableDoubleActionTypeId; -extern ParamTypeId mockInputTypeWritableDoubleActionWritableDoubleParamTypeId; -extern ActionTypeId mockInputTypeWritableDoubleMinMaxActionTypeId; -extern ParamTypeId mockInputTypeWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId; -extern ActionTypeId mockInputTypeWritableStringActionTypeId; -extern ParamTypeId mockInputTypeWritableStringActionWritableStringParamTypeId; -extern ActionTypeId mockInputTypeWritableStringSelectionActionTypeId; -extern ParamTypeId mockInputTypeWritableStringSelectionActionWritableStringSelectionParamTypeId; -extern ActionTypeId mockInputTypeWritableColorActionTypeId; -extern ParamTypeId mockInputTypeWritableColorActionWritableColorParamTypeId; -extern ActionTypeId mockInputTypeWritableTimeActionTypeId; -extern ParamTypeId mockInputTypeWritableTimeActionWritableTimeParamTypeId; -extern ActionTypeId mockInputTypeWritableTimestampIntActionTypeId; -extern ParamTypeId mockInputTypeWritableTimestampIntActionWritableTimestampIntParamTypeId; -extern ActionTypeId mockInputTypeWritableTimestampUIntActionTypeId; -extern ParamTypeId mockInputTypeWritableTimestampUIntActionWritableTimestampUIntParamTypeId; -extern ThingClassId mockOAuthGoogleThingClassId; -extern ThingClassId mockOAuthSonosThingClassId; -extern ThingClassId mockUserAndPassThingClassId; +extern ThingClassId autoMockThingClassId; +extern ParamTypeId autoMockThingHttpportParamTypeId; +extern ParamTypeId autoMockThingAsyncParamTypeId; +extern ParamTypeId autoMockThingBrokenParamTypeId; +extern StateTypeId autoMockIntStateTypeId; +extern StateTypeId autoMockBoolValueStateTypeId; +extern EventTypeId autoMockIntEventTypeId; +extern ParamTypeId autoMockIntEventIntParamTypeId; +extern EventTypeId autoMockBoolValueEventTypeId; +extern ParamTypeId autoMockBoolValueEventBoolValueParamTypeId; +extern EventTypeId autoMockEvent1EventTypeId; +extern EventTypeId autoMockEvent2EventTypeId; +extern ParamTypeId autoMockEvent2EventIntParamParamTypeId; +extern ActionTypeId autoMockWithParamsActionTypeId; +extern ParamTypeId autoMockWithParamsActionMockActionParam1ParamTypeId; +extern ParamTypeId autoMockWithParamsActionMockActionParam2ParamTypeId; +extern ActionTypeId autoMockMockActionNoParmsActionTypeId; +extern ActionTypeId autoMockMockActionAsyncActionTypeId; +extern ActionTypeId autoMockMockActionBrokenActionTypeId; +extern ActionTypeId autoMockMockActionAsyncBrokenActionTypeId; +extern ThingClassId pushButtonMockThingClassId; +extern ParamTypeId pushButtonMockDiscoveryResultCountParamTypeId; +extern StateTypeId pushButtonMockColorStateTypeId; +extern StateTypeId pushButtonMockPercentageStateTypeId; +extern StateTypeId pushButtonMockAllowedValuesStateTypeId; +extern StateTypeId pushButtonMockDoubleStateTypeId; +extern StateTypeId pushButtonMockBoolStateTypeId; +extern EventTypeId pushButtonMockColorEventTypeId; +extern ParamTypeId pushButtonMockColorEventColorParamTypeId; +extern EventTypeId pushButtonMockPercentageEventTypeId; +extern ParamTypeId pushButtonMockPercentageEventPercentageParamTypeId; +extern EventTypeId pushButtonMockAllowedValuesEventTypeId; +extern ParamTypeId pushButtonMockAllowedValuesEventAllowedValuesParamTypeId; +extern EventTypeId pushButtonMockDoubleEventTypeId; +extern ParamTypeId pushButtonMockDoubleEventDoubleParamTypeId; +extern EventTypeId pushButtonMockBoolEventTypeId; +extern ParamTypeId pushButtonMockBoolEventBoolParamTypeId; +extern ActionTypeId pushButtonMockColorActionTypeId; +extern ParamTypeId pushButtonMockColorActionColorParamTypeId; +extern ActionTypeId pushButtonMockPercentageActionTypeId; +extern ParamTypeId pushButtonMockPercentageActionPercentageParamTypeId; +extern ActionTypeId pushButtonMockAllowedValuesActionTypeId; +extern ParamTypeId pushButtonMockAllowedValuesActionAllowedValuesParamTypeId; +extern ActionTypeId pushButtonMockDoubleActionTypeId; +extern ParamTypeId pushButtonMockDoubleActionDoubleParamTypeId; +extern ActionTypeId pushButtonMockBoolActionTypeId; +extern ParamTypeId pushButtonMockBoolActionBoolParamTypeId; +extern ActionTypeId pushButtonMockTimeoutActionTypeId; +extern ThingClassId displayPinMockThingClassId; +extern ParamTypeId displayPinMockThingPinParamTypeId; +extern ParamTypeId displayPinMockDiscoveryResultCountParamTypeId; +extern StateTypeId displayPinMockColorStateTypeId; +extern StateTypeId displayPinMockPercentageStateTypeId; +extern StateTypeId displayPinMockAllowedValuesStateTypeId; +extern StateTypeId displayPinMockDoubleStateTypeId; +extern StateTypeId displayPinMockBoolStateTypeId; +extern EventTypeId displayPinMockColorEventTypeId; +extern ParamTypeId displayPinMockColorEventColorParamTypeId; +extern EventTypeId displayPinMockPercentageEventTypeId; +extern ParamTypeId displayPinMockPercentageEventPercentageParamTypeId; +extern EventTypeId displayPinMockAllowedValuesEventTypeId; +extern ParamTypeId displayPinMockAllowedValuesEventAllowedValuesParamTypeId; +extern EventTypeId displayPinMockDoubleEventTypeId; +extern ParamTypeId displayPinMockDoubleEventDoubleParamTypeId; +extern EventTypeId displayPinMockBoolEventTypeId; +extern ParamTypeId displayPinMockBoolEventBoolParamTypeId; +extern ActionTypeId displayPinMockColorActionTypeId; +extern ParamTypeId displayPinMockColorActionColorParamTypeId; +extern ActionTypeId displayPinMockPercentageActionTypeId; +extern ParamTypeId displayPinMockPercentageActionPercentageParamTypeId; +extern ActionTypeId displayPinMockAllowedValuesActionTypeId; +extern ParamTypeId displayPinMockAllowedValuesActionAllowedValuesParamTypeId; +extern ActionTypeId displayPinMockDoubleActionTypeId; +extern ParamTypeId displayPinMockDoubleActionDoubleParamTypeId; +extern ActionTypeId displayPinMockBoolActionTypeId; +extern ParamTypeId displayPinMockBoolActionBoolParamTypeId; +extern ActionTypeId displayPinMockTimeoutActionTypeId; +extern ThingClassId parentMockThingClassId; +extern StateTypeId parentMockBoolValueStateTypeId; +extern EventTypeId parentMockBoolValueEventTypeId; +extern ParamTypeId parentMockBoolValueEventBoolValueParamTypeId; +extern ActionTypeId parentMockBoolValueActionTypeId; +extern ParamTypeId parentMockBoolValueActionBoolValueParamTypeId; +extern ThingClassId childMockThingClassId; +extern StateTypeId childMockBoolValueStateTypeId; +extern EventTypeId childMockBoolValueEventTypeId; +extern ParamTypeId childMockBoolValueEventBoolValueParamTypeId; +extern ActionTypeId childMockBoolValueActionTypeId; +extern ParamTypeId childMockBoolValueActionBoolValueParamTypeId; +extern ThingClassId inputTypeMockThingClassId; +extern ParamTypeId inputTypeMockThingTextLineParamTypeId; +extern ParamTypeId inputTypeMockThingTextAreaParamTypeId; +extern ParamTypeId inputTypeMockThingPasswordParamTypeId; +extern ParamTypeId inputTypeMockThingSearchParamTypeId; +extern ParamTypeId inputTypeMockThingMailParamTypeId; +extern ParamTypeId inputTypeMockThingIp4ParamTypeId; +extern ParamTypeId inputTypeMockThingIp6ParamTypeId; +extern ParamTypeId inputTypeMockThingUrlParamTypeId; +extern ParamTypeId inputTypeMockThingMacParamTypeId; +extern StateTypeId inputTypeMockBoolStateTypeId; +extern StateTypeId inputTypeMockWritableBoolStateTypeId; +extern StateTypeId inputTypeMockIntStateTypeId; +extern StateTypeId inputTypeMockWritableIntStateTypeId; +extern StateTypeId inputTypeMockWritableIntMinMaxStateTypeId; +extern StateTypeId inputTypeMockUintStateTypeId; +extern StateTypeId inputTypeMockWritableUIntStateTypeId; +extern StateTypeId inputTypeMockWritableUIntMinMaxStateTypeId; +extern StateTypeId inputTypeMockDoubleStateTypeId; +extern StateTypeId inputTypeMockWritableDoubleStateTypeId; +extern StateTypeId inputTypeMockWritableDoubleMinMaxStateTypeId; +extern StateTypeId inputTypeMockStringStateTypeId; +extern StateTypeId inputTypeMockWritableStringStateTypeId; +extern StateTypeId inputTypeMockWritableStringSelectionStateTypeId; +extern StateTypeId inputTypeMockColorStateTypeId; +extern StateTypeId inputTypeMockWritableColorStateTypeId; +extern StateTypeId inputTypeMockTimeStateTypeId; +extern StateTypeId inputTypeMockWritableTimeStateTypeId; +extern StateTypeId inputTypeMockTimestampIntStateTypeId; +extern StateTypeId inputTypeMockWritableTimestampIntStateTypeId; +extern StateTypeId inputTypeMockTimestampUIntStateTypeId; +extern StateTypeId inputTypeMockWritableTimestampUIntStateTypeId; +extern EventTypeId inputTypeMockBoolEventTypeId; +extern ParamTypeId inputTypeMockBoolEventBoolParamTypeId; +extern EventTypeId inputTypeMockWritableBoolEventTypeId; +extern ParamTypeId inputTypeMockWritableBoolEventWritableBoolParamTypeId; +extern EventTypeId inputTypeMockIntEventTypeId; +extern ParamTypeId inputTypeMockIntEventIntParamTypeId; +extern EventTypeId inputTypeMockWritableIntEventTypeId; +extern ParamTypeId inputTypeMockWritableIntEventWritableIntParamTypeId; +extern EventTypeId inputTypeMockWritableIntMinMaxEventTypeId; +extern ParamTypeId inputTypeMockWritableIntMinMaxEventWritableIntMinMaxParamTypeId; +extern EventTypeId inputTypeMockUintEventTypeId; +extern ParamTypeId inputTypeMockUintEventUintParamTypeId; +extern EventTypeId inputTypeMockWritableUIntEventTypeId; +extern ParamTypeId inputTypeMockWritableUIntEventWritableUIntParamTypeId; +extern EventTypeId inputTypeMockWritableUIntMinMaxEventTypeId; +extern ParamTypeId inputTypeMockWritableUIntMinMaxEventWritableUIntMinMaxParamTypeId; +extern EventTypeId inputTypeMockDoubleEventTypeId; +extern ParamTypeId inputTypeMockDoubleEventDoubleParamTypeId; +extern EventTypeId inputTypeMockWritableDoubleEventTypeId; +extern ParamTypeId inputTypeMockWritableDoubleEventWritableDoubleParamTypeId; +extern EventTypeId inputTypeMockWritableDoubleMinMaxEventTypeId; +extern ParamTypeId inputTypeMockWritableDoubleMinMaxEventWritableDoubleMinMaxParamTypeId; +extern EventTypeId inputTypeMockStringEventTypeId; +extern ParamTypeId inputTypeMockStringEventStringParamTypeId; +extern EventTypeId inputTypeMockWritableStringEventTypeId; +extern ParamTypeId inputTypeMockWritableStringEventWritableStringParamTypeId; +extern EventTypeId inputTypeMockWritableStringSelectionEventTypeId; +extern ParamTypeId inputTypeMockWritableStringSelectionEventWritableStringSelectionParamTypeId; +extern EventTypeId inputTypeMockColorEventTypeId; +extern ParamTypeId inputTypeMockColorEventColorParamTypeId; +extern EventTypeId inputTypeMockWritableColorEventTypeId; +extern ParamTypeId inputTypeMockWritableColorEventWritableColorParamTypeId; +extern EventTypeId inputTypeMockTimeEventTypeId; +extern ParamTypeId inputTypeMockTimeEventTimeParamTypeId; +extern EventTypeId inputTypeMockWritableTimeEventTypeId; +extern ParamTypeId inputTypeMockWritableTimeEventWritableTimeParamTypeId; +extern EventTypeId inputTypeMockTimestampIntEventTypeId; +extern ParamTypeId inputTypeMockTimestampIntEventTimestampIntParamTypeId; +extern EventTypeId inputTypeMockWritableTimestampIntEventTypeId; +extern ParamTypeId inputTypeMockWritableTimestampIntEventWritableTimestampIntParamTypeId; +extern EventTypeId inputTypeMockTimestampUIntEventTypeId; +extern ParamTypeId inputTypeMockTimestampUIntEventTimestampUIntParamTypeId; +extern EventTypeId inputTypeMockWritableTimestampUIntEventTypeId; +extern ParamTypeId inputTypeMockWritableTimestampUIntEventWritableTimestampUIntParamTypeId; +extern ActionTypeId inputTypeMockWritableBoolActionTypeId; +extern ParamTypeId inputTypeMockWritableBoolActionWritableBoolParamTypeId; +extern ActionTypeId inputTypeMockWritableIntActionTypeId; +extern ParamTypeId inputTypeMockWritableIntActionWritableIntParamTypeId; +extern ActionTypeId inputTypeMockWritableIntMinMaxActionTypeId; +extern ParamTypeId inputTypeMockWritableIntMinMaxActionWritableIntMinMaxParamTypeId; +extern ActionTypeId inputTypeMockWritableUIntActionTypeId; +extern ParamTypeId inputTypeMockWritableUIntActionWritableUIntParamTypeId; +extern ActionTypeId inputTypeMockWritableUIntMinMaxActionTypeId; +extern ParamTypeId inputTypeMockWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId; +extern ActionTypeId inputTypeMockWritableDoubleActionTypeId; +extern ParamTypeId inputTypeMockWritableDoubleActionWritableDoubleParamTypeId; +extern ActionTypeId inputTypeMockWritableDoubleMinMaxActionTypeId; +extern ParamTypeId inputTypeMockWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId; +extern ActionTypeId inputTypeMockWritableStringActionTypeId; +extern ParamTypeId inputTypeMockWritableStringActionWritableStringParamTypeId; +extern ActionTypeId inputTypeMockWritableStringSelectionActionTypeId; +extern ParamTypeId inputTypeMockWritableStringSelectionActionWritableStringSelectionParamTypeId; +extern ActionTypeId inputTypeMockWritableColorActionTypeId; +extern ParamTypeId inputTypeMockWritableColorActionWritableColorParamTypeId; +extern ActionTypeId inputTypeMockWritableTimeActionTypeId; +extern ParamTypeId inputTypeMockWritableTimeActionWritableTimeParamTypeId; +extern ActionTypeId inputTypeMockWritableTimestampIntActionTypeId; +extern ParamTypeId inputTypeMockWritableTimestampIntActionWritableTimestampIntParamTypeId; +extern ActionTypeId inputTypeMockWritableTimestampUIntActionTypeId; +extern ParamTypeId inputTypeMockWritableTimestampUIntActionWritableTimestampUIntParamTypeId; +extern ThingClassId oAuthGoogleMockThingClassId; +extern ThingClassId oAuthSonosMockThingClassId; +extern ThingClassId userAndPassMockThingClassId; #endif // EXTERNPLUGININFO_H diff --git a/plugins/mock/httpdaemon.cpp b/plugins/mock/httpdaemon.cpp index 073cac33..ed2ea1f7 100644 --- a/plugins/mock/httpdaemon.cpp +++ b/plugins/mock/httpdaemon.cpp @@ -47,8 +47,8 @@ HttpDaemon::HttpDaemon(Thing *thing, IntegrationPlugin *parent): QTcpServer(parent), disabled(false), m_plugin(parent), m_thing(thing) { QHash portMap; - portMap.insert(mockThingClassId, mockDeviceHttpportParamTypeId); - portMap.insert(mockDeviceAutoThingClassId, mockDeviceAutoDeviceHttpportParamTypeId); + portMap.insert(mockThingClassId, mockThingHttpportParamTypeId); + portMap.insert(autoMockThingClassId, autoMockThingHttpportParamTypeId); listen(QHostAddress::Any, thing->paramValue(portMap.value(thing->thingClassId())).toInt()); } @@ -102,30 +102,30 @@ void HttpDaemon::readClient() } else if (stateTypeId == mockDoubleStateTypeId) { stateValue.convert(QVariant::Double); } - qCDebug(dcMockDevice) << "Set state value" << stateValue; + qCDebug(dcMock()) << "Set state value" << stateValue; emit setState(stateTypeId, stateValue); } else if (url.path() == "/generateevent") { emit triggerEvent(EventTypeId(query.queryItemValue("eventtypeid"))); } else if (url.path() == "/actionhistory") { - qCDebug(dcMockDevice) << "Get action history called"; + qCDebug(dcMock()) << "Get action history called"; QTextStream os(socket); os.setAutoDetectUnicode(true); os << generateHeader(); for (int i = 0; i < m_actionList.count(); ++i) { os << m_actionList.at(i).first.toString() << '\n'; - qCDebug(dcMockDevice) << " " << m_actionList.at(i).first.toString(); + qCDebug(dcMock()) << " " << m_actionList.at(i).first.toString(); } socket->close(); return; } else if (url.path() == "/clearactionhistory") { - qCDebug(dcMockDevice) << "Clear action history"; + qCDebug(dcMock()) << "Clear action history"; m_actionList.clear(); } else if (url.path() == "/disappear") { - qCDebug(dcMockDevice) << "Should disappear"; + qCDebug(dcMock()) << "Should disappear"; emit disappear(); } else if (url.path() == "/reconfigureautodevice") { - qCDebug(dcMockDevice) << "Reconfigure auto device"; + qCDebug(dcMock()) << "Reconfigure auto device"; emit reconfigureAutodevice(); } diff --git a/plugins/mock/plugininfo.h b/plugins/mock/plugininfo.h index 1f166479..5bf42599 100644 --- a/plugins/mock/plugininfo.h +++ b/plugins/mock/plugininfo.h @@ -11,17 +11,17 @@ extern "C" const QString libnymea_api_version() { return QString("5.0.0");} -Q_DECLARE_LOGGING_CATEGORY(dcMockDevice) -Q_LOGGING_CATEGORY(dcMockDevice, "MockDevice") +Q_DECLARE_LOGGING_CATEGORY(dcMock) +Q_LOGGING_CATEGORY(dcMock, "Mock") PluginId pluginId = PluginId("{727a4a9a-c187-446f-aadf-f1b2220607d1}"); -ParamTypeId mockDevicePluginConfigParamIntParamTypeId = ParamTypeId("{e1f72121-a426-45e2-b475-8262b5cdf103}"); -ParamTypeId mockDevicePluginConfigParamBoolParamTypeId = ParamTypeId("{c75723b6-ea4f-4982-9751-6c5e39c88145}"); +ParamTypeId mockPluginConfigParamIntParamTypeId = ParamTypeId("{e1f72121-a426-45e2-b475-8262b5cdf103}"); +ParamTypeId mockPluginConfigParamBoolParamTypeId = ParamTypeId("{c75723b6-ea4f-4982-9751-6c5e39c88145}"); VendorId nymeaVendorId = VendorId("{2062d64d-3232-433c-88bc-0d33c0ba2ba6}"); ThingClassId mockThingClassId = ThingClassId("{753f0d32-0468-4d08-82ed-1964aab03298}"); -ParamTypeId mockDeviceHttpportParamTypeId = ParamTypeId("{d4f06047-125e-4479-9810-b54c189917f5}"); -ParamTypeId mockDeviceAsyncParamTypeId = ParamTypeId("{f2977061-4dd0-4ef5-85aa-3b7134743be3}"); -ParamTypeId mockDeviceBrokenParamTypeId = ParamTypeId("{ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4}"); +ParamTypeId mockThingHttpportParamTypeId = ParamTypeId("{d4f06047-125e-4479-9810-b54c189917f5}"); +ParamTypeId mockThingAsyncParamTypeId = ParamTypeId("{f2977061-4dd0-4ef5-85aa-3b7134743be3}"); +ParamTypeId mockThingBrokenParamTypeId = ParamTypeId("{ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4}"); ParamTypeId mockSettingsSetting1ParamTypeId = ParamTypeId("{367f7ba4-5039-47be-abd8-59cc8eaf4b9a}"); ParamTypeId mockDiscoveryResultCountParamTypeId = ParamTypeId("{d222adb4-2f9c-4c3f-8655-76400d0fb6ce}"); StateTypeId mockIntStateTypeId = StateTypeId("{80baec19-54de-4948-ac46-31eabfaceb83}"); @@ -56,909 +56,909 @@ ActionTypeId mockFailingActionTypeId = ActionTypeId("{df3cf33d-26d5-4577-9132-98 ActionTypeId mockAsyncFailingActionTypeId = ActionTypeId("{bfe89a1d-3497-4121-8318-e77c37537219}"); ActionTypeId mockAddToFavoritesBrowserItemActionTypeId = ActionTypeId("{00b8f0a8-99ca-4aa4-833d-59eb8d4d6de3}"); ActionTypeId mockRemoveFromFavoritesBrowserItemActionTypeId = ActionTypeId("{da6faef8-2816-430e-93bb-57e8f9582d29}"); -ThingClassId mockDeviceAutoThingClassId = ThingClassId("{ab4257b3-7548-47ee-9bd4-7dc3004fd197}"); -ParamTypeId mockDeviceAutoDeviceHttpportParamTypeId = ParamTypeId("{bfeb0613-dab6-408c-aa27-c362c921d0d1}"); -ParamTypeId mockDeviceAutoDeviceAsyncParamTypeId = ParamTypeId("{a5c4315f-0624-4971-87c1-4bbfbfdbd16e}"); -ParamTypeId mockDeviceAutoDeviceBrokenParamTypeId = ParamTypeId("{66179395-ef7a-4013-9fc6-2084104eea09}"); -StateTypeId mockDeviceAutoIntStateTypeId = StateTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); -StateTypeId mockDeviceAutoBoolValueStateTypeId = StateTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); -EventTypeId mockDeviceAutoIntEventTypeId = EventTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); -ParamTypeId mockDeviceAutoIntEventIntParamTypeId = ParamTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); -EventTypeId mockDeviceAutoBoolValueEventTypeId = EventTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); -ParamTypeId mockDeviceAutoBoolValueEventBoolValueParamTypeId = ParamTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); -EventTypeId mockDeviceAutoEvent1EventTypeId = EventTypeId("{00f81fca-26f1-4a84-aa2b-4c6a3d953ec6}"); -EventTypeId mockDeviceAutoEvent2EventTypeId = EventTypeId("{6e27922d-aa9d-44d1-b9b4-9faf31b6bd97}"); -ParamTypeId mockDeviceAutoEvent2EventIntParamParamTypeId = ParamTypeId("{12ed5a15-96b4-4381-9d9c-a24875283d4f}"); -ActionTypeId mockDeviceAutoWithParamsActionTypeId = ActionTypeId("{07cd8d5f-2f65-4955-b1f9-05d7f4da488a}"); -ParamTypeId mockDeviceAutoWithParamsActionMockActionParam1ParamTypeId = ParamTypeId("{b8126ba6-3a54-45a3-be4d-63feb0ddb77b}"); -ParamTypeId mockDeviceAutoWithParamsActionMockActionParam2ParamTypeId = ParamTypeId("{df41ba71-e43b-4854-91d1-b19d8066d4f9}"); -ActionTypeId mockDeviceAutoMockActionNoParmsActionTypeId = ActionTypeId("{ef518d53-50e2-4ca5-a4b1-e9a8b9309d44}"); -ActionTypeId mockDeviceAutoMockActionAsyncActionTypeId = ActionTypeId("{5f27a9f2-59cd-4a15-98bd-6ed6e10bc6ed}"); -ActionTypeId mockDeviceAutoMockActionBrokenActionTypeId = ActionTypeId("{58a61de4-472c-4775-8fe8-583a9c83fcf1}"); -ActionTypeId mockDeviceAutoMockActionAsyncBrokenActionTypeId = ActionTypeId("{17ad52dd-ef2f-4947-9b73-5bf6e172a9d0}"); -ThingClassId mockPushButtonThingClassId = ThingClassId("{9e03144c-e436-4eea-82d9-ccb33ef778db}"); -ParamTypeId mockPushButtonDiscoveryResultCountParamTypeId = ParamTypeId("{c40dbc59-4bba-4871-9b8e-bbd8d5d9193b}"); -StateTypeId mockPushButtonColorStateTypeId = StateTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); -StateTypeId mockPushButtonPercentageStateTypeId = StateTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); -StateTypeId mockPushButtonAllowedValuesStateTypeId = StateTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); -StateTypeId mockPushButtonDoubleStateTypeId = StateTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); -StateTypeId mockPushButtonBoolStateTypeId = StateTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); -EventTypeId mockPushButtonColorEventTypeId = EventTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); -ParamTypeId mockPushButtonColorEventColorParamTypeId = ParamTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); -EventTypeId mockPushButtonPercentageEventTypeId = EventTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); -ParamTypeId mockPushButtonPercentageEventPercentageParamTypeId = ParamTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); -EventTypeId mockPushButtonAllowedValuesEventTypeId = EventTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); -ParamTypeId mockPushButtonAllowedValuesEventAllowedValuesParamTypeId = ParamTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); -EventTypeId mockPushButtonDoubleEventTypeId = EventTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); -ParamTypeId mockPushButtonDoubleEventDoubleParamTypeId = ParamTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); -EventTypeId mockPushButtonBoolEventTypeId = EventTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); -ParamTypeId mockPushButtonBoolEventBoolParamTypeId = ParamTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); -ActionTypeId mockPushButtonColorActionTypeId = ActionTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); -ParamTypeId mockPushButtonColorActionColorParamTypeId = ParamTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); -ActionTypeId mockPushButtonPercentageActionTypeId = ActionTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); -ParamTypeId mockPushButtonPercentageActionPercentageParamTypeId = ParamTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); -ActionTypeId mockPushButtonAllowedValuesActionTypeId = ActionTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); -ParamTypeId mockPushButtonAllowedValuesActionAllowedValuesParamTypeId = ParamTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); -ActionTypeId mockPushButtonDoubleActionTypeId = ActionTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); -ParamTypeId mockPushButtonDoubleActionDoubleParamTypeId = ParamTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); -ActionTypeId mockPushButtonBoolActionTypeId = ActionTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); -ParamTypeId mockPushButtonBoolActionBoolParamTypeId = ParamTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); -ActionTypeId mockPushButtonTimeoutActionTypeId = ActionTypeId("{54646e7c-bc54-4895-81a2-590d72d120f9}"); -ThingClassId mockDisplayPinThingClassId = ThingClassId("{296f1fd4-e893-46b2-8a42-50d1bceb8730}"); -ParamTypeId mockDisplayPinDevicePinParamTypeId = ParamTypeId("{da820e07-22dc-4173-9c07-2f49a4e265f9}"); -ParamTypeId mockDisplayPinDiscoveryResultCountParamTypeId = ParamTypeId("{35f6e4ba-28ad-4152-a58d-ec2600667bcf}"); -StateTypeId mockDisplayPinColorStateTypeId = StateTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); -StateTypeId mockDisplayPinPercentageStateTypeId = StateTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); -StateTypeId mockDisplayPinAllowedValuesStateTypeId = StateTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); -StateTypeId mockDisplayPinDoubleStateTypeId = StateTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); -StateTypeId mockDisplayPinBoolStateTypeId = StateTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); -EventTypeId mockDisplayPinColorEventTypeId = EventTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); -ParamTypeId mockDisplayPinColorEventColorParamTypeId = ParamTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); -EventTypeId mockDisplayPinPercentageEventTypeId = EventTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); -ParamTypeId mockDisplayPinPercentageEventPercentageParamTypeId = ParamTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); -EventTypeId mockDisplayPinAllowedValuesEventTypeId = EventTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); -ParamTypeId mockDisplayPinAllowedValuesEventAllowedValuesParamTypeId = ParamTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); -EventTypeId mockDisplayPinDoubleEventTypeId = EventTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); -ParamTypeId mockDisplayPinDoubleEventDoubleParamTypeId = ParamTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); -EventTypeId mockDisplayPinBoolEventTypeId = EventTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); -ParamTypeId mockDisplayPinBoolEventBoolParamTypeId = ParamTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); -ActionTypeId mockDisplayPinColorActionTypeId = ActionTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); -ParamTypeId mockDisplayPinColorActionColorParamTypeId = ParamTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); -ActionTypeId mockDisplayPinPercentageActionTypeId = ActionTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); -ParamTypeId mockDisplayPinPercentageActionPercentageParamTypeId = ParamTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); -ActionTypeId mockDisplayPinAllowedValuesActionTypeId = ActionTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); -ParamTypeId mockDisplayPinAllowedValuesActionAllowedValuesParamTypeId = ParamTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); -ActionTypeId mockDisplayPinDoubleActionTypeId = ActionTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); -ParamTypeId mockDisplayPinDoubleActionDoubleParamTypeId = ParamTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); -ActionTypeId mockDisplayPinBoolActionTypeId = ActionTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); -ParamTypeId mockDisplayPinBoolActionBoolParamTypeId = ParamTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); -ActionTypeId mockDisplayPinTimeoutActionTypeId = ActionTypeId("{854a0a4a-803f-4b7f-9dce-b07794f9011b}"); -ThingClassId mockParentThingClassId = ThingClassId("{a71fbde9-9a38-4bf8-beab-c8aade2608ba}"); -StateTypeId mockParentBoolValueStateTypeId = StateTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); -EventTypeId mockParentBoolValueEventTypeId = EventTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); -ParamTypeId mockParentBoolValueEventBoolValueParamTypeId = ParamTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); -ActionTypeId mockParentBoolValueActionTypeId = ActionTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); -ParamTypeId mockParentBoolValueActionBoolValueParamTypeId = ParamTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); -ThingClassId mockChildThingClassId = ThingClassId("{40893c9f-bc47-40c1-8bf7-b390c7c1b4fc}"); -StateTypeId mockChildBoolValueStateTypeId = StateTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); -EventTypeId mockChildBoolValueEventTypeId = EventTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); -ParamTypeId mockChildBoolValueEventBoolValueParamTypeId = ParamTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); -ActionTypeId mockChildBoolValueActionTypeId = ActionTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); -ParamTypeId mockChildBoolValueActionBoolValueParamTypeId = ParamTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); -ThingClassId mockInputTypeThingClassId = ThingClassId("{515ffdf1-55e5-498d-9abc-4e2fe768f3a9}"); -ParamTypeId mockInputTypeDeviceTextLineParamTypeId = ParamTypeId("{e6acf0c7-4b8e-4296-ac62-855d20deb816}"); -ParamTypeId mockInputTypeDeviceTextAreaParamTypeId = ParamTypeId("{716f0994-bc01-42b0-b64d-59236f7320d2}"); -ParamTypeId mockInputTypeDevicePasswordParamTypeId = ParamTypeId("{e5c0d14b-c9f1-4aca-a56e-85bfa6977150}"); -ParamTypeId mockInputTypeDeviceSearchParamTypeId = ParamTypeId("{22add8c9-ee4f-43ad-8931-58e999313ac3}"); -ParamTypeId mockInputTypeDeviceMailParamTypeId = ParamTypeId("{a8494faf-3a0f-4cf3-84b7-4b39148a838d}"); -ParamTypeId mockInputTypeDeviceIp4ParamTypeId = ParamTypeId("{9e5f86a0-4bb3-4892-bff8-3fc4032af6e2}"); -ParamTypeId mockInputTypeDeviceIp6ParamTypeId = ParamTypeId("{43bf3832-dd48-4090-a836-656e8b60216e}"); -ParamTypeId mockInputTypeDeviceUrlParamTypeId = ParamTypeId("{fa67229f-fcef-496f-b671-59a4b48f3ab5}"); -ParamTypeId mockInputTypeDeviceMacParamTypeId = ParamTypeId("{e93db587-7919-48f3-8c88-1651de63c765}"); -StateTypeId mockInputTypeBoolStateTypeId = StateTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); -StateTypeId mockInputTypeWritableBoolStateTypeId = StateTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); -StateTypeId mockInputTypeIntStateTypeId = StateTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); -StateTypeId mockInputTypeWritableIntStateTypeId = StateTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); -StateTypeId mockInputTypeWritableIntMinMaxStateTypeId = StateTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); -StateTypeId mockInputTypeUintStateTypeId = StateTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); -StateTypeId mockInputTypeWritableUIntStateTypeId = StateTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); -StateTypeId mockInputTypeWritableUIntMinMaxStateTypeId = StateTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); -StateTypeId mockInputTypeDoubleStateTypeId = StateTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); -StateTypeId mockInputTypeWritableDoubleStateTypeId = StateTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); -StateTypeId mockInputTypeWritableDoubleMinMaxStateTypeId = StateTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); -StateTypeId mockInputTypeStringStateTypeId = StateTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); -StateTypeId mockInputTypeWritableStringStateTypeId = StateTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); -StateTypeId mockInputTypeWritableStringSelectionStateTypeId = StateTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); -StateTypeId mockInputTypeColorStateTypeId = StateTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); -StateTypeId mockInputTypeWritableColorStateTypeId = StateTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); -StateTypeId mockInputTypeTimeStateTypeId = StateTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); -StateTypeId mockInputTypeWritableTimeStateTypeId = StateTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); -StateTypeId mockInputTypeTimestampIntStateTypeId = StateTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); -StateTypeId mockInputTypeWritableTimestampIntStateTypeId = StateTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); -StateTypeId mockInputTypeTimestampUIntStateTypeId = StateTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); -StateTypeId mockInputTypeWritableTimestampUIntStateTypeId = StateTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); -EventTypeId mockInputTypeBoolEventTypeId = EventTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); -ParamTypeId mockInputTypeBoolEventBoolParamTypeId = ParamTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); -EventTypeId mockInputTypeWritableBoolEventTypeId = EventTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); -ParamTypeId mockInputTypeWritableBoolEventWritableBoolParamTypeId = ParamTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); -EventTypeId mockInputTypeIntEventTypeId = EventTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); -ParamTypeId mockInputTypeIntEventIntParamTypeId = ParamTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); -EventTypeId mockInputTypeWritableIntEventTypeId = EventTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); -ParamTypeId mockInputTypeWritableIntEventWritableIntParamTypeId = ParamTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); -EventTypeId mockInputTypeWritableIntMinMaxEventTypeId = EventTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); -ParamTypeId mockInputTypeWritableIntMinMaxEventWritableIntMinMaxParamTypeId = ParamTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); -EventTypeId mockInputTypeUintEventTypeId = EventTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); -ParamTypeId mockInputTypeUintEventUintParamTypeId = ParamTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); -EventTypeId mockInputTypeWritableUIntEventTypeId = EventTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); -ParamTypeId mockInputTypeWritableUIntEventWritableUIntParamTypeId = ParamTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); -EventTypeId mockInputTypeWritableUIntMinMaxEventTypeId = EventTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); -ParamTypeId mockInputTypeWritableUIntMinMaxEventWritableUIntMinMaxParamTypeId = ParamTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); -EventTypeId mockInputTypeDoubleEventTypeId = EventTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); -ParamTypeId mockInputTypeDoubleEventDoubleParamTypeId = ParamTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); -EventTypeId mockInputTypeWritableDoubleEventTypeId = EventTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); -ParamTypeId mockInputTypeWritableDoubleEventWritableDoubleParamTypeId = ParamTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); -EventTypeId mockInputTypeWritableDoubleMinMaxEventTypeId = EventTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); -ParamTypeId mockInputTypeWritableDoubleMinMaxEventWritableDoubleMinMaxParamTypeId = ParamTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); -EventTypeId mockInputTypeStringEventTypeId = EventTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); -ParamTypeId mockInputTypeStringEventStringParamTypeId = ParamTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); -EventTypeId mockInputTypeWritableStringEventTypeId = EventTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); -ParamTypeId mockInputTypeWritableStringEventWritableStringParamTypeId = ParamTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); -EventTypeId mockInputTypeWritableStringSelectionEventTypeId = EventTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); -ParamTypeId mockInputTypeWritableStringSelectionEventWritableStringSelectionParamTypeId = ParamTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); -EventTypeId mockInputTypeColorEventTypeId = EventTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); -ParamTypeId mockInputTypeColorEventColorParamTypeId = ParamTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); -EventTypeId mockInputTypeWritableColorEventTypeId = EventTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); -ParamTypeId mockInputTypeWritableColorEventWritableColorParamTypeId = ParamTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); -EventTypeId mockInputTypeTimeEventTypeId = EventTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); -ParamTypeId mockInputTypeTimeEventTimeParamTypeId = ParamTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); -EventTypeId mockInputTypeWritableTimeEventTypeId = EventTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); -ParamTypeId mockInputTypeWritableTimeEventWritableTimeParamTypeId = ParamTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); -EventTypeId mockInputTypeTimestampIntEventTypeId = EventTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); -ParamTypeId mockInputTypeTimestampIntEventTimestampIntParamTypeId = ParamTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); -EventTypeId mockInputTypeWritableTimestampIntEventTypeId = EventTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); -ParamTypeId mockInputTypeWritableTimestampIntEventWritableTimestampIntParamTypeId = ParamTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); -EventTypeId mockInputTypeTimestampUIntEventTypeId = EventTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); -ParamTypeId mockInputTypeTimestampUIntEventTimestampUIntParamTypeId = ParamTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); -EventTypeId mockInputTypeWritableTimestampUIntEventTypeId = EventTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); -ParamTypeId mockInputTypeWritableTimestampUIntEventWritableTimestampUIntParamTypeId = ParamTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); -ActionTypeId mockInputTypeWritableBoolActionTypeId = ActionTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); -ParamTypeId mockInputTypeWritableBoolActionWritableBoolParamTypeId = ParamTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); -ActionTypeId mockInputTypeWritableIntActionTypeId = ActionTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); -ParamTypeId mockInputTypeWritableIntActionWritableIntParamTypeId = ParamTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); -ActionTypeId mockInputTypeWritableIntMinMaxActionTypeId = ActionTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); -ParamTypeId mockInputTypeWritableIntMinMaxActionWritableIntMinMaxParamTypeId = ParamTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); -ActionTypeId mockInputTypeWritableUIntActionTypeId = ActionTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); -ParamTypeId mockInputTypeWritableUIntActionWritableUIntParamTypeId = ParamTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); -ActionTypeId mockInputTypeWritableUIntMinMaxActionTypeId = ActionTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); -ParamTypeId mockInputTypeWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId = ParamTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); -ActionTypeId mockInputTypeWritableDoubleActionTypeId = ActionTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); -ParamTypeId mockInputTypeWritableDoubleActionWritableDoubleParamTypeId = ParamTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); -ActionTypeId mockInputTypeWritableDoubleMinMaxActionTypeId = ActionTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); -ParamTypeId mockInputTypeWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId = ParamTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); -ActionTypeId mockInputTypeWritableStringActionTypeId = ActionTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); -ParamTypeId mockInputTypeWritableStringActionWritableStringParamTypeId = ParamTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); -ActionTypeId mockInputTypeWritableStringSelectionActionTypeId = ActionTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); -ParamTypeId mockInputTypeWritableStringSelectionActionWritableStringSelectionParamTypeId = ParamTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); -ActionTypeId mockInputTypeWritableColorActionTypeId = ActionTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); -ParamTypeId mockInputTypeWritableColorActionWritableColorParamTypeId = ParamTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); -ActionTypeId mockInputTypeWritableTimeActionTypeId = ActionTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); -ParamTypeId mockInputTypeWritableTimeActionWritableTimeParamTypeId = ParamTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); -ActionTypeId mockInputTypeWritableTimestampIntActionTypeId = ActionTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); -ParamTypeId mockInputTypeWritableTimestampIntActionWritableTimestampIntParamTypeId = ParamTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); -ActionTypeId mockInputTypeWritableTimestampUIntActionTypeId = ActionTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); -ParamTypeId mockInputTypeWritableTimestampUIntActionWritableTimestampUIntParamTypeId = ParamTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); -ThingClassId mockOAuthGoogleThingClassId = ThingClassId("{805d1692-7bd0-449a-9d5c-43a332ff58f4}"); -ThingClassId mockOAuthSonosThingClassId = ThingClassId("{783c615b-7bd6-49a4-98b0-8d1deb3c7156}"); -ThingClassId mockUserAndPassThingClassId = ThingClassId("{6fe07a77-9c07-4736-81e2-d504314bbcb9}"); +ThingClassId autoMockThingClassId = ThingClassId("{ab4257b3-7548-47ee-9bd4-7dc3004fd197}"); +ParamTypeId autoMockThingHttpportParamTypeId = ParamTypeId("{bfeb0613-dab6-408c-aa27-c362c921d0d1}"); +ParamTypeId autoMockThingAsyncParamTypeId = ParamTypeId("{a5c4315f-0624-4971-87c1-4bbfbfdbd16e}"); +ParamTypeId autoMockThingBrokenParamTypeId = ParamTypeId("{66179395-ef7a-4013-9fc6-2084104eea09}"); +StateTypeId autoMockIntStateTypeId = StateTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); +StateTypeId autoMockBoolValueStateTypeId = StateTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); +EventTypeId autoMockIntEventTypeId = EventTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); +ParamTypeId autoMockIntEventIntParamTypeId = ParamTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); +EventTypeId autoMockBoolValueEventTypeId = EventTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); +ParamTypeId autoMockBoolValueEventBoolValueParamTypeId = ParamTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); +EventTypeId autoMockEvent1EventTypeId = EventTypeId("{00f81fca-26f1-4a84-aa2b-4c6a3d953ec6}"); +EventTypeId autoMockEvent2EventTypeId = EventTypeId("{6e27922d-aa9d-44d1-b9b4-9faf31b6bd97}"); +ParamTypeId autoMockEvent2EventIntParamParamTypeId = ParamTypeId("{12ed5a15-96b4-4381-9d9c-a24875283d4f}"); +ActionTypeId autoMockWithParamsActionTypeId = ActionTypeId("{07cd8d5f-2f65-4955-b1f9-05d7f4da488a}"); +ParamTypeId autoMockWithParamsActionMockActionParam1ParamTypeId = ParamTypeId("{b8126ba6-3a54-45a3-be4d-63feb0ddb77b}"); +ParamTypeId autoMockWithParamsActionMockActionParam2ParamTypeId = ParamTypeId("{df41ba71-e43b-4854-91d1-b19d8066d4f9}"); +ActionTypeId autoMockMockActionNoParmsActionTypeId = ActionTypeId("{ef518d53-50e2-4ca5-a4b1-e9a8b9309d44}"); +ActionTypeId autoMockMockActionAsyncActionTypeId = ActionTypeId("{5f27a9f2-59cd-4a15-98bd-6ed6e10bc6ed}"); +ActionTypeId autoMockMockActionBrokenActionTypeId = ActionTypeId("{58a61de4-472c-4775-8fe8-583a9c83fcf1}"); +ActionTypeId autoMockMockActionAsyncBrokenActionTypeId = ActionTypeId("{17ad52dd-ef2f-4947-9b73-5bf6e172a9d0}"); +ThingClassId pushButtonMockThingClassId = ThingClassId("{9e03144c-e436-4eea-82d9-ccb33ef778db}"); +ParamTypeId pushButtonMockDiscoveryResultCountParamTypeId = ParamTypeId("{c40dbc59-4bba-4871-9b8e-bbd8d5d9193b}"); +StateTypeId pushButtonMockColorStateTypeId = StateTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); +StateTypeId pushButtonMockPercentageStateTypeId = StateTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); +StateTypeId pushButtonMockAllowedValuesStateTypeId = StateTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); +StateTypeId pushButtonMockDoubleStateTypeId = StateTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); +StateTypeId pushButtonMockBoolStateTypeId = StateTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); +EventTypeId pushButtonMockColorEventTypeId = EventTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); +ParamTypeId pushButtonMockColorEventColorParamTypeId = ParamTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); +EventTypeId pushButtonMockPercentageEventTypeId = EventTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); +ParamTypeId pushButtonMockPercentageEventPercentageParamTypeId = ParamTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); +EventTypeId pushButtonMockAllowedValuesEventTypeId = EventTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); +ParamTypeId pushButtonMockAllowedValuesEventAllowedValuesParamTypeId = ParamTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); +EventTypeId pushButtonMockDoubleEventTypeId = EventTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); +ParamTypeId pushButtonMockDoubleEventDoubleParamTypeId = ParamTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); +EventTypeId pushButtonMockBoolEventTypeId = EventTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); +ParamTypeId pushButtonMockBoolEventBoolParamTypeId = ParamTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); +ActionTypeId pushButtonMockColorActionTypeId = ActionTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); +ParamTypeId pushButtonMockColorActionColorParamTypeId = ParamTypeId("{20dc7c22-c50e-42db-837c-2bbced939f8e}"); +ActionTypeId pushButtonMockPercentageActionTypeId = ActionTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); +ParamTypeId pushButtonMockPercentageActionPercentageParamTypeId = ParamTypeId("{72981c04-267a-4ba0-a59e-9921d2f3af9c}"); +ActionTypeId pushButtonMockAllowedValuesActionTypeId = ActionTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); +ParamTypeId pushButtonMockAllowedValuesActionAllowedValuesParamTypeId = ParamTypeId("{05f63f9c-f61e-4dcf-ad55-3f13fde2765b}"); +ActionTypeId pushButtonMockDoubleActionTypeId = ActionTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); +ParamTypeId pushButtonMockDoubleActionDoubleParamTypeId = ParamTypeId("{53cd7c55-49b7-441b-b970-9048f20f0e2c}"); +ActionTypeId pushButtonMockBoolActionTypeId = ActionTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); +ParamTypeId pushButtonMockBoolActionBoolParamTypeId = ParamTypeId("{e680f7a4-b39e-46da-be41-fa3170fe3768}"); +ActionTypeId pushButtonMockTimeoutActionTypeId = ActionTypeId("{54646e7c-bc54-4895-81a2-590d72d120f9}"); +ThingClassId displayPinMockThingClassId = ThingClassId("{296f1fd4-e893-46b2-8a42-50d1bceb8730}"); +ParamTypeId displayPinMockThingPinParamTypeId = ParamTypeId("{da820e07-22dc-4173-9c07-2f49a4e265f9}"); +ParamTypeId displayPinMockDiscoveryResultCountParamTypeId = ParamTypeId("{35f6e4ba-28ad-4152-a58d-ec2600667bcf}"); +StateTypeId displayPinMockColorStateTypeId = StateTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); +StateTypeId displayPinMockPercentageStateTypeId = StateTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); +StateTypeId displayPinMockAllowedValuesStateTypeId = StateTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); +StateTypeId displayPinMockDoubleStateTypeId = StateTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); +StateTypeId displayPinMockBoolStateTypeId = StateTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); +EventTypeId displayPinMockColorEventTypeId = EventTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); +ParamTypeId displayPinMockColorEventColorParamTypeId = ParamTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); +EventTypeId displayPinMockPercentageEventTypeId = EventTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); +ParamTypeId displayPinMockPercentageEventPercentageParamTypeId = ParamTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); +EventTypeId displayPinMockAllowedValuesEventTypeId = EventTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); +ParamTypeId displayPinMockAllowedValuesEventAllowedValuesParamTypeId = ParamTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); +EventTypeId displayPinMockDoubleEventTypeId = EventTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); +ParamTypeId displayPinMockDoubleEventDoubleParamTypeId = ParamTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); +EventTypeId displayPinMockBoolEventTypeId = EventTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); +ParamTypeId displayPinMockBoolEventBoolParamTypeId = ParamTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); +ActionTypeId displayPinMockColorActionTypeId = ActionTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); +ParamTypeId displayPinMockColorActionColorParamTypeId = ParamTypeId("{3e161294-8a0d-4384-9676-6959e08cc2fa}"); +ActionTypeId displayPinMockPercentageActionTypeId = ActionTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); +ParamTypeId displayPinMockPercentageActionPercentageParamTypeId = ParamTypeId("{527f0687-0b28-4c26-852c-25b8f83e4797}"); +ActionTypeId displayPinMockAllowedValuesActionTypeId = ActionTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); +ParamTypeId displayPinMockAllowedValuesActionAllowedValuesParamTypeId = ParamTypeId("{b463c5ae-4d55-402f-8480-a5cdb485c143}"); +ActionTypeId displayPinMockDoubleActionTypeId = ActionTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); +ParamTypeId displayPinMockDoubleActionDoubleParamTypeId = ParamTypeId("{17635624-7c19-4bae-8429-2f7aa5d2f843}"); +ActionTypeId displayPinMockBoolActionTypeId = ActionTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); +ParamTypeId displayPinMockBoolActionBoolParamTypeId = ParamTypeId("{7ffe514f-7999-4998-8350-0e73e222a8c4}"); +ActionTypeId displayPinMockTimeoutActionTypeId = ActionTypeId("{854a0a4a-803f-4b7f-9dce-b07794f9011b}"); +ThingClassId parentMockThingClassId = ThingClassId("{a71fbde9-9a38-4bf8-beab-c8aade2608ba}"); +StateTypeId parentMockBoolValueStateTypeId = StateTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); +EventTypeId parentMockBoolValueEventTypeId = EventTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); +ParamTypeId parentMockBoolValueEventBoolValueParamTypeId = ParamTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); +ActionTypeId parentMockBoolValueActionTypeId = ActionTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); +ParamTypeId parentMockBoolValueActionBoolValueParamTypeId = ParamTypeId("{d24ede5f-4064-4898-bb84-cfb533b1fbc0}"); +ThingClassId childMockThingClassId = ThingClassId("{40893c9f-bc47-40c1-8bf7-b390c7c1b4fc}"); +StateTypeId childMockBoolValueStateTypeId = StateTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); +EventTypeId childMockBoolValueEventTypeId = EventTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); +ParamTypeId childMockBoolValueEventBoolValueParamTypeId = ParamTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); +ActionTypeId childMockBoolValueActionTypeId = ActionTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); +ParamTypeId childMockBoolValueActionBoolValueParamTypeId = ParamTypeId("{80ba1449-b485-47d4-a067-6bf306e2a568}"); +ThingClassId inputTypeMockThingClassId = ThingClassId("{515ffdf1-55e5-498d-9abc-4e2fe768f3a9}"); +ParamTypeId inputTypeMockThingTextLineParamTypeId = ParamTypeId("{e6acf0c7-4b8e-4296-ac62-855d20deb816}"); +ParamTypeId inputTypeMockThingTextAreaParamTypeId = ParamTypeId("{716f0994-bc01-42b0-b64d-59236f7320d2}"); +ParamTypeId inputTypeMockThingPasswordParamTypeId = ParamTypeId("{e5c0d14b-c9f1-4aca-a56e-85bfa6977150}"); +ParamTypeId inputTypeMockThingSearchParamTypeId = ParamTypeId("{22add8c9-ee4f-43ad-8931-58e999313ac3}"); +ParamTypeId inputTypeMockThingMailParamTypeId = ParamTypeId("{a8494faf-3a0f-4cf3-84b7-4b39148a838d}"); +ParamTypeId inputTypeMockThingIp4ParamTypeId = ParamTypeId("{9e5f86a0-4bb3-4892-bff8-3fc4032af6e2}"); +ParamTypeId inputTypeMockThingIp6ParamTypeId = ParamTypeId("{43bf3832-dd48-4090-a836-656e8b60216e}"); +ParamTypeId inputTypeMockThingUrlParamTypeId = ParamTypeId("{fa67229f-fcef-496f-b671-59a4b48f3ab5}"); +ParamTypeId inputTypeMockThingMacParamTypeId = ParamTypeId("{e93db587-7919-48f3-8c88-1651de63c765}"); +StateTypeId inputTypeMockBoolStateTypeId = StateTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); +StateTypeId inputTypeMockWritableBoolStateTypeId = StateTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); +StateTypeId inputTypeMockIntStateTypeId = StateTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); +StateTypeId inputTypeMockWritableIntStateTypeId = StateTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); +StateTypeId inputTypeMockWritableIntMinMaxStateTypeId = StateTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); +StateTypeId inputTypeMockUintStateTypeId = StateTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); +StateTypeId inputTypeMockWritableUIntStateTypeId = StateTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); +StateTypeId inputTypeMockWritableUIntMinMaxStateTypeId = StateTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); +StateTypeId inputTypeMockDoubleStateTypeId = StateTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); +StateTypeId inputTypeMockWritableDoubleStateTypeId = StateTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); +StateTypeId inputTypeMockWritableDoubleMinMaxStateTypeId = StateTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); +StateTypeId inputTypeMockStringStateTypeId = StateTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); +StateTypeId inputTypeMockWritableStringStateTypeId = StateTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); +StateTypeId inputTypeMockWritableStringSelectionStateTypeId = StateTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); +StateTypeId inputTypeMockColorStateTypeId = StateTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); +StateTypeId inputTypeMockWritableColorStateTypeId = StateTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); +StateTypeId inputTypeMockTimeStateTypeId = StateTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); +StateTypeId inputTypeMockWritableTimeStateTypeId = StateTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); +StateTypeId inputTypeMockTimestampIntStateTypeId = StateTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); +StateTypeId inputTypeMockWritableTimestampIntStateTypeId = StateTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); +StateTypeId inputTypeMockTimestampUIntStateTypeId = StateTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); +StateTypeId inputTypeMockWritableTimestampUIntStateTypeId = StateTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); +EventTypeId inputTypeMockBoolEventTypeId = EventTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); +ParamTypeId inputTypeMockBoolEventBoolParamTypeId = ParamTypeId("{3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}"); +EventTypeId inputTypeMockWritableBoolEventTypeId = EventTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); +ParamTypeId inputTypeMockWritableBoolEventWritableBoolParamTypeId = ParamTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); +EventTypeId inputTypeMockIntEventTypeId = EventTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); +ParamTypeId inputTypeMockIntEventIntParamTypeId = ParamTypeId("{d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}"); +EventTypeId inputTypeMockWritableIntEventTypeId = EventTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); +ParamTypeId inputTypeMockWritableIntEventWritableIntParamTypeId = ParamTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); +EventTypeId inputTypeMockWritableIntMinMaxEventTypeId = EventTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); +ParamTypeId inputTypeMockWritableIntMinMaxEventWritableIntMinMaxParamTypeId = ParamTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); +EventTypeId inputTypeMockUintEventTypeId = EventTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); +ParamTypeId inputTypeMockUintEventUintParamTypeId = ParamTypeId("{19e74fcc-bfd5-491f-8eb6-af128e8f1162}"); +EventTypeId inputTypeMockWritableUIntEventTypeId = EventTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); +ParamTypeId inputTypeMockWritableUIntEventWritableUIntParamTypeId = ParamTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); +EventTypeId inputTypeMockWritableUIntMinMaxEventTypeId = EventTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); +ParamTypeId inputTypeMockWritableUIntMinMaxEventWritableUIntMinMaxParamTypeId = ParamTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); +EventTypeId inputTypeMockDoubleEventTypeId = EventTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); +ParamTypeId inputTypeMockDoubleEventDoubleParamTypeId = ParamTypeId("{f7d2063d-959e-46ac-8568-8b99722d3b22}"); +EventTypeId inputTypeMockWritableDoubleEventTypeId = EventTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); +ParamTypeId inputTypeMockWritableDoubleEventWritableDoubleParamTypeId = ParamTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); +EventTypeId inputTypeMockWritableDoubleMinMaxEventTypeId = EventTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); +ParamTypeId inputTypeMockWritableDoubleMinMaxEventWritableDoubleMinMaxParamTypeId = ParamTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); +EventTypeId inputTypeMockStringEventTypeId = EventTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); +ParamTypeId inputTypeMockStringEventStringParamTypeId = ParamTypeId("{27f69ca9-a321-40ff-bfee-4b0272a671b4}"); +EventTypeId inputTypeMockWritableStringEventTypeId = EventTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); +ParamTypeId inputTypeMockWritableStringEventWritableStringParamTypeId = ParamTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); +EventTypeId inputTypeMockWritableStringSelectionEventTypeId = EventTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); +ParamTypeId inputTypeMockWritableStringSelectionEventWritableStringSelectionParamTypeId = ParamTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); +EventTypeId inputTypeMockColorEventTypeId = EventTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); +ParamTypeId inputTypeMockColorEventColorParamTypeId = ParamTypeId("{4507d5c6-b692-4bd6-87f2-00364bc0cb4d}"); +EventTypeId inputTypeMockWritableColorEventTypeId = EventTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); +ParamTypeId inputTypeMockWritableColorEventWritableColorParamTypeId = ParamTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); +EventTypeId inputTypeMockTimeEventTypeId = EventTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); +ParamTypeId inputTypeMockTimeEventTimeParamTypeId = ParamTypeId("{8250c71e-59bc-41ab-b576-99fcfc34e8d1}"); +EventTypeId inputTypeMockWritableTimeEventTypeId = EventTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); +ParamTypeId inputTypeMockWritableTimeEventWritableTimeParamTypeId = ParamTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); +EventTypeId inputTypeMockTimestampIntEventTypeId = EventTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); +ParamTypeId inputTypeMockTimestampIntEventTimestampIntParamTypeId = ParamTypeId("{2c91b5ef-c2d1-4367-bc65-5a13abf69641}"); +EventTypeId inputTypeMockWritableTimestampIntEventTypeId = EventTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); +ParamTypeId inputTypeMockWritableTimestampIntEventWritableTimestampIntParamTypeId = ParamTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); +EventTypeId inputTypeMockTimestampUIntEventTypeId = EventTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); +ParamTypeId inputTypeMockTimestampUIntEventTimestampUIntParamTypeId = ParamTypeId("{6c9a96e8-0d48-4f42-8967-848358fd7f79}"); +EventTypeId inputTypeMockWritableTimestampUIntEventTypeId = EventTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); +ParamTypeId inputTypeMockWritableTimestampUIntEventWritableTimestampUIntParamTypeId = ParamTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); +ActionTypeId inputTypeMockWritableBoolActionTypeId = ActionTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); +ParamTypeId inputTypeMockWritableBoolActionWritableBoolParamTypeId = ParamTypeId("{a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}"); +ActionTypeId inputTypeMockWritableIntActionTypeId = ActionTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); +ParamTypeId inputTypeMockWritableIntActionWritableIntParamTypeId = ParamTypeId("{857a8422-983c-47d6-a15f-d8450b3162f7}"); +ActionTypeId inputTypeMockWritableIntMinMaxActionTypeId = ActionTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); +ParamTypeId inputTypeMockWritableIntMinMaxActionWritableIntMinMaxParamTypeId = ParamTypeId("{86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}"); +ActionTypeId inputTypeMockWritableUIntActionTypeId = ActionTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); +ParamTypeId inputTypeMockWritableUIntActionWritableUIntParamTypeId = ParamTypeId("{563e9c4c-5198-400a-9f6c-358f4752af58}"); +ActionTypeId inputTypeMockWritableUIntMinMaxActionTypeId = ActionTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); +ParamTypeId inputTypeMockWritableUIntMinMaxActionWritableUIntMinMaxParamTypeId = ParamTypeId("{79238998-eaab-4d71-b406-5d78f1749751}"); +ActionTypeId inputTypeMockWritableDoubleActionTypeId = ActionTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); +ParamTypeId inputTypeMockWritableDoubleActionWritableDoubleParamTypeId = ParamTypeId("{8e2eb91b-d60b-4461-9a50-d7b8ad263170}"); +ActionTypeId inputTypeMockWritableDoubleMinMaxActionTypeId = ActionTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); +ParamTypeId inputTypeMockWritableDoubleMinMaxActionWritableDoubleMinMaxParamTypeId = ParamTypeId("{00d3425e-1da6-4748-8906-4555ceefb136}"); +ActionTypeId inputTypeMockWritableStringActionTypeId = ActionTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); +ParamTypeId inputTypeMockWritableStringActionWritableStringParamTypeId = ParamTypeId("{ef511043-bd1a-4a5f-984c-222b7da43f38}"); +ActionTypeId inputTypeMockWritableStringSelectionActionTypeId = ActionTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); +ParamTypeId inputTypeMockWritableStringSelectionActionWritableStringSelectionParamTypeId = ParamTypeId("{209d7afc-6fe9-4fe9-939b-e472ea0ad639}"); +ActionTypeId inputTypeMockWritableColorActionTypeId = ActionTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); +ParamTypeId inputTypeMockWritableColorActionWritableColorParamTypeId = ParamTypeId("{455f4f68-3cb0-4e8a-a707-62e4a2a8035c}"); +ActionTypeId inputTypeMockWritableTimeActionTypeId = ActionTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); +ParamTypeId inputTypeMockWritableTimeActionWritableTimeParamTypeId = ParamTypeId("{d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}"); +ActionTypeId inputTypeMockWritableTimestampIntActionTypeId = ActionTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); +ParamTypeId inputTypeMockWritableTimestampIntActionWritableTimestampIntParamTypeId = ParamTypeId("{88b6746a-b009-4df6-8986-d7884ffd94b2}"); +ActionTypeId inputTypeMockWritableTimestampUIntActionTypeId = ActionTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); +ParamTypeId inputTypeMockWritableTimestampUIntActionWritableTimestampUIntParamTypeId = ParamTypeId("{45d0069a-63ac-4265-8170-8152778608ee}"); +ThingClassId oAuthGoogleMockThingClassId = ThingClassId("{805d1692-7bd0-449a-9d5c-43a332ff58f4}"); +ThingClassId oAuthSonosMockThingClassId = ThingClassId("{783c615b-7bd6-49a4-98b0-8d1deb3c7156}"); +ThingClassId userAndPassMockThingClassId = ThingClassId("{6fe07a77-9c07-4736-81e2-d504314bbcb9}"); const QString translations[] { - //: The name of the Browser Item ActionType ({00b8f0a8-99ca-4aa4-833d-59eb8d4d6de3}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Add to favorites"), + //: The name of the Browser Item ActionType ({00b8f0a8-99ca-4aa4-833d-59eb8d4d6de3}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Add to favorites"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: bool, ID: {3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) - QT_TRANSLATE_NOOP("mockDevice", "Bool"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: bool, ID: {3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) + QT_TRANSLATE_NOOP("mock", "Bool"), - //: The name of the StateType ({3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Bool"), + //: The name of the StateType ({3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Bool"), - //: The name of the EventType ({3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Bool changed"), + //: The name of the EventType ({3bad3a09-5826-4ed7-a832-10e3e2ee2a7d}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Bool changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: color, ID: {4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) - QT_TRANSLATE_NOOP("mockDevice", "Color"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: color, ID: {4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) + QT_TRANSLATE_NOOP("mock", "Color"), - //: The name of the StateType ({4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Color"), + //: The name of the StateType ({4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Color"), - //: The name of the EventType ({4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Color changed"), + //: The name of the EventType ({4507d5c6-b692-4bd6-87f2-00364bc0cb4d}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Color changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: double, ID: {f7d2063d-959e-46ac-8568-8b99722d3b22}) - QT_TRANSLATE_NOOP("mockDevice", "Double"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: double, ID: {f7d2063d-959e-46ac-8568-8b99722d3b22}) + QT_TRANSLATE_NOOP("mock", "Double"), - //: The name of the StateType ({f7d2063d-959e-46ac-8568-8b99722d3b22}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Double"), + //: The name of the StateType ({f7d2063d-959e-46ac-8568-8b99722d3b22}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Double"), - //: The name of the EventType ({f7d2063d-959e-46ac-8568-8b99722d3b22}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Double changed"), + //: The name of the EventType ({f7d2063d-959e-46ac-8568-8b99722d3b22}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Double changed"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, EventType: boolValue, ID: {978b0ba5-d008-41bd-b63d-a3bd23cb6469}) - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state"), + //: The name of the ParamType (ThingClass: autoMock, EventType: boolValue, ID: {978b0ba5-d008-41bd-b63d-a3bd23cb6469}) + QT_TRANSLATE_NOOP("mock", "Dummy bool state"), - //: The name of the StateType ({978b0ba5-d008-41bd-b63d-a3bd23cb6469}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state"), + //: The name of the StateType ({978b0ba5-d008-41bd-b63d-a3bd23cb6469}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Dummy bool state"), - //: The name of the ParamType (DeviceClass: mock, EventType: bool, ID: {9dd6a97c-dfd1-43dc-acbd-367932742310}) - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state"), + //: The name of the ParamType (ThingClass: mock, EventType: bool, ID: {9dd6a97c-dfd1-43dc-acbd-367932742310}) + QT_TRANSLATE_NOOP("mock", "Dummy bool state"), - //: The name of the StateType ({9dd6a97c-dfd1-43dc-acbd-367932742310}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state"), + //: The name of the StateType ({9dd6a97c-dfd1-43dc-acbd-367932742310}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy bool state"), - //: The name of the EventType ({978b0ba5-d008-41bd-b63d-a3bd23cb6469}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state changed"), + //: The name of the EventType ({978b0ba5-d008-41bd-b63d-a3bd23cb6469}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Dummy bool state changed"), - //: The name of the EventType ({9dd6a97c-dfd1-43dc-acbd-367932742310}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy bool state changed"), + //: The name of the EventType ({9dd6a97c-dfd1-43dc-acbd-367932742310}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy bool state changed"), - //: The name of the ParamType (DeviceClass: mock, EventType: double, ID: {7cac53ee-7048-4dc9-b000-7b585390f34c}) - QT_TRANSLATE_NOOP("mockDevice", "Dummy double state"), + //: The name of the ParamType (ThingClass: mock, EventType: double, ID: {7cac53ee-7048-4dc9-b000-7b585390f34c}) + QT_TRANSLATE_NOOP("mock", "Dummy double state"), - //: The name of the StateType ({7cac53ee-7048-4dc9-b000-7b585390f34c}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy double state"), + //: The name of the StateType ({7cac53ee-7048-4dc9-b000-7b585390f34c}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy double state"), - //: The name of the EventType ({7cac53ee-7048-4dc9-b000-7b585390f34c}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy double state changed"), + //: The name of the EventType ({7cac53ee-7048-4dc9-b000-7b585390f34c}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy double state changed"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, EventType: int, ID: {74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state"), + //: The name of the ParamType (ThingClass: autoMock, EventType: int, ID: {74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) + QT_TRANSLATE_NOOP("mock", "Dummy int state"), - //: The name of the StateType ({74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state"), + //: The name of the StateType ({74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Dummy int state"), - //: The name of the ParamType (DeviceClass: mock, EventType: int, ID: {80baec19-54de-4948-ac46-31eabfaceb83}) - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state"), + //: The name of the ParamType (ThingClass: mock, EventType: int, ID: {80baec19-54de-4948-ac46-31eabfaceb83}) + QT_TRANSLATE_NOOP("mock", "Dummy int state"), - //: The name of the StateType ({80baec19-54de-4948-ac46-31eabfaceb83}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state"), + //: The name of the StateType ({80baec19-54de-4948-ac46-31eabfaceb83}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy int state"), - //: The name of the EventType ({74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state changed"), + //: The name of the EventType ({74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Dummy int state changed"), - //: The name of the EventType ({80baec19-54de-4948-ac46-31eabfaceb83}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Dummy int state changed"), + //: The name of the EventType ({80baec19-54de-4948-ac46-31eabfaceb83}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Dummy int state changed"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {9e5f86a0-4bb3-4892-bff8-3fc4032af6e2}) - QT_TRANSLATE_NOOP("mockDevice", "IPv4 address"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {9e5f86a0-4bb3-4892-bff8-3fc4032af6e2}) + QT_TRANSLATE_NOOP("mock", "IPv4 address"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {43bf3832-dd48-4090-a836-656e8b60216e}) - QT_TRANSLATE_NOOP("mockDevice", "IPv6 address"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {43bf3832-dd48-4090-a836-656e8b60216e}) + QT_TRANSLATE_NOOP("mock", "IPv6 address"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: int, ID: {d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) - QT_TRANSLATE_NOOP("mockDevice", "Int"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: int, ID: {d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) + QT_TRANSLATE_NOOP("mock", "Int"), - //: The name of the StateType ({d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Int"), + //: The name of the StateType ({d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Int"), - //: The name of the EventType ({d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Int changed"), + //: The name of the EventType ({d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Int changed"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {e93db587-7919-48f3-8c88-1651de63c765}) - QT_TRANSLATE_NOOP("mockDevice", "Mac address"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {e93db587-7919-48f3-8c88-1651de63c765}) + QT_TRANSLATE_NOOP("mock", "Mac address"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {a8494faf-3a0f-4cf3-84b7-4b39148a838d}) - QT_TRANSLATE_NOOP("mockDevice", "Mail address"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {a8494faf-3a0f-4cf3-84b7-4b39148a838d}) + QT_TRANSLATE_NOOP("mock", "Mail address"), - //: The name of the ActionType ({07cd8d5f-2f65-4955-b1f9-05d7f4da488a}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 1 (with params)"), + //: The name of the ActionType ({07cd8d5f-2f65-4955-b1f9-05d7f4da488a}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Action 1 (with params)"), - //: The name of the ActionType ({dea0f4e1-65e3-4981-8eaa-2701c53a9185}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 1 (with params)"), + //: The name of the ActionType ({dea0f4e1-65e3-4981-8eaa-2701c53a9185}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Action 1 (with params)"), - //: The name of the ActionType ({ef518d53-50e2-4ca5-a4b1-e9a8b9309d44}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 2 (without params)"), + //: The name of the ActionType ({ef518d53-50e2-4ca5-a4b1-e9a8b9309d44}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Action 2 (without params)"), - //: The name of the ActionType ({defd3ed6-1a0d-400b-8879-a0202cf39935}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 2 (without params)"), + //: The name of the ActionType ({defd3ed6-1a0d-400b-8879-a0202cf39935}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Action 2 (without params)"), - //: The name of the ActionType ({5f27a9f2-59cd-4a15-98bd-6ed6e10bc6ed}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 3 (async)"), + //: The name of the ActionType ({5f27a9f2-59cd-4a15-98bd-6ed6e10bc6ed}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Action 3 (async)"), - //: The name of the ActionType ({fbae06d3-7666-483e-a39e-ec50fe89054e}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 3 (async)"), + //: The name of the ActionType ({fbae06d3-7666-483e-a39e-ec50fe89054e}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Action 3 (async)"), - //: The name of the ActionType ({58a61de4-472c-4775-8fe8-583a9c83fcf1}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 4 (broken)"), + //: The name of the ActionType ({58a61de4-472c-4775-8fe8-583a9c83fcf1}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Action 4 (broken)"), - //: The name of the ActionType ({df3cf33d-26d5-4577-9132-9823bd33fad0}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 4 (broken)"), + //: The name of the ActionType ({df3cf33d-26d5-4577-9132-9823bd33fad0}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Action 4 (broken)"), - //: The name of the ActionType ({17ad52dd-ef2f-4947-9b73-5bf6e172a9d0}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 5 (async, broken)"), + //: The name of the ActionType ({17ad52dd-ef2f-4947-9b73-5bf6e172a9d0}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Action 5 (async, broken)"), - //: The name of the ActionType ({bfe89a1d-3497-4121-8318-e77c37537219}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Action 5 (async, broken)"), + //: The name of the ActionType ({bfe89a1d-3497-4121-8318-e77c37537219}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Action 5 (async, broken)"), + + //: The name of the EventType ({00f81fca-26f1-4a84-aa2b-4c6a3d953ec6}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Event 1"), + + //: The name of the EventType ({45bf3752-0fc6-46b9-89fd-ffd878b5b22b}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Event 1"), + + //: The name of the EventType ({6e27922d-aa9d-44d1-b9b4-9faf31b6bd97}) of ThingClass autoMock + QT_TRANSLATE_NOOP("mock", "Mock Event 2"), + + //: The name of the EventType ({863d5920-b1cf-4eb9-88bd-8f7b8583b1cf}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Mock Event 2"), //: The name of the ThingClass ({753f0d32-0468-4d08-82ed-1964aab03298}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device"), + QT_TRANSLATE_NOOP("mock", "Mock Thing"), //: The name of the ThingClass ({ab4257b3-7548-47ee-9bd4-7dc3004fd197}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Auto created)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Auto created)"), //: The name of the ThingClass ({40893c9f-bc47-40c1-8bf7-b390c7c1b4fc}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Child)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Child)"), //: The name of the ThingClass ({296f1fd4-e893-46b2-8a42-50d1bceb8730}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Display Pin)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Display Pin)"), //: The name of the ThingClass ({805d1692-7bd0-449a-9d5c-43a332ff58f4}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Google OAuth)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Google OAuth)"), //: The name of the ThingClass ({515ffdf1-55e5-498d-9abc-4e2fe768f3a9}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (InputTypes)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (InputTypes)"), //: The name of the ThingClass ({a71fbde9-9a38-4bf8-beab-c8aade2608ba}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Parent)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Parent)"), //: The name of the ThingClass ({9e03144c-e436-4eea-82d9-ccb33ef778db}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Push Button)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Push Button)"), //: The name of the ThingClass ({783c615b-7bd6-49a4-98b0-8d1deb3c7156}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (Sonos OAuth)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (Sonos OAuth)"), //: The name of the ThingClass ({6fe07a77-9c07-4736-81e2-d504314bbcb9}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Device (User & Password)"), + QT_TRANSLATE_NOOP("mock", "Mocked Thing (User & Password)"), - //: The name of the plugin mockDevice ({727a4a9a-c187-446f-aadf-f1b2220607d1}) - QT_TRANSLATE_NOOP("mockDevice", "Mock Devices"), + //: The name of the plugin mock ({727a4a9a-c187-446f-aadf-f1b2220607d1}) + QT_TRANSLATE_NOOP("mock", "Mocked things"), - //: The name of the EventType ({00f81fca-26f1-4a84-aa2b-4c6a3d953ec6}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Event 1"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {e5c0d14b-c9f1-4aca-a56e-85bfa6977150}) + QT_TRANSLATE_NOOP("mock", "Password text"), - //: The name of the EventType ({45bf3752-0fc6-46b9-89fd-ffd878b5b22b}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Event 1"), + //: The name of the Browser Item ActionType ({da6faef8-2816-430e-93bb-57e8f9582d29}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "Remove from favorites"), - //: The name of the EventType ({6e27922d-aa9d-44d1-b9b4-9faf31b6bd97}) of DeviceClass mockDeviceAuto - QT_TRANSLATE_NOOP("mockDevice", "Mock Event 2"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {22add8c9-ee4f-43ad-8931-58e999313ac3}) + QT_TRANSLATE_NOOP("mock", "Search text"), - //: The name of the EventType ({863d5920-b1cf-4eb9-88bd-8f7b8583b1cf}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Mock Event 2"), + //: The name of the ActionType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Bool"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {e5c0d14b-c9f1-4aca-a56e-85bfa6977150}) - QT_TRANSLATE_NOOP("mockDevice", "Password text"), + //: The name of the ActionType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Color"), - //: The name of the Browser Item ActionType ({da6faef8-2816-430e-93bb-57e8f9582d29}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "Remove from favorites"), + //: The name of the ActionType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Double"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {22add8c9-ee4f-43ad-8931-58e999313ac3}) - QT_TRANSLATE_NOOP("mockDevice", "Search text"), + //: The name of the ActionType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Double (min/max)"), - //: The name of the ActionType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Bool"), + //: The name of the ActionType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Int"), - //: The name of the ActionType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Color"), + //: The name of the ActionType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Int (min/max)"), - //: The name of the ActionType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Double"), + //: The name of the ActionType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable String"), - //: The name of the ActionType ({00d3425e-1da6-4748-8906-4555ceefb136}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Double (min/max)"), + //: The name of the ActionType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable String (selection)"), - //: The name of the ActionType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Int"), + //: The name of the ActionType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Time"), - //: The name of the ActionType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Int (min/max)"), + //: The name of the ActionType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Timestamp (Int)"), - //: The name of the ActionType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable String"), + //: The name of the ActionType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable Timestamp (UInt)"), - //: The name of the ActionType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable String (selection)"), + //: The name of the ActionType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable UInt"), - //: The name of the ActionType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Time"), + //: The name of the ActionType ({79238998-eaab-4d71-b406-5d78f1749751}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Set Writable UInt (min/max)"), - //: The name of the ActionType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Timestamp (Int)"), + //: The name of the ActionType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Set allowed values"), - //: The name of the ActionType ({45d0069a-63ac-4265-8170-8152778608ee}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable Timestamp (UInt)"), + //: The name of the ActionType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Set allowed values"), - //: The name of the ActionType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable UInt"), + //: The name of the ActionType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of ThingClass childMock + QT_TRANSLATE_NOOP("mock", "Set bool value"), - //: The name of the ActionType ({79238998-eaab-4d71-b406-5d78f1749751}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Set Writable UInt (min/max)"), + //: The name of the ActionType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of ThingClass parentMock + QT_TRANSLATE_NOOP("mock", "Set bool value"), - //: The name of the ActionType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Set allowed values"), + //: The name of the ActionType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Set bool value"), - //: The name of the ActionType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Set allowed values"), + //: The name of the ActionType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Set bool value"), - //: The name of the ActionType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of DeviceClass mockChild - QT_TRANSLATE_NOOP("mockDevice", "Set bool value"), + //: The name of the ActionType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Set color"), - //: The name of the ActionType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of DeviceClass mockParent - QT_TRANSLATE_NOOP("mockDevice", "Set bool value"), + //: The name of the ActionType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Set color"), - //: The name of the ActionType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Set bool value"), + //: The name of the ActionType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Set double value"), - //: The name of the ActionType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Set bool value"), + //: The name of the ActionType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Set double value"), - //: The name of the ActionType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Set color"), + //: The name of the ActionType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Set percentage"), - //: The name of the ActionType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Set color"), + //: The name of the ActionType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Set percentage"), - //: The name of the ActionType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Set double value"), + //: The name of the ParamType (ThingClass: mock, Type: settings, ID: {367f7ba4-5039-47be-abd8-59cc8eaf4b9a}) + QT_TRANSLATE_NOOP("mock", "Setting 1"), - //: The name of the ActionType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Set double value"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: string, ID: {27f69ca9-a321-40ff-bfee-4b0272a671b4}) + QT_TRANSLATE_NOOP("mock", "String"), - //: The name of the ActionType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Set percentage"), + //: The name of the StateType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "String"), - //: The name of the ActionType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Set percentage"), + //: The name of the EventType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "String changed"), - //: The name of the ParamType (DeviceClass: mock, Type: settings, ID: {367f7ba4-5039-47be-abd8-59cc8eaf4b9a}) - QT_TRANSLATE_NOOP("mockDevice", "Setting 1"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {716f0994-bc01-42b0-b64d-59236f7320d2}) + QT_TRANSLATE_NOOP("mock", "Text area"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: string, ID: {27f69ca9-a321-40ff-bfee-4b0272a671b4}) - QT_TRANSLATE_NOOP("mockDevice", "String"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {e6acf0c7-4b8e-4296-ac62-855d20deb816}) + QT_TRANSLATE_NOOP("mock", "Text line"), - //: The name of the StateType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "String"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: time, ID: {8250c71e-59bc-41ab-b576-99fcfc34e8d1}) + QT_TRANSLATE_NOOP("mock", "Time"), - //: The name of the EventType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "String changed"), + //: The name of the StateType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Time"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {716f0994-bc01-42b0-b64d-59236f7320d2}) - QT_TRANSLATE_NOOP("mockDevice", "Text area"), + //: The name of the EventType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Time changed"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {e6acf0c7-4b8e-4296-ac62-855d20deb816}) - QT_TRANSLATE_NOOP("mockDevice", "Text line"), + //: The name of the ActionType ({854a0a4a-803f-4b7f-9dce-b07794f9011b}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "Timeout action"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: time, ID: {8250c71e-59bc-41ab-b576-99fcfc34e8d1}) - QT_TRANSLATE_NOOP("mockDevice", "Time"), + //: The name of the ActionType ({54646e7c-bc54-4895-81a2-590d72d120f9}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "Timeout action"), - //: The name of the StateType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Time"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: timestampInt, ID: {2c91b5ef-c2d1-4367-bc65-5a13abf69641}) + QT_TRANSLATE_NOOP("mock", "Timestamp (Int)"), - //: The name of the EventType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Time changed"), + //: The name of the StateType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Timestamp (Int)"), - //: The name of the ActionType ({854a0a4a-803f-4b7f-9dce-b07794f9011b}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "Timeout action"), + //: The name of the EventType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Timestamp (Int) changed"), - //: The name of the ActionType ({54646e7c-bc54-4895-81a2-590d72d120f9}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "Timeout action"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: timestampUInt, ID: {6c9a96e8-0d48-4f42-8967-848358fd7f79}) + QT_TRANSLATE_NOOP("mock", "Timestamp (UInt)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: timestampInt, ID: {2c91b5ef-c2d1-4367-bc65-5a13abf69641}) - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (Int)"), + //: The name of the StateType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Timestamp (UInt)"), - //: The name of the StateType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (Int)"), + //: The name of the EventType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Timestamp (UInt) changed"), - //: The name of the EventType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (Int) changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: uint, ID: {19e74fcc-bfd5-491f-8eb6-af128e8f1162}) + QT_TRANSLATE_NOOP("mock", "UInt"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: timestampUInt, ID: {6c9a96e8-0d48-4f42-8967-848358fd7f79}) - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (UInt)"), + //: The name of the StateType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "UInt"), - //: The name of the StateType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (UInt)"), + //: The name of the EventType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "UInt changed"), - //: The name of the EventType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Timestamp (UInt) changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {fa67229f-fcef-496f-b671-59a4b48f3ab5}) + QT_TRANSLATE_NOOP("mock", "URL"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: uint, ID: {19e74fcc-bfd5-491f-8eb6-af128e8f1162}) - QT_TRANSLATE_NOOP("mockDevice", "UInt"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableBool, ID: {a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) + QT_TRANSLATE_NOOP("mock", "Writable Bool"), - //: The name of the StateType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "UInt"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableBool, ID: {a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) + QT_TRANSLATE_NOOP("mock", "Writable Bool"), - //: The name of the EventType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "UInt changed"), + //: The name of the StateType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Bool"), - //: The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: {fa67229f-fcef-496f-b671-59a4b48f3ab5}) - QT_TRANSLATE_NOOP("mockDevice", "URL"), + //: The name of the EventType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Bool changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableBool, ID: {a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Bool"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableColor, ID: {455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) + QT_TRANSLATE_NOOP("mock", "Writable Color"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableBool, ID: {a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Bool"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableColor, ID: {455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) + QT_TRANSLATE_NOOP("mock", "Writable Color"), - //: The name of the StateType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Bool"), + //: The name of the StateType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Color"), - //: The name of the EventType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Bool changed"), + //: The name of the EventType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Color changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableColor, ID: {455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Color"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableDouble, ID: {8e2eb91b-d60b-4461-9a50-d7b8ad263170}) + QT_TRANSLATE_NOOP("mock", "Writable Double"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableColor, ID: {455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Color"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableDouble, ID: {8e2eb91b-d60b-4461-9a50-d7b8ad263170}) + QT_TRANSLATE_NOOP("mock", "Writable Double"), - //: The name of the StateType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Color"), + //: The name of the StateType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Double"), - //: The name of the EventType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Color changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableDoubleMinMax, ID: {00d3425e-1da6-4748-8906-4555ceefb136}) + QT_TRANSLATE_NOOP("mock", "Writable Double (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableDouble, ID: {8e2eb91b-d60b-4461-9a50-d7b8ad263170}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Double"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableDoubleMinMax, ID: {00d3425e-1da6-4748-8906-4555ceefb136}) + QT_TRANSLATE_NOOP("mock", "Writable Double (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableDouble, ID: {8e2eb91b-d60b-4461-9a50-d7b8ad263170}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Double"), + //: The name of the StateType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Double (min/max)"), - //: The name of the StateType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Double"), + //: The name of the EventType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Double (min/max) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableDoubleMinMax, ID: {00d3425e-1da6-4748-8906-4555ceefb136}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Double (min/max)"), + //: The name of the EventType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Double changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableDoubleMinMax, ID: {00d3425e-1da6-4748-8906-4555ceefb136}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Double (min/max)"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableInt, ID: {857a8422-983c-47d6-a15f-d8450b3162f7}) + QT_TRANSLATE_NOOP("mock", "Writable Int"), - //: The name of the StateType ({00d3425e-1da6-4748-8906-4555ceefb136}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Double (min/max)"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableInt, ID: {857a8422-983c-47d6-a15f-d8450b3162f7}) + QT_TRANSLATE_NOOP("mock", "Writable Int"), - //: The name of the EventType ({00d3425e-1da6-4748-8906-4555ceefb136}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Double (min/max) changed"), + //: The name of the StateType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Int"), - //: The name of the EventType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Double changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableIntMinMax, ID: {86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) + QT_TRANSLATE_NOOP("mock", "Writable Int (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableInt, ID: {857a8422-983c-47d6-a15f-d8450b3162f7}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Int"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableIntMinMax, ID: {86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) + QT_TRANSLATE_NOOP("mock", "Writable Int (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableInt, ID: {857a8422-983c-47d6-a15f-d8450b3162f7}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Int"), + //: The name of the StateType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Int (min/max)"), - //: The name of the StateType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Int"), + //: The name of the EventType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Int (min/max) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableIntMinMax, ID: {86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Int (min/max)"), + //: The name of the EventType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Int changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableIntMinMax, ID: {86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Int (min/max)"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableString, ID: {ef511043-bd1a-4a5f-984c-222b7da43f38}) + QT_TRANSLATE_NOOP("mock", "Writable String"), - //: The name of the StateType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Int (min/max)"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableString, ID: {ef511043-bd1a-4a5f-984c-222b7da43f38}) + QT_TRANSLATE_NOOP("mock", "Writable String"), - //: The name of the EventType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Int (min/max) changed"), + //: The name of the StateType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable String"), - //: The name of the EventType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Int changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableStringSelection, ID: {209d7afc-6fe9-4fe9-939b-e472ea0ad639}) + QT_TRANSLATE_NOOP("mock", "Writable String (selection)"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableString, ID: {ef511043-bd1a-4a5f-984c-222b7da43f38}) - QT_TRANSLATE_NOOP("mockDevice", "Writable String"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableStringSelection, ID: {209d7afc-6fe9-4fe9-939b-e472ea0ad639}) + QT_TRANSLATE_NOOP("mock", "Writable String (selection)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableString, ID: {ef511043-bd1a-4a5f-984c-222b7da43f38}) - QT_TRANSLATE_NOOP("mockDevice", "Writable String"), + //: The name of the StateType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable String (selection)"), - //: The name of the StateType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable String"), + //: The name of the EventType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable String (selection) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableStringSelection, ID: {209d7afc-6fe9-4fe9-939b-e472ea0ad639}) - QT_TRANSLATE_NOOP("mockDevice", "Writable String (selection)"), + //: The name of the EventType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable String changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableStringSelection, ID: {209d7afc-6fe9-4fe9-939b-e472ea0ad639}) - QT_TRANSLATE_NOOP("mockDevice", "Writable String (selection)"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableTime, ID: {d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) + QT_TRANSLATE_NOOP("mock", "Writable Time"), - //: The name of the StateType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable String (selection)"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTime, ID: {d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) + QT_TRANSLATE_NOOP("mock", "Writable Time"), - //: The name of the EventType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable String (selection) changed"), + //: The name of the StateType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Time"), - //: The name of the EventType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable String changed"), + //: The name of the EventType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Time changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableTime, ID: {d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Time"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableTimestampInt, ID: {88b6746a-b009-4df6-8986-d7884ffd94b2}) + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (Int)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableTime, ID: {d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Time"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTimestampInt, ID: {88b6746a-b009-4df6-8986-d7884ffd94b2}) + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (Int)"), - //: The name of the StateType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Time"), + //: The name of the StateType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (Int)"), - //: The name of the EventType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Time changed"), + //: The name of the EventType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (Int) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableTimestampInt, ID: {88b6746a-b009-4df6-8986-d7884ffd94b2}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (Int)"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableTimestampUInt, ID: {45d0069a-63ac-4265-8170-8152778608ee}) + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (UInt)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableTimestampInt, ID: {88b6746a-b009-4df6-8986-d7884ffd94b2}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (Int)"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTimestampUInt, ID: {45d0069a-63ac-4265-8170-8152778608ee}) + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (UInt)"), - //: The name of the StateType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (Int)"), + //: The name of the StateType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (UInt)"), - //: The name of the EventType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (Int) changed"), + //: The name of the EventType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable Timestamp (UInt) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableTimestampUInt, ID: {45d0069a-63ac-4265-8170-8152778608ee}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (UInt)"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableUInt, ID: {563e9c4c-5198-400a-9f6c-358f4752af58}) + QT_TRANSLATE_NOOP("mock", "Writable UInt"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableTimestampUInt, ID: {45d0069a-63ac-4265-8170-8152778608ee}) - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (UInt)"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableUInt, ID: {563e9c4c-5198-400a-9f6c-358f4752af58}) + QT_TRANSLATE_NOOP("mock", "Writable UInt"), - //: The name of the StateType ({45d0069a-63ac-4265-8170-8152778608ee}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (UInt)"), + //: The name of the StateType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable UInt"), - //: The name of the EventType ({45d0069a-63ac-4265-8170-8152778608ee}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable Timestamp (UInt) changed"), + //: The name of the ParamType (ThingClass: inputTypeMock, ActionType: writableUIntMinMax, ID: {79238998-eaab-4d71-b406-5d78f1749751}) + QT_TRANSLATE_NOOP("mock", "Writable UInt (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableUInt, ID: {563e9c4c-5198-400a-9f6c-358f4752af58}) - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt"), + //: The name of the ParamType (ThingClass: inputTypeMock, EventType: writableUIntMinMax, ID: {79238998-eaab-4d71-b406-5d78f1749751}) + QT_TRANSLATE_NOOP("mock", "Writable UInt (min/max)"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableUInt, ID: {563e9c4c-5198-400a-9f6c-358f4752af58}) - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt"), + //: The name of the StateType ({79238998-eaab-4d71-b406-5d78f1749751}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable UInt (min/max)"), - //: The name of the StateType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt"), + //: The name of the EventType ({79238998-eaab-4d71-b406-5d78f1749751}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable UInt (min/max) changed"), - //: The name of the ParamType (DeviceClass: mockInputType, ActionType: writableUIntMinMax, ID: {79238998-eaab-4d71-b406-5d78f1749751}) - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt (min/max)"), + //: The name of the EventType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of ThingClass inputTypeMock + QT_TRANSLATE_NOOP("mock", "Writable UInt changed"), - //: The name of the ParamType (DeviceClass: mockInputType, EventType: writableUIntMinMax, ID: {79238998-eaab-4d71-b406-5d78f1749751}) - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt (min/max)"), + //: The name of the ParamType (ThingClass: displayPinMock, ActionType: allowedValues, ID: {b463c5ae-4d55-402f-8480-a5cdb485c143}) + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the StateType ({79238998-eaab-4d71-b406-5d78f1749751}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt (min/max)"), + //: The name of the ParamType (ThingClass: displayPinMock, EventType: allowedValues, ID: {b463c5ae-4d55-402f-8480-a5cdb485c143}) + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the EventType ({79238998-eaab-4d71-b406-5d78f1749751}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt (min/max) changed"), + //: The name of the StateType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the EventType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of DeviceClass mockInputType - QT_TRANSLATE_NOOP("mockDevice", "Writable UInt changed"), + //: The name of the ParamType (ThingClass: pushButtonMock, ActionType: allowedValues, ID: {05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, ActionType: allowedValues, ID: {b463c5ae-4d55-402f-8480-a5cdb485c143}) - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the ParamType (ThingClass: pushButtonMock, EventType: allowedValues, ID: {05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, EventType: allowedValues, ID: {b463c5ae-4d55-402f-8480-a5cdb485c143}) - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the StateType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "allowed values"), - //: The name of the StateType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the EventType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "allowed values changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, ActionType: allowedValues, ID: {05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the EventType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "allowed values changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, EventType: allowedValues, ID: {05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the ParamType (ThingClass: autoMock, Type: thing, ID: {a5c4315f-0624-4971-87c1-4bbfbfdbd16e}) + QT_TRANSLATE_NOOP("mock", "async"), - //: The name of the StateType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "allowed values"), + //: The name of the ParamType (ThingClass: mock, Type: thing, ID: {f2977061-4dd0-4ef5-85aa-3b7134743be3}) + QT_TRANSLATE_NOOP("mock", "async"), - //: The name of the EventType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "allowed values changed"), + //: The name of the ParamType (ThingClass: mock, EventType: batteryLevel, ID: {6c8ab9a6-0164-4795-b829-f4394fe4edc4}) + QT_TRANSLATE_NOOP("mock", "battery level"), - //: The name of the EventType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "allowed values changed"), + //: The name of the EventType ({6c8ab9a6-0164-4795-b829-f4394fe4edc4}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "battery level"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: {a5c4315f-0624-4971-87c1-4bbfbfdbd16e}) - QT_TRANSLATE_NOOP("mockDevice", "async"), + //: The name of the StateType ({6c8ab9a6-0164-4795-b829-f4394fe4edc4}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "battery level"), - //: The name of the ParamType (DeviceClass: mock, Type: device, ID: {f2977061-4dd0-4ef5-85aa-3b7134743be3}) - QT_TRANSLATE_NOOP("mockDevice", "async"), + //: The name of the ParamType (ThingClass: mock, EventType: batteryCritical, ID: {580bc611-1a55-41f3-996f-8d3ccf543db3}) + QT_TRANSLATE_NOOP("mock", "battery level critical"), - //: The name of the ParamType (DeviceClass: mock, EventType: batteryLevel, ID: {6c8ab9a6-0164-4795-b829-f4394fe4edc4}) - QT_TRANSLATE_NOOP("mockDevice", "battery level"), + //: The name of the EventType ({580bc611-1a55-41f3-996f-8d3ccf543db3}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "battery level critical"), - //: The name of the EventType ({6c8ab9a6-0164-4795-b829-f4394fe4edc4}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "battery level"), + //: The name of the StateType ({580bc611-1a55-41f3-996f-8d3ccf543db3}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "battery level critical"), - //: The name of the StateType ({6c8ab9a6-0164-4795-b829-f4394fe4edc4}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "battery level"), + //: The name of the ParamType (ThingClass: childMock, ActionType: boolValue, ID: {80ba1449-b485-47d4-a067-6bf306e2a568}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mock, EventType: batteryCritical, ID: {580bc611-1a55-41f3-996f-8d3ccf543db3}) - QT_TRANSLATE_NOOP("mockDevice", "battery level critical"), + //: The name of the ParamType (ThingClass: childMock, EventType: boolValue, ID: {80ba1449-b485-47d4-a067-6bf306e2a568}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the EventType ({580bc611-1a55-41f3-996f-8d3ccf543db3}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "battery level critical"), + //: The name of the StateType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of ThingClass childMock + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the StateType ({580bc611-1a55-41f3-996f-8d3ccf543db3}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "battery level critical"), + //: The name of the ParamType (ThingClass: parentMock, ActionType: boolValue, ID: {d24ede5f-4064-4898-bb84-cfb533b1fbc0}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockChild, ActionType: boolValue, ID: {80ba1449-b485-47d4-a067-6bf306e2a568}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the ParamType (ThingClass: parentMock, EventType: boolValue, ID: {d24ede5f-4064-4898-bb84-cfb533b1fbc0}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockChild, EventType: boolValue, ID: {80ba1449-b485-47d4-a067-6bf306e2a568}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the StateType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of ThingClass parentMock + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the StateType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of DeviceClass mockChild - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the ParamType (ThingClass: displayPinMock, ActionType: bool, ID: {7ffe514f-7999-4998-8350-0e73e222a8c4}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockParent, ActionType: boolValue, ID: {d24ede5f-4064-4898-bb84-cfb533b1fbc0}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the ParamType (ThingClass: displayPinMock, EventType: bool, ID: {7ffe514f-7999-4998-8350-0e73e222a8c4}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockParent, EventType: boolValue, ID: {d24ede5f-4064-4898-bb84-cfb533b1fbc0}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the StateType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the StateType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of DeviceClass mockParent - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the ParamType (ThingClass: pushButtonMock, ActionType: bool, ID: {e680f7a4-b39e-46da-be41-fa3170fe3768}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, ActionType: bool, ID: {7ffe514f-7999-4998-8350-0e73e222a8c4}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the ParamType (ThingClass: pushButtonMock, EventType: bool, ID: {e680f7a4-b39e-46da-be41-fa3170fe3768}) + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, EventType: bool, ID: {7ffe514f-7999-4998-8350-0e73e222a8c4}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the StateType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "bool value"), - //: The name of the StateType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the EventType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of ThingClass childMock + QT_TRANSLATE_NOOP("mock", "bool value changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, ActionType: bool, ID: {e680f7a4-b39e-46da-be41-fa3170fe3768}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the EventType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of ThingClass parentMock + QT_TRANSLATE_NOOP("mock", "bool value changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, EventType: bool, ID: {e680f7a4-b39e-46da-be41-fa3170fe3768}) - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the EventType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "bool value changed"), - //: The name of the StateType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "bool value"), + //: The name of the EventType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "bool value changed"), - //: The name of the EventType ({80ba1449-b485-47d4-a067-6bf306e2a568}) of DeviceClass mockChild - QT_TRANSLATE_NOOP("mockDevice", "bool value changed"), + //: The name of the ParamType (ThingClass: autoMock, Type: thing, ID: {66179395-ef7a-4013-9fc6-2084104eea09}) + QT_TRANSLATE_NOOP("mock", "broken"), - //: The name of the EventType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of DeviceClass mockParent - QT_TRANSLATE_NOOP("mockDevice", "bool value changed"), + //: The name of the ParamType (ThingClass: mock, Type: thing, ID: {ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4}) + QT_TRANSLATE_NOOP("mock", "broken"), - //: The name of the EventType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "bool value changed"), + //: The name of the ParamType (ThingClass: displayPinMock, ActionType: color, ID: {3e161294-8a0d-4384-9676-6959e08cc2fa}) + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the EventType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "bool value changed"), + //: The name of the ParamType (ThingClass: displayPinMock, EventType: color, ID: {3e161294-8a0d-4384-9676-6959e08cc2fa}) + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: {66179395-ef7a-4013-9fc6-2084104eea09}) - QT_TRANSLATE_NOOP("mockDevice", "broken"), + //: The name of the StateType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the ParamType (DeviceClass: mock, Type: device, ID: {ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4}) - QT_TRANSLATE_NOOP("mockDevice", "broken"), + //: The name of the ParamType (ThingClass: pushButtonMock, ActionType: color, ID: {20dc7c22-c50e-42db-837c-2bbced939f8e}) + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, ActionType: color, ID: {3e161294-8a0d-4384-9676-6959e08cc2fa}) - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the ParamType (ThingClass: pushButtonMock, EventType: color, ID: {20dc7c22-c50e-42db-837c-2bbced939f8e}) + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, EventType: color, ID: {3e161294-8a0d-4384-9676-6959e08cc2fa}) - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the StateType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "color"), - //: The name of the StateType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the EventType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "color changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, ActionType: color, ID: {20dc7c22-c50e-42db-837c-2bbced939f8e}) - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the EventType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "color changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, EventType: color, ID: {20dc7c22-c50e-42db-837c-2bbced939f8e}) - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the ParamType (ThingClass: mock, Type: plugin, ID: {c75723b6-ea4f-4982-9751-6c5e39c88145}) + QT_TRANSLATE_NOOP("mock", "configParamBool"), - //: The name of the StateType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "color"), + //: The name of the ParamType (ThingClass: mock, Type: plugin, ID: {e1f72121-a426-45e2-b475-8262b5cdf103}) + QT_TRANSLATE_NOOP("mock", "configParamInt"), - //: The name of the EventType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "color changed"), + //: The name of the ParamType (ThingClass: displayPinMock, ActionType: double, ID: {17635624-7c19-4bae-8429-2f7aa5d2f843}) + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the EventType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "color changed"), + //: The name of the ParamType (ThingClass: displayPinMock, EventType: double, ID: {17635624-7c19-4bae-8429-2f7aa5d2f843}) + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: {c75723b6-ea4f-4982-9751-6c5e39c88145}) - QT_TRANSLATE_NOOP("mockDevice", "configParamBool"), + //: The name of the StateType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: {e1f72121-a426-45e2-b475-8262b5cdf103}) - QT_TRANSLATE_NOOP("mockDevice", "configParamInt"), + //: The name of the ParamType (ThingClass: pushButtonMock, ActionType: double, ID: {53cd7c55-49b7-441b-b970-9048f20f0e2c}) + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, ActionType: double, ID: {17635624-7c19-4bae-8429-2f7aa5d2f843}) - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the ParamType (ThingClass: pushButtonMock, EventType: double, ID: {53cd7c55-49b7-441b-b970-9048f20f0e2c}) + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, EventType: double, ID: {17635624-7c19-4bae-8429-2f7aa5d2f843}) - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the StateType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "double value"), - //: The name of the StateType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the EventType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "double value changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, ActionType: double, ID: {53cd7c55-49b7-441b-b970-9048f20f0e2c}) - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the EventType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "double value changed"), - //: The name of the ParamType (DeviceClass: mockPushButton, EventType: double, ID: {53cd7c55-49b7-441b-b970-9048f20f0e2c}) - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the ParamType (ThingClass: autoMock, Type: thing, ID: {bfeb0613-dab6-408c-aa27-c362c921d0d1}) + QT_TRANSLATE_NOOP("mock", "http port"), - //: The name of the StateType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "double value"), + //: The name of the ParamType (ThingClass: mock, Type: thing, ID: {d4f06047-125e-4479-9810-b54c189917f5}) + QT_TRANSLATE_NOOP("mock", "http port"), - //: The name of the EventType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "double value changed"), + //: The name of the ParamType (ThingClass: autoMock, ActionType: withParams, ID: {b8126ba6-3a54-45a3-be4d-63feb0ddb77b}) + QT_TRANSLATE_NOOP("mock", "mockActionParam1"), - //: The name of the EventType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "double value changed"), + //: The name of the ParamType (ThingClass: mock, ActionType: withParams, ID: {a2d3a256-a551-4712-a65b-ecd5a436a1cb}) + QT_TRANSLATE_NOOP("mock", "mockActionParam1"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: {bfeb0613-dab6-408c-aa27-c362c921d0d1}) - QT_TRANSLATE_NOOP("mockDevice", "http port"), + //: The name of the ParamType (ThingClass: autoMock, ActionType: withParams, ID: {df41ba71-e43b-4854-91d1-b19d8066d4f9}) + QT_TRANSLATE_NOOP("mock", "mockActionParam2"), - //: The name of the ParamType (DeviceClass: mock, Type: device, ID: {d4f06047-125e-4479-9810-b54c189917f5}) - QT_TRANSLATE_NOOP("mockDevice", "http port"), + //: The name of the ParamType (ThingClass: mock, ActionType: withParams, ID: {304a4899-18be-4e3b-94f4-d03be52f3233}) + QT_TRANSLATE_NOOP("mock", "mockActionParam2"), - //: The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: {b8126ba6-3a54-45a3-be4d-63feb0ddb77b}) - QT_TRANSLATE_NOOP("mockDevice", "mockActionParam1"), + //: The name of the ParamType (ThingClass: autoMock, EventType: event2, ID: {12ed5a15-96b4-4381-9d9c-a24875283d4f}) + QT_TRANSLATE_NOOP("mock", "mockParamInt"), - //: The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: {a2d3a256-a551-4712-a65b-ecd5a436a1cb}) - QT_TRANSLATE_NOOP("mockDevice", "mockActionParam1"), - - //: The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: {df41ba71-e43b-4854-91d1-b19d8066d4f9}) - QT_TRANSLATE_NOOP("mockDevice", "mockActionParam2"), - - //: The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: {304a4899-18be-4e3b-94f4-d03be52f3233}) - QT_TRANSLATE_NOOP("mockDevice", "mockActionParam2"), - - //: The name of the ParamType (DeviceClass: mockDeviceAuto, EventType: event2, ID: {12ed5a15-96b4-4381-9d9c-a24875283d4f}) - QT_TRANSLATE_NOOP("mockDevice", "mockParamInt"), - - //: The name of the ParamType (DeviceClass: mock, EventType: event2, ID: {0550e16d-60b9-4ba5-83f4-4d3cee656121}) - QT_TRANSLATE_NOOP("mockDevice", "mockParamInt"), + //: The name of the ParamType (ThingClass: mock, EventType: event2, ID: {0550e16d-60b9-4ba5-83f4-4d3cee656121}) + QT_TRANSLATE_NOOP("mock", "mockParamInt"), //: The name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6}) - QT_TRANSLATE_NOOP("mockDevice", "nymea"), + QT_TRANSLATE_NOOP("mock", "nymea"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, ActionType: percentage, ID: {527f0687-0b28-4c26-852c-25b8f83e4797}) - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the ParamType (ThingClass: displayPinMock, ActionType: percentage, ID: {527f0687-0b28-4c26-852c-25b8f83e4797}) + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, EventType: percentage, ID: {527f0687-0b28-4c26-852c-25b8f83e4797}) - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the ParamType (ThingClass: displayPinMock, EventType: percentage, ID: {527f0687-0b28-4c26-852c-25b8f83e4797}) + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the StateType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the StateType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the ParamType (DeviceClass: mockPushButton, ActionType: percentage, ID: {72981c04-267a-4ba0-a59e-9921d2f3af9c}) - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the ParamType (ThingClass: pushButtonMock, ActionType: percentage, ID: {72981c04-267a-4ba0-a59e-9921d2f3af9c}) + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the ParamType (DeviceClass: mockPushButton, EventType: percentage, ID: {72981c04-267a-4ba0-a59e-9921d2f3af9c}) - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the ParamType (ThingClass: pushButtonMock, EventType: percentage, ID: {72981c04-267a-4ba0-a59e-9921d2f3af9c}) + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the StateType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "percentage"), + //: The name of the StateType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "percentage"), - //: The name of the EventType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of DeviceClass mockDisplayPin - QT_TRANSLATE_NOOP("mockDevice", "percentage changed"), + //: The name of the EventType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of ThingClass displayPinMock + QT_TRANSLATE_NOOP("mock", "percentage changed"), - //: The name of the EventType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of DeviceClass mockPushButton - QT_TRANSLATE_NOOP("mockDevice", "percentage changed"), + //: The name of the EventType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of ThingClass pushButtonMock + QT_TRANSLATE_NOOP("mock", "percentage changed"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, Type: device, ID: {da820e07-22dc-4173-9c07-2f49a4e265f9}) - QT_TRANSLATE_NOOP("mockDevice", "pin"), + //: The name of the ParamType (ThingClass: displayPinMock, Type: thing, ID: {da820e07-22dc-4173-9c07-2f49a4e265f9}) + QT_TRANSLATE_NOOP("mock", "pin"), - //: The name of the ParamType (DeviceClass: mock, ActionType: power, ID: {064aed0d-da4c-49d4-b236-60f97e98ff84}) - QT_TRANSLATE_NOOP("mockDevice", "powered"), + //: The name of the ParamType (ThingClass: mock, ActionType: power, ID: {064aed0d-da4c-49d4-b236-60f97e98ff84}) + QT_TRANSLATE_NOOP("mock", "powered"), - //: The name of the ParamType (DeviceClass: mock, EventType: power, ID: {064aed0d-da4c-49d4-b236-60f97e98ff84}) - QT_TRANSLATE_NOOP("mockDevice", "powered"), + //: The name of the ParamType (ThingClass: mock, EventType: power, ID: {064aed0d-da4c-49d4-b236-60f97e98ff84}) + QT_TRANSLATE_NOOP("mock", "powered"), - //: The name of the StateType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "powered"), + //: The name of the StateType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "powered"), - //: The name of the EventType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "powered changed"), + //: The name of the EventType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "powered changed"), - //: The name of the ParamType (DeviceClass: mockDisplayPin, Type: discovery, ID: {35f6e4ba-28ad-4152-a58d-ec2600667bcf}) - QT_TRANSLATE_NOOP("mockDevice", "resultCount"), + //: The name of the ParamType (ThingClass: displayPinMock, Type: discovery, ID: {35f6e4ba-28ad-4152-a58d-ec2600667bcf}) + QT_TRANSLATE_NOOP("mock", "resultCount"), - //: The name of the ParamType (DeviceClass: mockPushButton, Type: discovery, ID: {c40dbc59-4bba-4871-9b8e-bbd8d5d9193b}) - QT_TRANSLATE_NOOP("mockDevice", "resultCount"), + //: The name of the ParamType (ThingClass: pushButtonMock, Type: discovery, ID: {c40dbc59-4bba-4871-9b8e-bbd8d5d9193b}) + QT_TRANSLATE_NOOP("mock", "resultCount"), - //: The name of the ParamType (DeviceClass: mock, Type: discovery, ID: {d222adb4-2f9c-4c3f-8655-76400d0fb6ce}) - QT_TRANSLATE_NOOP("mockDevice", "resultCount"), + //: The name of the ParamType (ThingClass: mock, Type: discovery, ID: {d222adb4-2f9c-4c3f-8655-76400d0fb6ce}) + QT_TRANSLATE_NOOP("mock", "resultCount"), - //: The name of the ActionType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of DeviceClass mock - QT_TRANSLATE_NOOP("mockDevice", "set power") + //: The name of the ActionType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of ThingClass mock + QT_TRANSLATE_NOOP("mock", "set power") }; #endif // PLUGININFO_H diff --git a/tests/auto/actions/testactions.cpp b/tests/auto/actions/testactions.cpp index ca3d443e..dc028e7b 100644 --- a/tests/auto/actions/testactions.cpp +++ b/tests/auto/actions/testactions.cpp @@ -92,7 +92,7 @@ void TestActions::executeAction() QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockDevice1Port))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -108,14 +108,14 @@ void TestActions::executeAction() // cleanup for the next run spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockDevice1Port))); + request.setUrl(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockThing1Port))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); reply->deleteLater(); spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockDevice1Port))); + request.setUrl(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index faf4edfe..3c5e589b 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -3,6 +3,7 @@ TEMPLATE = subdirs SUBDIRS = \ versioning \ devices \ + integrations \ jsonrpc \ events \ states \ diff --git a/tests/auto/devices/testdevices.cpp b/tests/auto/devices/testdevices.cpp index e7c65428..8397bbce 100644 --- a/tests/auto/devices/testdevices.cpp +++ b/tests/auto/devices/testdevices.cpp @@ -40,7 +40,7 @@ using namespace nymeaserver; -class TestDevices : public NymeaTestBase +class TestIntegrations : public NymeaTestBase { Q_OBJECT @@ -73,6 +73,10 @@ private slots: void addConfiguredDevice_data(); void addConfiguredDevice(); + void deviceAddedRemovedNotifications(); + + void deviceChangedNotifications(); + void getConfiguredDevices(); void getConfiguredDevice_data(); @@ -151,7 +155,7 @@ private slots: void discoverDeviceParenting(); }; -void TestDevices::initTestCase() +void TestIntegrations::initTestCase() { NymeaTestBase::initTestCase(); QLoggingCategory::setFilterRules("*.debug=false\n" @@ -167,12 +171,12 @@ void TestDevices::initTestCase() QVariantList deviceParams; QVariantMap asyncParam; - asyncParam.insert("paramTypeId", mockDeviceAsyncParamTypeId); + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); asyncParam.insert("value", true); deviceParams.append(asyncParam); QVariantMap httpParam; - httpParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpParam.insert("value", 8765); deviceParams.append(httpParam); @@ -186,7 +190,7 @@ void TestDevices::initTestCase() qCDebug(dcTests()) << "Created Async mock device with ID" << m_mockThingAsyncId; } -void TestDevices::getPlugins() +void TestIntegrations::getPlugins() { QVariant response = injectAndWait("Devices.GetPlugins"); @@ -202,7 +206,7 @@ void TestDevices::getPlugins() QCOMPARE(found, true); } -void TestDevices::getPluginConfig_data() +void TestIntegrations::getPluginConfig_data() { QTest::addColumn("pluginId"); QTest::addColumn("error"); @@ -211,7 +215,7 @@ void TestDevices::getPluginConfig_data() QTest::newRow("invalid plugin") << PluginId::createPluginId() << Device::DeviceErrorPluginNotFound; } -void TestDevices::getPluginConfig() +void TestIntegrations::getPluginConfig() { QFETCH(PluginId, pluginId); QFETCH(Device::DeviceError, error); @@ -222,7 +226,7 @@ void TestDevices::getPluginConfig() verifyDeviceError(response, error); } -void TestDevices::setPluginConfig_data() +void TestIntegrations::setPluginConfig_data() { QTest::addColumn("pluginId"); QTest::addColumn("value"); @@ -235,7 +239,7 @@ void TestDevices::setPluginConfig_data() QTest::newRow("wrong type") << mockPluginId << QVariant("wrontType") << Device::DeviceErrorInvalidParameter; } -void TestDevices::setPluginConfig() +void TestIntegrations::setPluginConfig() { QFETCH(PluginId, pluginId); QFETCH(QVariant, value); @@ -246,7 +250,7 @@ void TestDevices::setPluginConfig() QVariantList configuration; QVariantMap configParam; - configParam.insert("paramTypeId", mockDevicePluginConfigParamIntParamTypeId); + configParam.insert("paramTypeId", mockPluginConfigParamIntParamTypeId); configParam.insert("value", value); configuration.append(configParam); params.insert("configuration", configuration); @@ -259,12 +263,12 @@ void TestDevices::setPluginConfig() response = injectAndWait("Devices.GetPluginConfiguration", params); verifyDeviceError(response); qDebug() << value << response.toMap().value("params").toMap().value("configuration").toList().first(); - QVERIFY2(ParamTypeId(response.toMap().value("params").toMap().value("configuration").toList().first().toMap().value("paramTypeId").toString()) == mockDevicePluginConfigParamIntParamTypeId, "Value not set correctly"); + QVERIFY2(ParamTypeId(response.toMap().value("params").toMap().value("configuration").toList().first().toMap().value("paramTypeId").toString()) == mockPluginConfigParamIntParamTypeId, "Value not set correctly"); QVERIFY2(response.toMap().value("params").toMap().value("configuration").toList().first().toMap().value("value") == value, "Value not set correctly"); } } -void TestDevices::getSupportedVendors() +void TestIntegrations::getSupportedVendors() { QVariant supportedVendors = injectAndWait("Devices.GetSupportedVendors"); qDebug() << "response" << supportedVendors; @@ -274,24 +278,24 @@ void TestDevices::getSupportedVendors() QCOMPARE(vendorList.count() > 0, true); bool found = false; foreach (const QVariant &listEntry, vendorList) { - if (VendorId(listEntry.toMap().value("id").toString()) == guhVendorId) { + if (VendorId(listEntry.toMap().value("id").toString()) == nymeaVendorId) { found = true; } } QCOMPARE(found, true); } -void TestDevices::getSupportedDevices_data() +void TestIntegrations::getSupportedDevices_data() { QTest::addColumn("vendorId"); QTest::addColumn("resultCount"); - QTest::newRow("vendor guh") << guhVendorId << 1; + QTest::newRow("vendor guh") << nymeaVendorId << 1; QTest::newRow("no filter") << VendorId() << 1; QTest::newRow("invalid vendor") << VendorId("93e7d361-8025-4354-b17e-b68406c800bc") << 0; } -void TestDevices::getSupportedDevices() +void TestIntegrations::getSupportedDevices() { QFETCH(VendorId, vendorId); QFETCH(int, resultCount); @@ -307,10 +311,10 @@ void TestDevices::getSupportedDevices() QCOMPARE(supportedDevices.count() >= resultCount, true); } -void TestDevices::verifyInterfaces() +void TestIntegrations::verifyInterfaces() { QVariantMap params; - params.insert("vendorId", guhVendorId); + params.insert("vendorId", nymeaVendorId); QVariant result = injectAndWait("Devices.GetSupportedDevices", params); QVariantList supportedDevices = result.toMap().value("params").toMap().value("deviceClasses").toList(); @@ -333,7 +337,7 @@ void TestDevices::verifyInterfaces() QVERIFY(!interfaces.contains("gateway")); } -void TestDevices::addConfiguredDevice_data() +void TestIntegrations::addConfiguredDevice_data() { QTest::addColumn("thingClassId"); QTest::addColumn("deviceParams"); @@ -341,13 +345,13 @@ void TestDevices::addConfiguredDevice_data() QTest::addColumn("deviceError"); QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId.toString()); - httpportParam.insert("value", m_mockDevice1Port - 1); + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId.toString()); + httpportParam.insert("value", m_mockThing1Port - 1); QVariantMap asyncParam; - asyncParam.insert("paramTypeId", mockDeviceAsyncParamTypeId); + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); asyncParam.insert("value", true); QVariantMap brokenParam; - brokenParam.insert("paramTypeId", mockDeviceBrokenParamTypeId); + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); brokenParam.insert("value", true); QVariantList deviceParams; @@ -371,7 +375,7 @@ void TestDevices::addConfiguredDevice_data() QTest::newRow("User, JustAdd, invalid param") << mockThingClassId << invalidDeviceParams << false << Device::DeviceErrorMissingParameter; QVariantMap fakeparam2; - fakeparam2.insert("paramTypeId", mockDeviceHttpportParamTypeId.toString()); + fakeparam2.insert("paramTypeId", mockThingHttpportParamTypeId.toString()); fakeparam2.insert("value", "blabla"); invalidDeviceParams.clear(); invalidDeviceParams.append(fakeparam2); @@ -385,7 +389,7 @@ void TestDevices::addConfiguredDevice_data() } -void TestDevices::addConfiguredDevice() +void TestIntegrations::addConfiguredDevice() { QFETCH(ThingClassId, thingClassId); QFETCH(QVariantList, deviceParams); @@ -413,7 +417,135 @@ void TestDevices::addConfiguredDevice() } } -void TestDevices::getConfiguredDevices() +void TestIntegrations::deviceAddedRemovedNotifications() +{ + enableNotifications({"Devices"}); + + // Setup connection to mock client + QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // add device and wait for notification + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 5678); + deviceParams.append(httpportParam); + + QVariantMap params; clientSpy.clear(); + params.insert("deviceClassId", mockThingClassId); + params.insert("name", "Mock device"); + params.insert("deviceParams", deviceParams); + QVariant response = injectAndWait("Devices.AddConfiguredDevice", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + QVariantMap notificationDeviceMap = checkNotification(clientSpy, "Devices.DeviceAdded").toMap().value("params").toMap().value("device").toMap(); + + ThingId deviceId = ThingId(response.toMap().value("params").toMap().value("deviceId").toString()); + QVERIFY(!deviceId.isNull()); + + // check the DeviceAdded notification + QCOMPARE(notificationDeviceMap.value("deviceClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(notificationDeviceMap.value("id").toUuid(), QUuid(deviceId)); + foreach (const QVariant ¶m, notificationDeviceMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); + } + } + + // now remove the device and check the device removed notification + params.clear(); response.clear(); clientSpy.clear(); + params.insert("deviceId", deviceId); + response = injectAndWait("Devices.RemoveConfiguredDevice", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + checkNotification(clientSpy, "Devices.DeviceRemoved"); + + QCOMPARE(disableNotifications(), true); +} + +void TestIntegrations::deviceChangedNotifications() +{ + enableNotifications({"Devices"}); + + // Setup connection to mock client + QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // ADD + // add device and wait for notification + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 23234); + deviceParams.append(httpportParam); + + clientSpy.clear(); + QVariantMap params; + params.insert("deviceClassId", mockThingClassId); + params.insert("name", "Mock"); + params.insert("deviceParams", deviceParams); + QVariant response = injectAndWait("Devices.AddConfiguredDevice", params); + ThingId deviceId = ThingId(response.toMap().value("params").toMap().value("deviceId").toString()); + QVERIFY(!deviceId.isNull()); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + QVariantMap notificationDeviceMap = checkNotification(clientSpy, "Devices.DeviceAdded").toMap().value("params").toMap().value("device").toMap(); + + QCOMPARE(notificationDeviceMap.value("deviceClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(notificationDeviceMap.value("id").toUuid(), QUuid(deviceId)); + foreach (const QVariant ¶m, notificationDeviceMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); + } + } + + // RECONFIGURE + // now reconfigure the device and check the deviceChanged notification + QVariantList newDeviceParams; + QVariantMap newHttpportParam; + newHttpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + newHttpportParam.insert("value", 45473); + newDeviceParams.append(newHttpportParam); + + params.clear(); response.clear(); clientSpy.clear(); + params.insert("deviceId", deviceId); + params.insert("deviceParams", newDeviceParams); + response = injectAndWait("Devices.ReconfigureDevice", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + QVariantMap reconfigureDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceChanged").toMap().value("params").toMap().value("device").toMap(); + QCOMPARE(reconfigureDeviceNotificationMap.value("deviceClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(reconfigureDeviceNotificationMap.value("id").toUuid(), QUuid(deviceId)); + foreach (const QVariant ¶m, reconfigureDeviceNotificationMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), newHttpportParam.value("value").toInt()); + } + } + + // EDIT device name + QString deviceName = "Test device 1234"; + params.clear(); response.clear(); clientSpy.clear(); + params.insert("deviceId", deviceId); + params.insert("name", deviceName); + response = injectAndWait("Devices.EditDevice", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + QVariantMap editDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceChanged").toMap().value("params").toMap().value("device").toMap(); + QCOMPARE(editDeviceNotificationMap.value("deviceClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(editDeviceNotificationMap.value("id").toUuid(), QUuid(deviceId)); + QCOMPARE(editDeviceNotificationMap.value("name").toString(), deviceName); + + // REMOVE + // now remove the device and check the device removed notification + params.clear(); response.clear(); clientSpy.clear(); + params.insert("deviceId", deviceId); + response = injectAndWait("Devices.RemoveConfiguredDevice", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyDeviceError(response); + checkNotification(clientSpy, "Devices.DeviceRemoved"); + checkNotification(clientSpy, "Logging.LogDatabaseUpdated"); +} + +void TestIntegrations::getConfiguredDevices() { QVariant response = injectAndWait("Devices.GetConfiguredDevices"); @@ -421,7 +553,7 @@ void TestDevices::getConfiguredDevices() QCOMPARE(devices.count(), 3); // There should be: one auto created mock device, one created in NymeaTestBase::initTestcase() and one created in TestDevices::initTestCase() } -void TestDevices::getConfiguredDevice_data() +void TestIntegrations::getConfiguredDevice_data() { QTest::addColumn("deviceId"); QTest::addColumn("expectedError"); @@ -430,7 +562,7 @@ void TestDevices::getConfiguredDevice_data() QTest::newRow("invalid deviceId") << DeviceId::createDeviceId() << Device::DeviceErrorDeviceNotFound; } -void TestDevices::getConfiguredDevice() +void TestIntegrations::getConfiguredDevice() { QFETCH(DeviceId, deviceId); QFETCH(Device::DeviceError, expectedError); @@ -439,7 +571,7 @@ void TestDevices::getConfiguredDevice() params.insert("deviceId", deviceId); QVariant response = injectAndWait("Devices.GetConfiguredDevices", params); - qCDebug(dcTests()) << qUtf8Printable(QJsonDocument::fromVariant(response).toJson()); +// qCDebug(dcTests()) << qUtf8Printable(QJsonDocument::fromVariant(response).toJson()); if (expectedError == Device::DeviceErrorNoError) { QVariantList devices = response.toMap().value("params").toMap().value("devices").toList(); @@ -447,22 +579,22 @@ void TestDevices::getConfiguredDevice() } } -void TestDevices::storedDevices() +void TestIntegrations::storedDevices() { QVariantMap params; params.insert("deviceClassId", mockThingClassId); params.insert("name", "Test stored Device"); QVariantList deviceParams; QVariantMap asyncParam; - asyncParam.insert("paramTypeId", mockDeviceAsyncParamTypeId); + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); asyncParam.insert("value", false); deviceParams.append(asyncParam); QVariantMap brokenParam; - brokenParam.insert("paramTypeId", mockDeviceBrokenParamTypeId); + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); brokenParam.insert("value", false); deviceParams.append(brokenParam); QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpportParam.insert("value", 8889); deviceParams.append(httpportParam); params.insert("deviceParams", deviceParams); @@ -495,7 +627,7 @@ void TestDevices::storedDevices() verifyDeviceError(response); } -void TestDevices::discoverDevices_data() +void TestIntegrations::discoverDevices_data() { QTest::addColumn("thingClassId"); QTest::addColumn("resultCount"); @@ -513,7 +645,7 @@ void TestDevices::discoverDevices_data() QTest::newRow("invalid ThingClassId") << ThingClassId::createThingClassId() << 0 << Device::DeviceErrorDeviceClassNotFound << QVariantList(); } -void TestDevices::discoverDevices() +void TestIntegrations::discoverDevices() { QFETCH(ThingClassId, thingClassId); QFETCH(int, resultCount); @@ -550,17 +682,17 @@ void TestDevices::discoverDevices() } } -void TestDevices::addPushButtonDevices_data() +void TestIntegrations::addPushButtonDevices_data() { QTest::addColumn("thingClassId"); QTest::addColumn("error"); QTest::addColumn("waitForButtonPressed"); - QTest::newRow("Valid: Add PushButton device") << mockPushButtonThingClassId << Device::DeviceErrorNoError << true; - QTest::newRow("Invalid: Add PushButton device (press to early)") << mockPushButtonThingClassId << Device::DeviceErrorAuthenticationFailure << false; + QTest::newRow("Valid: Add PushButton device") << pushButtonMockThingClassId << Device::DeviceErrorNoError << true; + QTest::newRow("Invalid: Add PushButton device (press to early)") << pushButtonMockThingClassId << Device::DeviceErrorAuthenticationFailure << false; } -void TestDevices::addPushButtonDevices() +void TestIntegrations::addPushButtonDevices() { QFETCH(ThingClassId, thingClassId); QFETCH(Device::DeviceError, error); @@ -569,7 +701,7 @@ void TestDevices::addPushButtonDevices() // Discover device QVariantList discoveryParams; QVariantMap resultCountParam; - resultCountParam.insert("paramTypeId", mockPushButtonDiscoveryResultCountParamTypeId); + resultCountParam.insert("paramTypeId", pushButtonMockDiscoveryResultCountParamTypeId); resultCountParam.insert("value", 1); discoveryParams.append(resultCountParam); @@ -616,17 +748,17 @@ void TestDevices::addPushButtonDevices() } } -void TestDevices::addDisplayPinDevices_data() +void TestIntegrations::addDisplayPinDevices_data() { QTest::addColumn("thingClassId"); QTest::addColumn("error"); QTest::addColumn("secret"); - QTest::newRow("Valid: Add DisplayPin device") << mockDisplayPinThingClassId << Device::DeviceErrorNoError << "243681"; - QTest::newRow("Invalid: Add DisplayPin device (wrong pin)") << mockDisplayPinThingClassId << Device::DeviceErrorAuthenticationFailure << "243682"; + QTest::newRow("Valid: Add DisplayPin device") << displayPinMockThingClassId << Device::DeviceErrorNoError << "243681"; + QTest::newRow("Invalid: Add DisplayPin device (wrong pin)") << displayPinMockThingClassId << Device::DeviceErrorAuthenticationFailure << "243682"; } -void TestDevices::addDisplayPinDevices() +void TestIntegrations::addDisplayPinDevices() { QFETCH(ThingClassId, thingClassId); QFETCH(Device::DeviceError, error); @@ -635,7 +767,7 @@ void TestDevices::addDisplayPinDevices() // Discover device QVariantList discoveryParams; QVariantMap resultCountParam; - resultCountParam.insert("paramTypeId", mockDisplayPinDiscoveryResultCountParamTypeId); + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); resultCountParam.insert("value", 1); discoveryParams.append(resultCountParam); @@ -680,11 +812,11 @@ void TestDevices::addDisplayPinDevices() } -void TestDevices::parentChildDevices() +void TestIntegrations::parentChildDevices() { // add parent device QVariantMap params; - params.insert("deviceClassId", mockParentThingClassId); + params.insert("deviceClassId", parentMockThingClassId); params.insert("name", "Parent device"); QSignalSpy deviceAddedSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); @@ -707,14 +839,17 @@ void TestDevices::parentChildDevices() foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { - if (deviceMap.value("parentId") == parentId.toString()) { + if (deviceMap.value("deviceClassId").toUuid() == childMockThingClassId) { + if (deviceMap.value("parentId").toUuid() == parentId) { childDeviceId = DeviceId(deviceMap.value("id").toString()); break; } } } - QVERIFY2(!childDeviceId.isNull(), "Could not find child device"); + QVERIFY2(!childDeviceId.isNull(), QString("Could not find child device:\nParent ID:%1\nResponse:%2") + .arg(parentId.toString()) + .arg(qUtf8Printable(QJsonDocument::fromVariant(response).toJson())) + .toUtf8()); // Try to remove the child device params.clear(); @@ -728,8 +863,8 @@ void TestDevices::parentChildDevices() bool found = false; foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { - if (deviceMap.value("id") == childDeviceId.toString()) { + if (deviceMap.value("deviceClassId").toUuid() == childMockThingClassId) { + if (deviceMap.value("id").toUuid() == childDeviceId) { found = true; break; } @@ -749,7 +884,7 @@ void TestDevices::parentChildDevices() found = false; foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { + if (deviceMap.value("deviceClassId").toString() == childMockThingClassId.toString()) { if (deviceMap.value("id") == childDeviceId.toString()) { found = true; break; @@ -759,7 +894,7 @@ void TestDevices::parentChildDevices() QVERIFY2(!found, "Could not find child device."); } -void TestDevices::getActionTypes_data() +void TestIntegrations::getActionTypes_data() { QTest::addColumn("thingClassId"); QTest::addColumn >("actionTypeTestData"); @@ -769,7 +904,7 @@ void TestDevices::getActionTypes_data() QTest::newRow("invalid deviceclass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << QList(); } -void TestDevices::getActionTypes() +void TestIntegrations::getActionTypes() { QFETCH(ThingClassId, thingClassId); QFETCH(QList, actionTypeTestData); @@ -783,7 +918,7 @@ void TestDevices::getActionTypes() foreach (const ActionTypeId &testDataId, actionTypeTestData) { bool found = false; foreach (const QVariant &at, actionTypes) { - if (testDataId.toString() == at.toMap().value("id").toString()) { + if (testDataId == at.toMap().value("id").toUuid()) { found = true; break; } @@ -792,7 +927,7 @@ void TestDevices::getActionTypes() } } -void TestDevices::getEventTypes_data() +void TestIntegrations::getEventTypes_data() { QTest::addColumn("deviceClassId"); QTest::addColumn("resultCount"); @@ -801,7 +936,7 @@ void TestDevices::getEventTypes_data() QTest::newRow("invalid deviceclass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << 0; } -void TestDevices::getEventTypes() +void TestIntegrations::getEventTypes() { QFETCH(ThingClassId, deviceClassId); QFETCH(int, resultCount); @@ -817,7 +952,7 @@ void TestDevices::getEventTypes() } -void TestDevices::getStateTypes_data() +void TestIntegrations::getStateTypes_data() { QTest::addColumn("thingClassId"); QTest::addColumn("resultCount"); @@ -826,7 +961,7 @@ void TestDevices::getStateTypes_data() QTest::newRow("invalid deviceclass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << 0; } -void TestDevices::getStateTypes() +void TestIntegrations::getStateTypes() { QFETCH(ThingClassId, thingClassId); QFETCH(int, resultCount); @@ -842,7 +977,7 @@ void TestDevices::getStateTypes() } } -void TestDevices::getStateType_data() +void TestIntegrations::getStateType_data() { QTest::addColumn("stateTypeId"); QTest::addColumn("error"); @@ -852,7 +987,7 @@ void TestDevices::getStateType_data() QTest::newRow("invalid stateTypeId") << StateTypeId::createStateTypeId() << Device::DeviceErrorStateTypeNotFound; } -void TestDevices::getStateType() +void TestIntegrations::getStateType() { QFETCH(StateTypeId, stateTypeId); QFETCH(Device::DeviceError, error); @@ -871,7 +1006,7 @@ void TestDevices::getStateType() QCOMPARE(stateType.value("id").toUuid().toString(), stateTypeId.toString()); } -void TestDevices::getStateValue_data() +void TestIntegrations::getStateValue_data() { QTest::addColumn("deviceId"); QTest::addColumn("stateTypeId"); @@ -882,7 +1017,7 @@ void TestDevices::getStateValue_data() QTest::newRow("invalid statetypeId") << DeviceId(m_mockThingId) << StateTypeId("120514f1-343e-4621-9bff-dac616169df9") << Device::DeviceErrorStateTypeNotFound; } -void TestDevices::getStateValue() +void TestIntegrations::getStateValue() { QFETCH(DeviceId, deviceId); QFETCH(StateTypeId, stateTypeId); @@ -900,7 +1035,7 @@ void TestDevices::getStateValue() } } -void TestDevices::getStateValues_data() +void TestIntegrations::getStateValues_data() { QTest::addColumn("deviceId"); QTest::addColumn("statusCode"); @@ -909,7 +1044,7 @@ void TestDevices::getStateValues_data() QTest::newRow("invalid deviceId") << DeviceId("094f8024-5caa-48c1-ab6a-de486a92088f") << Device::DeviceErrorDeviceNotFound; } -void TestDevices::getStateValues() +void TestIntegrations::getStateValues() { QFETCH(DeviceId, deviceId); QFETCH(Device::DeviceError, statusCode); @@ -925,7 +1060,7 @@ void TestDevices::getStateValues() } } -void TestDevices::editDevices_data() +void TestIntegrations::editDevices_data() { QTest::addColumn("name"); @@ -934,7 +1069,7 @@ void TestDevices::editDevices_data() QTest::newRow("change name") << "Bar device"; } -void TestDevices::editDevices() +void TestIntegrations::editDevices() { QFETCH(QString, name); @@ -943,7 +1078,7 @@ void TestDevices::editDevices() // add device QVariantList deviceParams; QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpportParam.insert("value", 8889); deviceParams.append(httpportParam); @@ -996,12 +1131,12 @@ void TestDevices::editDevices() verifyDeviceError(response); } -void TestDevices::testDeviceSettings() +void TestIntegrations::testDeviceSettings() { // add device QVariantList deviceParams; QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpportParam.insert("value", 8889); deviceParams.append(httpportParam); @@ -1026,7 +1161,7 @@ void TestDevices::testDeviceSettings() QVariantList settings = device.value("settings").toList(); QCOMPARE(settings.count(), 1); - QCOMPARE(settings.first().toMap().value("paramTypeId").toString(), mockSettingsSetting1ParamTypeId.toString()); + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); QVERIFY2(settings.first().toMap().value("value").toInt() == 5, "Setting 1 default value not matching"); // change a setting @@ -1053,7 +1188,7 @@ void TestDevices::testDeviceSettings() settings = device.value("settings").toList(); QCOMPARE(settings.count(), 1); - QCOMPARE(settings.first().toMap().value("paramTypeId").toString(), mockSettingsSetting1ParamTypeId.toString()); + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); QVERIFY2(settings.first().toMap().value("value").toInt() == 7, "Setting 1 changed value not matching"); restartServer(); @@ -1071,28 +1206,28 @@ void TestDevices::testDeviceSettings() settings = device.value("settings").toList(); QCOMPARE(settings.count(), 1); - QCOMPARE(settings.first().toMap().value("paramTypeId").toString(), mockSettingsSetting1ParamTypeId.toString()); + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); QVERIFY2(settings.first().toMap().value("value").toInt() == 7, "Setting 1 changed value not persisting restart"); } -void TestDevices::reconfigureDevices_data() +void TestIntegrations::reconfigureDevices_data() { QVariantList asyncChangeDeviceParams; QVariantMap asyncParamDifferent; - asyncParamDifferent.insert("paramTypeId", mockDeviceAsyncParamTypeId); + asyncParamDifferent.insert("paramTypeId", mockThingAsyncParamTypeId); asyncParamDifferent.insert("value", true); asyncChangeDeviceParams.append(asyncParamDifferent); QVariantList httpportChangeDeviceParams; QVariantMap httpportParamDifferent; - httpportParamDifferent.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpportParamDifferent.insert("paramTypeId", mockThingHttpportParamTypeId); httpportParamDifferent.insert("value", 8893); // if change -> change also newPort in reconfigureDevices() httpportChangeDeviceParams.append(httpportParamDifferent); QVariantList brokenChangedDeviceParams; QVariantMap brokenParamDifferent; - brokenParamDifferent.insert("paramTypeId", mockDeviceBrokenParamTypeId); + brokenParamDifferent.insert("paramTypeId", mockThingBrokenParamTypeId); brokenParamDifferent.insert("value", true); brokenChangedDeviceParams.append(brokenParamDifferent); @@ -1115,7 +1250,7 @@ void TestDevices::reconfigureDevices_data() QTest::newRow("invalid - change all params (except broken)") << false << changeAllWritableDeviceParams << Device::DeviceErrorParameterNotWritable; } -void TestDevices::reconfigureDevices() +void TestIntegrations::reconfigureDevices() { QFETCH(bool, broken); QFETCH(QVariantList, newDeviceParams); @@ -1127,15 +1262,15 @@ void TestDevices::reconfigureDevices() params.insert("name", "Device to edit"); QVariantList deviceParams; QVariantMap asyncParam; - asyncParam.insert("paramTypeId", mockDeviceAsyncParamTypeId); + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); asyncParam.insert("value", false); deviceParams.append(asyncParam); QVariantMap brokenParam; - brokenParam.insert("paramTypeId", mockDeviceBrokenParamTypeId); + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); brokenParam.insert("value", broken); deviceParams.append(brokenParam); QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpportParam.insert("value", 8892); deviceParams.append(httpportParam); params.insert("deviceParams", deviceParams); @@ -1241,7 +1376,7 @@ void TestDevices::reconfigureDevices() } -void TestDevices::reconfigureByDiscovery_data() +void TestIntegrations::reconfigureByDiscovery_data() { QTest::addColumn("thingClassId"); QTest::addColumn("resultCount"); @@ -1257,7 +1392,7 @@ void TestDevices::reconfigureByDiscovery_data() QTest::newRow("discover 2 devices with params") << mockThingClassId << 2 << Device::DeviceErrorNoError << discoveryParams; } -void TestDevices::reconfigureByDiscovery() +void TestIntegrations::reconfigureByDiscovery() { QFETCH(ThingClassId, thingClassId); QFETCH(int, resultCount); @@ -1335,7 +1470,7 @@ void TestDevices::reconfigureByDiscovery() params.insert("deviceDescriptorId", descriptorId); // override port param QVariantMap portParam; - portParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + portParam.insert("paramTypeId", mockThingHttpportParamTypeId); portParam.insert("value", "55556"); params.insert("deviceParams", QVariantList() << portParam); response = injectAndWait("Devices.ReconfigureDevice", params); @@ -1356,13 +1491,13 @@ void TestDevices::reconfigureByDiscovery() } QVERIFY2(found, "Device missing in config!"); - QCOMPARE(deviceMap.value("id").toString(), deviceId.toString()); + QCOMPARE(deviceMap.value("id").toUuid(), QUuid(deviceId)); if (deviceMap.contains("setupComplete")) QVERIFY2(deviceMap.value("setupComplete").toBool(), "Setup not completed after edit"); // Note: this shows that by discovery a not editable param (name) can be changed! foreach (QVariant param, deviceMap.value("params").toList()) { - if (param.toMap().value("paramTypeId") == mockDeviceHttpportParamTypeId) { + if (param.toMap().value("paramTypeId") == mockThingHttpportParamTypeId) { QCOMPARE(param.toMap().value("value").toInt(), 55556); } } @@ -1391,18 +1526,18 @@ void TestDevices::reconfigureByDiscovery() verifyDeviceError(response); } -void TestDevices::reconfigureByDiscoveryAndPair() +void TestIntegrations::reconfigureByDiscoveryAndPair() { QVariantList discoveryParams; QVariantMap resultCountParam; - resultCountParam.insert("paramTypeId", mockDisplayPinDiscoveryResultCountParamTypeId); + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); resultCountParam.insert("value", 1); discoveryParams.append(resultCountParam); qCDebug(dcTests()) << "Discovering devices..."; QVariantMap params; - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("discoveryParams", discoveryParams); QVariant response = injectAndWait("Devices.GetDiscoveredDevices", params); @@ -1422,7 +1557,7 @@ void TestDevices::reconfigureByDiscoveryAndPair() params.clear(); response.clear(); - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("name", "Discoverd mock device"); params.insert("deviceDescriptorId", descriptorId); response = injectAndWait("Devices.PairDevice", params); @@ -1447,7 +1582,7 @@ void TestDevices::reconfigureByDiscoveryAndPair() // and now rediscover, and edit the first device with the second params.clear(); response.clear(); - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("discoveryParams", discoveryParams); response = injectAndWait("Devices.GetDiscoveredDevices", params); @@ -1469,7 +1604,7 @@ void TestDevices::reconfigureByDiscoveryAndPair() params.clear(); response.clear(); - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("name", "Discoverd mock device"); params.insert("deviceDescriptorId", descriptorId); response = injectAndWait("Devices.PairDevice", params); @@ -1492,18 +1627,18 @@ void TestDevices::reconfigureByDiscoveryAndPair() } -void TestDevices::reconfigureAutodevice() +void TestIntegrations::reconfigureAutodevice() { qCDebug(dcTests()) << "Reconfigure auto device"; // Get the autodevice - QList devices = NymeaCore::instance()->thingManager()->findConfiguredThings(mockDeviceAutoThingClassId); + QList devices = NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId); QVERIFY2(devices.count() > 0, "There needs to be at least one auto-created Mock Device for this test"); // Get current auto device infos Thing *currentDevice = devices.first(); DeviceId deviceId = currentDevice->id(); - int currentPort = currentDevice->paramValue(mockDeviceAutoDeviceHttpportParamTypeId).toInt(); + int currentPort = currentDevice->paramValue(autoMockThingHttpportParamTypeId).toInt(); // Trigger reconfigure signal in mock device QNetworkAccessManager *nam = new QNetworkAccessManager(this); @@ -1515,13 +1650,13 @@ void TestDevices::reconfigureAutodevice() Thing *device = NymeaCore::instance()->thingManager()->findConfiguredThing(deviceId); QVERIFY(device); - int newPort = device->paramValue(mockDeviceAutoDeviceHttpportParamTypeId).toInt(); + int newPort = device->paramValue(autoMockThingHttpportParamTypeId).toInt(); // Note: reconfigure autodevice increases the http port by 1 QCOMPARE(newPort, currentPort + 1); } -void TestDevices::removeDevice_data() +void TestIntegrations::removeDevice_data() { QTest::addColumn("deviceId"); QTest::addColumn("deviceError"); @@ -1531,7 +1666,7 @@ void TestDevices::removeDevice_data() // QTest::newRow("Auto device") << m_mockDeviceAutoId << Device::DeviceErrorCreationMethodNotSupported; } -void TestDevices::removeDevice() +void TestIntegrations::removeDevice() { QFETCH(DeviceId, deviceId); QFETCH(Device::DeviceError, deviceError); @@ -1557,7 +1692,7 @@ void TestDevices::removeDevice() } } -void TestDevices::removeAutoDevice() +void TestIntegrations::removeAutoDevice() { // Setup connection to mock client QNetworkAccessManager *nam = new QNetworkAccessManager(this); @@ -1571,7 +1706,7 @@ void TestDevices::removeAutoDevice() Thing *device = devices.first(); // trigger disappear signal in mock device - int port = device->paramValue(mockDeviceAutoDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(autoMockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/disappear").arg(port))); QNetworkReply *reply = nam->get(request); spy.wait(); @@ -1581,14 +1716,14 @@ void TestDevices::removeAutoDevice() // Ok, now do the same with an autocreated one. It should go away - devices = NymeaCore::instance()->thingManager()->findConfiguredThings(mockDeviceAutoThingClassId); + devices = NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId); oldCount = devices.count(); QVERIFY2(oldCount > 0, "There needs to be at least one auto-created Mock Device for this test"); device = devices.first(); // trigger disappear signal in mock device spy.clear(); - port = device->paramValue(mockDeviceAutoDeviceHttpportParamTypeId).toInt(); + port = device->paramValue(autoMockThingHttpportParamTypeId).toInt(); request.setUrl(QUrl(QString("http://localhost:%1/disappear").arg(port))); reply = nam->get(request); @@ -1597,10 +1732,10 @@ void TestDevices::removeAutoDevice() reply->deleteLater(); // Make sure one mock device has disappeared - QCOMPARE(NymeaCore::instance()->thingManager()->findConfiguredThings(mockDeviceAutoThingClassId).count(), oldCount - 1); + QCOMPARE(NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId).count(), oldCount - 1); } -void TestDevices::testBrowsing_data() +void TestIntegrations::testBrowsing_data() { QTest::addColumn("deviceId"); @@ -1608,7 +1743,7 @@ void TestDevices::testBrowsing_data() QTest::newRow("async mock device") << DeviceId(m_mockThingAsyncId); } -void TestDevices::testBrowsing() +void TestIntegrations::testBrowsing() { QFETCH(DeviceId, deviceId); @@ -1651,10 +1786,10 @@ void TestDevices::testBrowsing() } -void TestDevices::discoverDeviceParenting() +void TestIntegrations::discoverDeviceParenting() { // Try to discover a mock child device. We don't have a mockParent yet, so it should fail - ThingDiscoveryInfo *discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(mockChildThingClassId, ParamList()); + ThingDiscoveryInfo *discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(childMockThingClassId, ParamList()); { QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); spy.wait(); @@ -1663,7 +1798,7 @@ void TestDevices::discoverDeviceParenting() // Now create a mock parent by discovering... - discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(mockParentThingClassId, ParamList()); + discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(parentMockThingClassId, ParamList()); { QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); spy.wait(); @@ -1684,11 +1819,11 @@ void TestDevices::discoverDeviceParenting() Thing *parentDevice = addSpy.at(0).first().value(); qCDebug(dcTests()) << "Added device:" << parentDevice->name(); - QVERIFY(parentDevice->thingClassId() == mockParentThingClassId); + QVERIFY(parentDevice->thingClassId() == parentMockThingClassId); // Ok we have our parent device, let's discover for childs again - discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(mockChildThingClassId, ParamList()); + discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(childMockThingClassId, ParamList()); { QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); spy.wait(); @@ -1709,7 +1844,7 @@ void TestDevices::discoverDeviceParenting() Thing *childDevice = addSpy.at(0).first().value(); qCDebug(dcTests()) << "Added device:" << childDevice->name(); - QVERIFY(childDevice->thingClassId() == mockChildThingClassId); + QVERIFY(childDevice->thingClassId() == childMockThingClassId); // Now delete the parent and make sure the child will be deleted too QSignalSpy removeSpy(NymeaCore::instance(), &NymeaCore::thingRemoved); @@ -1719,7 +1854,7 @@ void TestDevices::discoverDeviceParenting() } -void TestDevices::testExecuteBrowserItem_data() +void TestIntegrations::testExecuteBrowserItem_data() { QTest::addColumn("deviceId"); QTest::addColumn("itemId"); @@ -1730,7 +1865,7 @@ void TestDevices::testExecuteBrowserItem_data() QTest::newRow("async mock device") << DeviceId(m_mockThingAsyncId) << "002" << "DeviceErrorNoError"; } -void TestDevices::testExecuteBrowserItem() +void TestIntegrations::testExecuteBrowserItem() { QFETCH(DeviceId, deviceId); QFETCH(QString, itemId); @@ -1745,7 +1880,7 @@ void TestDevices::testExecuteBrowserItem() QCOMPARE(response.toMap().value("params").toMap().value("deviceError").toString(), deviceError); } -void TestDevices::testExecuteBrowserItemAction_data() +void TestIntegrations::testExecuteBrowserItemAction_data() { QTest::addColumn("deviceId"); @@ -1753,7 +1888,7 @@ void TestDevices::testExecuteBrowserItemAction_data() QTest::newRow("async mock device") << DeviceId(m_mockThingAsyncId); } -void TestDevices::testExecuteBrowserItemAction() +void TestIntegrations::testExecuteBrowserItemAction() { QFETCH(DeviceId, deviceId); @@ -1824,7 +1959,7 @@ void TestDevices::testExecuteBrowserItemAction() } -void TestDevices::executeAction_data() +void TestIntegrations::executeAction_data() { QTest::addColumn("deviceId"); QTest::addColumn("actionTypeId"); @@ -1850,7 +1985,7 @@ void TestDevices::executeAction_data() QTest::newRow("async broken action") << DeviceId(m_mockThingId) << mockAsyncFailingActionTypeId << QVariantList() << Device::DeviceErrorSetupFailed; } -void TestDevices::executeAction() +void TestIntegrations::executeAction() { QFETCH(DeviceId, deviceId); QFETCH(ActionTypeId, actionTypeId); @@ -1869,7 +2004,7 @@ void TestDevices::executeAction() QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockDevice1Port))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1885,14 +2020,14 @@ void TestDevices::executeAction() // cleanup for the next run spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockDevice1Port))); + request.setUrl(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockThing1Port))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); reply->deleteLater(); spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockDevice1Port))); + request.setUrl(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1902,7 +2037,7 @@ void TestDevices::executeAction() } -void TestDevices::triggerEvent() +void TestIntegrations::triggerEvent() { enableNotifications({"Devices"}); QList devices = NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId); @@ -1917,7 +2052,7 @@ void TestDevices::triggerEvent() QNetworkAccessManager nam; // trigger event in mock device - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); @@ -1943,7 +2078,7 @@ void TestDevices::triggerEvent() QCOMPARE(notificationContent.value("event").toMap().value("eventTypeId").toUuid().toString(), mockEvent1EventTypeId.toString()); } -void TestDevices::triggerStateChangeEvent() +void TestIntegrations::triggerStateChangeEvent() { enableNotifications({"Devices"}); @@ -1958,7 +2093,7 @@ void TestDevices::triggerStateChangeEvent() QNetworkAccessManager nam; // trigger state changed event in mock device - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(port).arg(mockIntStateTypeId.toString()).arg(11))); QNetworkReply *reply = nam.get(request); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); @@ -1986,7 +2121,7 @@ void TestDevices::triggerStateChangeEvent() } -void TestDevices::params() +void TestIntegrations::params() { Event event; ParamList params; @@ -1999,7 +2134,7 @@ void TestDevices::params() QVERIFY(!event.param(ParamTypeId::createParamTypeId()).value().isValid()); } -void TestDevices::asyncSetupEmitsSetupStatusUpdate() +void TestIntegrations::asyncSetupEmitsSetupStatusUpdate() { QVariantMap configuredDevices = injectAndWait("Devices.GetConfiguredDevices").toMap(); foreach (const QVariant &deviceVariant, configuredDevices.value("params").toMap().value("devices").toList()) { @@ -2018,7 +2153,7 @@ void TestDevices::asyncSetupEmitsSetupStatusUpdate() foreach (const QVariant &deviceVariant, configuredDevices.value("params").toMap().value("devices").toList()) { QVariantMap device = deviceVariant.toMap(); qCDebug(dcTests()) << "Configured device" << device.value("name").toString() << "with setup status" << device.value("setupStatus").toString(); - if (device.value("setupStatus").toString() == "DeviceSetupStatusInProgress") { + if (device.value("setupStatus").toString() == "ThingSetupStatusInProgress") { devicesWithSetupInProgress << device.value("id").toUuid(); } } @@ -2032,7 +2167,7 @@ void TestDevices::asyncSetupEmitsSetupStatusUpdate() QVariantMap notification = QJsonDocument::fromJson(notificationData).toVariant().toMap(); if (notification.value("notification").toString() == "Devices.DeviceChanged") { QString setupStatus = notification.value("params").toMap().value("device").toMap().value("setupStatus").toString(); - if (setupStatus == "DeviceSetupStatusComplete") { + if (setupStatus == "ThingSetupStatusComplete") { qCDebug(dcTests()) << "Device setup completed for" << notification.value("params").toMap().value("device").toMap().value("name").toString(); DeviceId deviceId = notification.value("params").toMap().value("device").toMap().value("id").toUuid(); devicesWithSetupInProgress.removeAll(deviceId); @@ -2049,5 +2184,5 @@ void TestDevices::asyncSetupEmitsSetupStatusUpdate() } #include "testdevices.moc" -QTEST_MAIN(TestDevices) +QTEST_MAIN(TestIntegrations) diff --git a/tests/auto/events/testevents.cpp b/tests/auto/events/testevents.cpp index f7ec0ffa..1dea52a1 100644 --- a/tests/auto/events/testevents.cpp +++ b/tests/auto/events/testevents.cpp @@ -65,7 +65,7 @@ void TestEvents::triggerEvent() QNetworkAccessManager nam; // trigger event in mock device - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); @@ -107,7 +107,7 @@ void TestEvents::triggerStateChangeEvent() QNetworkAccessManager nam; // trigger state changed event in mock device - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(port).arg(mockIntStateTypeId.toString()).arg(11))); QNetworkReply *reply = nam.get(request); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); diff --git a/tests/auto/integrations/integrations.pro b/tests/auto/integrations/integrations.pro new file mode 100644 index 00000000..de612a5b --- /dev/null +++ b/tests/auto/integrations/integrations.pro @@ -0,0 +1,5 @@ +include(../../../nymea.pri) +include(../autotests.pri) + +TARGET = testintegrations +SOURCES += testintegrations.cpp diff --git a/tests/auto/integrations/testintegrations.cpp b/tests/auto/integrations/testintegrations.cpp new file mode 100644 index 00000000..ab11f0df --- /dev/null +++ b/tests/auto/integrations/testintegrations.cpp @@ -0,0 +1,2153 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "nymeatestbase.h" +#include "nymeacore.h" +#include "nymeasettings.h" + +#include "integrations/thingdiscoveryinfo.h" +#include "integrations/thingsetupinfo.h" + +#include "servers/mocktcpserver.h" +#include "jsonrpc/integrationshandler.h" + +using namespace nymeaserver; + +class TestIntegrations : public NymeaTestBase +{ + Q_OBJECT + +private: + ThingId m_mockThingAsyncId; + + inline void verifyThingError(const QVariant &response, Thing::ThingError error = Thing::ThingErrorNoError) { + verifyError(response, "thingError", enumValueName(error)); + } + +private slots: + + void initTestCase(); + + void getPlugins(); + + void getPluginConfig_data(); + void getPluginConfig(); + + void setPluginConfig_data(); + void setPluginConfig(); + + void getSupportedVendors(); + + void getThingClasses_data(); + void getThingClasses(); + + void verifyInterfaces(); + + void addThing_data(); + void addThing(); + + void thingAddedRemovedNotifications(); + + void thingChangedNotifications(); + + void getThings(); + + void getThing_data(); + void getThing(); + + void storedThings(); + + void discoverThings_data(); + void discoverThings(); + + void addPushButtonThings_data(); + void addPushButtonThings(); + + void addDisplayPinThings_data(); + void addDisplayPinThings(); + + void parentChildThings(); + + void getActionTypes_data(); + void getActionTypes(); + + void getEventTypes_data(); + void getEventTypes(); + + void getStateTypes_data(); + void getStateTypes(); + + void getStateValue_data(); + void getStateValue(); + + void getStateValues_data(); + void getStateValues(); + + void editThings_data(); + void editThings(); + + void testDeviceSettings(); + + void reconfigureThings_data(); + void reconfigureThings(); + + void reconfigureByDiscovery_data(); + void reconfigureByDiscovery(); + + void reconfigureByDiscoveryAndPair(); + void reconfigureAutoThing(); + + void testBrowsing_data(); + void testBrowsing(); + + void testExecuteBrowserItem_data(); + void testExecuteBrowserItem(); + + void testExecuteBrowserItemAction_data(); + void testExecuteBrowserItemAction(); + + void executeAction_data(); + void executeAction(); + + void triggerEvent(); + void triggerStateChangeEvent(); + + void params(); + + void asyncSetupEmitsSetupStatusUpdate(); + + // Keep those at last as they will remove devices + void removeThing_data(); + void removeThing(); + + void removeAutoThing(); + + void discoverThingsParenting(); +}; + +void TestIntegrations::initTestCase() +{ + NymeaTestBase::initTestCase(); + QLoggingCategory::setFilterRules("*.debug=false\n" + "Tests.debug=true\n" + "Mock.debug=true\n" + ); + + // Adding an async mock to be used in tests below + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Mocked Thing (Async)"); + + QVariantList thingParams; + + QVariantMap asyncParam; + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); + asyncParam.insert("value", true); + thingParams.append(asyncParam); + + QVariantMap httpParam; + httpParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpParam.insert("value", 8765); + thingParams.append(httpParam); + + params.insert("thingParams", thingParams); + + QVariant response = injectAndWait("Integrations.AddThing", params); + + m_mockThingAsyncId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY2(!m_mockThingAsyncId.isNull(), "Creating an async mock failed"); + + qCDebug(dcTests()) << "Created Async mock with ID" << m_mockThingAsyncId; +} + +void TestIntegrations::getPlugins() +{ + QVariant response = injectAndWait("Integrations.GetPlugins"); + + QVariantList plugins = response.toMap().value("params").toMap().value("plugins").toList(); + + QCOMPARE(plugins.count() > 0, true); + bool found = false; + foreach (const QVariant &listEntry, plugins) { + if (PluginId(listEntry.toMap().value("id").toString()) == mockPluginId) { + found = true; + } + } + QCOMPARE(found, true); +} + +void TestIntegrations::getPluginConfig_data() +{ + QTest::addColumn("pluginId"); + QTest::addColumn("error"); + + QTest::newRow("valid plugin") << mockPluginId << Thing::ThingErrorNoError; + QTest::newRow("invalid plugin") << PluginId::createPluginId() << Thing::ThingErrorPluginNotFound; +} + +void TestIntegrations::getPluginConfig() +{ + QFETCH(PluginId, pluginId); + QFETCH(Thing::ThingError, error); + + QVariantMap params; + params.insert("pluginId", pluginId); + QVariant response = injectAndWait("Integrations.GetPluginConfiguration", params); + verifyThingError(response, error); +} + +void TestIntegrations::setPluginConfig_data() +{ + QTest::addColumn("pluginId"); + QTest::addColumn("value"); + QTest::addColumn("error"); + + QTest::newRow("valid") << mockPluginId << QVariant(13) << Thing::ThingErrorNoError; + QTest::newRow("invalid plugin") << PluginId::createPluginId() << QVariant(13) << Thing::ThingErrorPluginNotFound; + QTest::newRow("too big") << mockPluginId << QVariant(130) << Thing::ThingErrorInvalidParameter; + QTest::newRow("too small") << mockPluginId << QVariant(-13) << Thing::ThingErrorInvalidParameter; + QTest::newRow("wrong type") << mockPluginId << QVariant("wrontType") << Thing::ThingErrorInvalidParameter; +} + +void TestIntegrations::setPluginConfig() +{ + QFETCH(PluginId, pluginId); + QFETCH(QVariant, value); + QFETCH(Thing::ThingError, error); + + QVariantMap params; + params.insert("pluginId", pluginId); + + QVariantList configuration; + QVariantMap configParam; + configParam.insert("paramTypeId", mockPluginConfigParamIntParamTypeId); + configParam.insert("value", value); + configuration.append(configParam); + params.insert("configuration", configuration); + QVariant response = injectAndWait("Integrations.SetPluginConfiguration", params); + verifyThingError(response, error); + + if (error == Thing::ThingErrorNoError) { + params.clear(); + params.insert("pluginId", pluginId); + response = injectAndWait("Integrations.GetPluginConfiguration", params); + verifyThingError(response); + qDebug() << value << response.toMap().value("params").toMap().value("configuration").toList().first(); + QVERIFY2(ParamTypeId(response.toMap().value("params").toMap().value("configuration").toList().first().toMap().value("paramTypeId").toString()) == mockPluginConfigParamIntParamTypeId, "Value not set correctly"); + QVERIFY2(response.toMap().value("params").toMap().value("configuration").toList().first().toMap().value("value") == value, "Value not set correctly"); + } +} + +void TestIntegrations::getSupportedVendors() +{ + QVariant supportedVendors = injectAndWait("Devices.GetSupportedVendors"); + qDebug() << "response" << supportedVendors; + + // Make sure there is exactly 1 supported Vendor named "guh" + QVariantList vendorList = supportedVendors.toMap().value("params").toMap().value("vendors").toList(); + QCOMPARE(vendorList.count() > 0, true); + bool found = false; + foreach (const QVariant &listEntry, vendorList) { + if (VendorId(listEntry.toMap().value("id").toString()) == nymeaVendorId) { + found = true; + } + } + QCOMPARE(found, true); +} + +void TestIntegrations::getThingClasses_data() +{ + QTest::addColumn("vendorId"); + QTest::addColumn("resultCount"); + + QTest::newRow("vendor nymea") << nymeaVendorId << 11; + QTest::newRow("no filter") << VendorId() << 11; + QTest::newRow("invalid vendor") << VendorId("93e7d361-8025-4354-b17e-b68406c800bc") << 0; +} + +void TestIntegrations::getThingClasses() +{ + QFETCH(VendorId, vendorId); + QFETCH(int, resultCount); + + QVariantMap params; + if (!vendorId.isNull()) { + params.insert("vendorId", vendorId); + } + QVariant result = injectAndWait("Integrations.GetThingClasses", params); + + QVariantList thingClasses = result.toMap().value("params").toMap().value("thingClasses").toList(); + // Make sure there are the right amount of thing classes + QCOMPARE(thingClasses.count(), resultCount); +} + +void TestIntegrations::verifyInterfaces() +{ + QVariantMap params; + params.insert("vendorId", nymeaVendorId); + QVariant result = injectAndWait("Devices.GetSupportedDevices", params); + QVariantList supportedDevices = result.toMap().value("params").toMap().value("deviceClasses").toList(); + + QVariantMap mockDevice; + foreach (const QVariant &deviceClass, supportedDevices) { + if (deviceClass.toMap().value("id").toUuid() == mockThingClassId) { + mockDevice = deviceClass.toMap(); + } + } + QVERIFY(!mockDevice.isEmpty()); + + QVariantList interfaces = mockDevice.value("interfaces").toList(); + // Must contain system, power, light and battery, but must not contain gateway as the device manager should filter + // that away because it doesn't implement all the required states. + QCOMPARE(interfaces.count(), 4); + QVERIFY(interfaces.contains("system")); + QVERIFY(interfaces.contains("battery")); + QVERIFY(interfaces.contains("power")); + QVERIFY(interfaces.contains("light")); + QVERIFY(!interfaces.contains("gateway")); +} + +void TestIntegrations::addThing_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("thingParams"); + QTest::addColumn("jsonValidation"); + QTest::addColumn("thingError"); + + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId.toString()); + httpportParam.insert("value", m_mockThing1Port - 1); + QVariantMap asyncParam; + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); + asyncParam.insert("value", true); + QVariantMap brokenParam; + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); + brokenParam.insert("value", true); + + QVariantList deviceParams; + + deviceParams.clear(); deviceParams << httpportParam; + QTest::newRow("User, JustAdd") << mockThingClassId << deviceParams << true << Thing::ThingErrorNoError; + deviceParams.clear(); deviceParams << httpportParam << asyncParam; + QTest::newRow("User, JustAdd, Async") << mockThingClassId << deviceParams << true << Thing::ThingErrorNoError; + QTest::newRow("Invalid ThingClassId") << ThingClassId::createThingClassId() << deviceParams << true << Thing::ThingErrorThingClassNotFound; + deviceParams.clear(); deviceParams << httpportParam << brokenParam; + QTest::newRow("Setup failure") << mockThingClassId << deviceParams << true << Thing::ThingErrorSetupFailed; + deviceParams.clear(); deviceParams << httpportParam << asyncParam << brokenParam; + QTest::newRow("Setup failure, Async") << mockThingClassId << deviceParams << true << Thing::ThingErrorSetupFailed; + + QVariantList invalidDeviceParams; + QTest::newRow("User, JustAdd, missing params") << mockThingClassId << invalidDeviceParams << true << Thing::ThingErrorMissingParameter; + + QVariantMap fakeparam; + fakeparam.insert("paramTypeId", ParamTypeId::createParamTypeId()); + invalidDeviceParams.append(fakeparam); + QTest::newRow("User, JustAdd, invalid param") << mockThingClassId << invalidDeviceParams << false << Thing::ThingErrorMissingParameter; + + QVariantMap fakeparam2; + fakeparam2.insert("paramTypeId", mockThingHttpportParamTypeId.toString()); + fakeparam2.insert("value", "blabla"); + invalidDeviceParams.clear(); + invalidDeviceParams.append(fakeparam2); + QTest::newRow("User, JustAdd, wrong param") << mockThingClassId << invalidDeviceParams << true << Thing::ThingErrorInvalidParameter; + + deviceParams.clear(); deviceParams << httpportParam << fakeparam; + QTest::newRow("USer, JustAdd, additional invalid param") << mockThingClassId << deviceParams << false << Thing::ThingErrorNoError; + + deviceParams.clear(); deviceParams << httpportParam << fakeparam2; + QTest::newRow("USer, JustAdd, additional param, valid but unused") << mockThingClassId << deviceParams << true << Thing::ThingErrorNoError; + +} + +void TestIntegrations::addThing() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(QVariantList, thingParams); + QFETCH(bool, jsonValidation); + QFETCH(Thing::ThingError, thingError); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + params.insert("name", "Test Add Device"); + params.insert("thingParams", thingParams); + QVariant response = injectAndWait("Integrations.AddThing", params); + + if (!jsonValidation) { + QCOMPARE(response.toMap().value("status").toString(), QString("error")); + return; + } + verifyThingError(response, thingError); + + if (thingError == Thing::ThingErrorNoError) { + QUuid thingId(response.toMap().value("params").toMap().value("thingId").toString()); + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + } +} + +void TestIntegrations::thingAddedRemovedNotifications() +{ + enableNotifications({"Integrations"}); + + // Setup connection to mock client + QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // add device and wait for notification + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 5678); + deviceParams.append(httpportParam); + + QVariantMap params; clientSpy.clear(); + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Mocked thing"); + params.insert("thingParams", deviceParams); + QVariant response = injectAndWait("Integrations.AddThing", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + QVariantMap notificationThingMap = checkNotification(clientSpy, "Integrations.ThingAdded").toMap().value("params").toMap().value("thing").toMap(); + + ThingId thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + + // check the DeviceAdded notification + QCOMPARE(notificationThingMap.value("thingClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(notificationThingMap.value("id").toUuid(), QUuid(thingId)); + foreach (const QVariant ¶m, notificationThingMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); + } + } + + // now remove the device and check the device removed notification + params.clear(); response.clear(); clientSpy.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.RemoveThing", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + checkNotification(clientSpy, "Integrations.ThingRemoved"); + + QCOMPARE(disableNotifications(), true); +} + +void TestIntegrations::thingChangedNotifications() +{ + enableNotifications({"Integrations"}); + + // Setup connection to mock client + QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // ADD + // add device and wait for notification + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 23234); + deviceParams.append(httpportParam); + + clientSpy.clear(); + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Mock"); + params.insert("thingParams", deviceParams); + QVariant response = injectAndWait("Integrations.AddThing", params); + ThingId thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + QVariantMap notificationDeviceMap = checkNotification(clientSpy, "Integrations.ThingAdded").toMap().value("params").toMap().value("thing").toMap(); + + QCOMPARE(notificationDeviceMap.value("thingClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(notificationDeviceMap.value("id").toUuid(), QUuid(thingId)); + foreach (const QVariant ¶m, notificationDeviceMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); + } + } + + // RECONFIGURE + // now reconfigure the device and check the deviceChanged notification + QVariantList newDeviceParams; + QVariantMap newHttpportParam; + newHttpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + newHttpportParam.insert("value", 45473); + newDeviceParams.append(newHttpportParam); + + params.clear(); response.clear(); clientSpy.clear(); + params.insert("thingId", thingId); + params.insert("thingParams", newDeviceParams); + response = injectAndWait("Integrations.ReconfigureThing", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + QVariantMap reconfigureThingNotificationMap = checkNotification(clientSpy, "Integrations.ThingChanged").toMap().value("params").toMap().value("thing").toMap(); + QCOMPARE(reconfigureThingNotificationMap.value("thingClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(reconfigureThingNotificationMap.value("id").toUuid(), QUuid(thingId)); + foreach (const QVariant ¶m, reconfigureThingNotificationMap.value("params").toList()) { + if (param.toMap().value("name").toString() == "httpport") { + QCOMPARE(param.toMap().value("value").toInt(), newHttpportParam.value("value").toInt()); + } + } + + // EDIT device name + QString thingName = "Test device 1234"; + params.clear(); response.clear(); clientSpy.clear(); + params.insert("thingId", thingId); + params.insert("name", thingName); + response = injectAndWait("Integrations.EditThing", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + QVariantMap editThingNotificationMap = checkNotification(clientSpy, "Integrations.ThingChanged").toMap().value("params").toMap().value("thing").toMap(); + QCOMPARE(editThingNotificationMap.value("thingClassId").toUuid(), QUuid(mockThingClassId)); + QCOMPARE(editThingNotificationMap.value("id").toUuid(), QUuid(thingId)); + QCOMPARE(editThingNotificationMap.value("name").toString(), thingName); + + // REMOVE + // now remove the device and check the device removed notification + params.clear(); response.clear(); clientSpy.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.RemoveThing", params); + if (clientSpy.count() == 0) clientSpy.wait(); + verifyThingError(response); + checkNotification(clientSpy, "Integrations.ThingRemoved"); + checkNotification(clientSpy, "Logging.LogDatabaseUpdated"); +} + +void TestIntegrations::getThings() +{ + QVariant response = injectAndWait("Integrations.GetThings"); + + QVariantList devices = response.toMap().value("params").toMap().value("things").toList(); + QCOMPARE(devices.count(), 3); // There should be: one auto created mock, one created in NymeaTestBase::initTestcase() and one created in TestIntegrations::initTestCase() +} + +void TestIntegrations::getThing_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("expectedError"); + + QTest::newRow("valid thingId") << ThingId(m_mockThingId) << Thing::ThingErrorNoError; + QTest::newRow("invalid thingId") << ThingId::createThingId() << Thing::ThingErrorThingNotFound; +} + +void TestIntegrations::getThing() +{ + QFETCH(ThingId, thingId); + QFETCH(Thing::ThingError, expectedError); + + QVariantMap params; + params.insert("thingId", thingId); + QVariant response = injectAndWait("Integrations.GetThings", params); + +// qCDebug(dcTests()) << qUtf8Printable(QJsonDocument::fromVariant(response).toJson()); + + if (expectedError == Thing::ThingErrorNoError) { + QVariantList things = response.toMap().value("params").toMap().value("things").toList(); + QCOMPARE(things.count(), 1); + } +} + +void TestIntegrations::storedThings() +{ + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Test stored thing"); + QVariantList thingParams; + QVariantMap asyncParam; + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); + asyncParam.insert("value", false); + thingParams.append(asyncParam); + QVariantMap brokenParam; + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); + brokenParam.insert("value", false); + thingParams.append(brokenParam); + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 8889); + thingParams.append(httpportParam); + params.insert("thingParams", thingParams); + + QVariant response = injectAndWait("Integrations.AddThing", params); + verifyThingError(response); + ThingId addedThingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!addedThingId.isNull()); + + // Restart the core instance to check if settings are loaded at startup + restartServer(); + + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + bool found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == addedThingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + qDebug() << "expected thingParams:" << thingParams; + verifyParams(thingParams, thing.toMap().value("params").toList()); + found = true; + break; + } + } + QVERIFY2(found, "thing missing in config!"); + + params.clear(); + params.insert("thingId", addedThingId); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); +} + +void TestIntegrations::discoverThings_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("resultCount"); + QTest::addColumn("error"); + QTest::addColumn("discoveryParams"); + + QVariantList discoveryParams; + QVariantMap resultCountParam; + resultCountParam.insert("paramTypeId", mockDiscoveryResultCountParamTypeId); + resultCountParam.insert("value", 1); + discoveryParams.append(resultCountParam); + + QTest::newRow("valid thingClassId") << mockThingClassId << 2 << Thing::ThingErrorNoError << QVariantList(); + QTest::newRow("valid thingClassId with params") << mockThingClassId << 1 << Thing::ThingErrorNoError << discoveryParams; + QTest::newRow("invalid thingClassId") << ThingClassId::createThingClassId() << 0 << Thing::ThingErrorThingClassNotFound << QVariantList(); +} + +void TestIntegrations::discoverThings() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(int, resultCount); + QFETCH(Thing::ThingError, error); + QFETCH(QVariantList, discoveryParams); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + params.insert("discoveryParams", discoveryParams); + QVariant response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response, error); + if (error == Thing::ThingErrorNoError) { + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), resultCount); + } + + // If we found something, lets try to add it + if (error == Thing::ThingErrorNoError) { + ThingDescriptorId descriptorId = ThingDescriptorId(response.toMap().value("params").toMap().value("thingDescriptors").toList().first().toMap().value("id").toString()); + + params.clear(); + params.insert("thingClassId", thingClassId); + params.insert("name", "Discoverd mock device"); + params.insert("thingDescriptorId", descriptorId.toString()); + response = injectAndWait("Integrations.AddThing", params); + + verifyThingError(response); + + ThingId thingId(response.toMap().value("params").toMap().value("thingId").toString()); + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + } +} + +void TestIntegrations::addPushButtonThings_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("error"); + QTest::addColumn("waitForButtonPressed"); + + QTest::newRow("Valid: Add PushButton thing") << pushButtonMockThingClassId << Thing::ThingErrorNoError << true; + QTest::newRow("Invalid: Add PushButton thing (press to early)") << pushButtonMockThingClassId << Thing::ThingErrorAuthenticationFailure << false; +} + +void TestIntegrations::addPushButtonThings() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(Thing::ThingError, error); + QFETCH(bool, waitForButtonPressed); + + // Discover device + QVariantList discoveryParams; + QVariantMap resultCountParam; + resultCountParam.insert("paramTypeId", pushButtonMockDiscoveryResultCountParamTypeId); + resultCountParam.insert("value", 1); + discoveryParams.append(resultCountParam); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + params.insert("discoveryParams", discoveryParams); + QVariant response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response, Thing::ThingErrorNoError); + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), 1); + + + // Pair device + ThingDescriptorId descriptorId = ThingDescriptorId(response.toMap().value("params").toMap().value("thingDescriptors").toList().first().toMap().value("id").toString()); + params.clear(); + params.insert("thingClassId", thingClassId); + params.insert("name", "Pushbutton device"); + params.insert("thingDescriptorId", descriptorId.toString()); + response = injectAndWait("Integrations.PairThing", params); + + verifyThingError(response); + + PairingTransactionId pairingTransactionId(response.toMap().value("params").toMap().value("pairingTransactionId").toString()); + QString displayMessage = response.toMap().value("params").toMap().value("displayMessage").toString(); + + qDebug() << "displayMessage" << displayMessage; + + if (waitForButtonPressed) + QTest::qWait(3500); + + // Confirm pairing + params.clear(); + params.insert("pairingTransactionId", pairingTransactionId.toString()); + response = injectAndWait("Integrations.ConfirmPairing", params); + + verifyThingError(response, error); + + if (error == Thing::ThingErrorNoError) { + ThingId thingId(response.toMap().value("params").toMap().value("thingId").toString()); + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + } +} + +void TestIntegrations::addDisplayPinThings_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("error"); + QTest::addColumn("secret"); + + QTest::newRow("Valid: Add DisplayPin device") << displayPinMockThingClassId << Thing::ThingErrorNoError << "243681"; + QTest::newRow("Invalid: Add DisplayPin device (wrong pin)") << displayPinMockThingClassId << Thing::ThingErrorAuthenticationFailure << "243682"; +} + +void TestIntegrations::addDisplayPinThings() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(Thing::ThingError, error); + QFETCH(QString, secret); + + // Discover device + QVariantList discoveryParams; + QVariantMap resultCountParam; + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); + resultCountParam.insert("value", 1); + discoveryParams.append(resultCountParam); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + params.insert("discoveryParams", discoveryParams); + QVariant response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response, Thing::ThingErrorNoError); + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), 1); + + // Pair device + ThingDescriptorId descriptorId = ThingDescriptorId(response.toMap().value("params").toMap().value("thingDescriptors").toList().first().toMap().value("id").toString()); + params.clear(); + params.insert("thingClassId", thingClassId); + params.insert("name", "Display pin mock device"); + params.insert("thingDescriptorId", descriptorId.toString()); + response = injectAndWait("Integrations.PairThing", params); + + verifyThingError(response); + + PairingTransactionId pairingTransactionId(response.toMap().value("params").toMap().value("pairingTransactionId").toString()); + QString displayMessage = response.toMap().value("params").toMap().value("displayMessage").toString(); + + qDebug() << "displayMessage" << displayMessage; + + params.clear(); + params.insert("pairingTransactionId", pairingTransactionId.toString()); + params.insert("secret", secret); + response = injectAndWait("Integrations.ConfirmPairing", params); + + verifyThingError(response, error); + + if (error == Thing::ThingErrorNoError) { + ThingId thingId(response.toMap().value("params").toMap().value("thingId").toString()); + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + } +} + +void TestIntegrations::parentChildThings() +{ + // add parent device + QVariantMap params; + params.insert("thingClassId", parentMockThingClassId); + params.insert("name", "Parent"); + + QSignalSpy thingAddedSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); + + QVariant response = injectAndWait("Integrations.AddThing", params); + verifyThingError(response); + + ThingId parentId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!parentId.isNull()); + + thingAddedSpy.wait(); + QCOMPARE(thingAddedSpy.count(), 2); + + // find child device + response = injectAndWait("Integrations.GetThings"); + + QVariantList things = response.toMap().value("params").toMap().value("things").toList(); + + ThingId childId; + foreach (const QVariant thingVariant, things) { + QVariantMap deviceMap = thingVariant.toMap(); + + if (deviceMap.value("thingClassId").toUuid() == childMockThingClassId) { + if (deviceMap.value("parentId").toUuid() == parentId) { + childId = ThingId(deviceMap.value("id").toString()); + break; + } + } + } + QVERIFY2(!childId.isNull(), QString("Could not find child device:\nParent ID:%1\nResponse:%2") + .arg(parentId.toString()) + .arg(qUtf8Printable(QJsonDocument::fromVariant(response).toJson())) + .toUtf8()); + + // Try to remove the child device + params.clear(); + params.insert("thingId", childId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response, Thing::ThingErrorThingIsChild); + + // check if the child device is still there + response = injectAndWait("Integrations.GetThings"); + things = response.toMap().value("params").toMap().value("things").toList(); + bool found = false; + foreach (const QVariant thingVariant, things) { + QVariantMap deviceMap = thingVariant.toMap(); + if (deviceMap.value("thingClassId").toUuid() == childMockThingClassId) { + if (deviceMap.value("id").toUuid() == childId) { + found = true; + break; + } + } + } + QVERIFY2(found, "Could not find child."); + + // remove the parent device + params.clear(); + params.insert("thingId", parentId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + + // check if the child device is still there + response = injectAndWait("Integrations.GetThings"); + things = response.toMap().value("params").toMap().value("things").toList(); + found = false; + foreach (const QVariant thingVariant, things) { + QVariantMap thingMap = thingVariant.toMap(); + if (thingMap.value("thingClassId").toString() == childMockThingClassId.toString()) { + if (thingMap.value("id") == childId.toString()) { + found = true; + break; + } + } + } + QVERIFY2(!found, "Could not find child."); +} + +void TestIntegrations::getActionTypes_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn >("actionTypeTestData"); + + QTest::newRow("valid thingClass") << mockThingClassId + << (QList() << mockAsyncActionTypeId << mockAsyncFailingActionTypeId << mockFailingActionTypeId << mockWithoutParamsActionTypeId << mockPowerActionTypeId << mockWithoutParamsActionTypeId); + QTest::newRow("invalid thingClass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << QList(); +} + +void TestIntegrations::getActionTypes() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(QList, actionTypeTestData); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + QVariant response = injectAndWait("Integrations.GetActionTypes", params); + + QVariantList actionTypes = response.toMap().value("params").toMap().value("actionTypes").toList(); + QCOMPARE(actionTypes.count(), actionTypeTestData.count()); + foreach (const ActionTypeId &testDataId, actionTypeTestData) { + bool found = false; + foreach (const QVariant &at, actionTypes) { + if (testDataId == at.toMap().value("id").toUuid()) { + found = true; + break; + } + } + QVERIFY(found); + } +} + +void TestIntegrations::getEventTypes_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("resultCount"); + + QTest::newRow("valid thingClass") << mockThingClassId << 8; + QTest::newRow("invalid thingClass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << 0; +} + +void TestIntegrations::getEventTypes() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(int, resultCount); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + QVariant response = injectAndWait("Integrations.GetEventTypes", params); + + qDebug() << response; + + QVariantList eventTypes = response.toMap().value("params").toMap().value("eventTypes").toList(); + QCOMPARE(eventTypes.count(), resultCount); + +} + +void TestIntegrations::getStateTypes_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("resultCount"); + + QTest::newRow("valid thingClass") << mockThingClassId << 6; + QTest::newRow("invalid thingClass") << ThingClassId("094f8024-5caa-48c1-ab6a-de486a92088f") << 0; +} + +void TestIntegrations::getStateTypes() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(int, resultCount); + + QVariantMap params; + params.insert("thingClassId", thingClassId); + QVariant response = injectAndWait("Integrations.GetStateTypes", params); + + QVariantList stateTypes = response.toMap().value("params").toMap().value("stateTypes").toList(); + QCOMPARE(stateTypes.count(), resultCount); + if (resultCount > 0) { + QCOMPARE(stateTypes.first().toMap().value("id").toUuid().toString(), mockIntStateTypeId.toString()); + } +} + +void TestIntegrations::getStateValue_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("stateTypeId"); + QTest::addColumn("statusCode"); + + QTest::newRow("valid thingId") << ThingId(m_mockThingId) << mockIntStateTypeId << Thing::ThingErrorNoError; + QTest::newRow("invalid thingId") << ThingId("094f8024-5caa-48c1-ab6a-de486a92088f") << mockIntStateTypeId << Thing::ThingErrorThingNotFound; + QTest::newRow("invalid statetypeId") << ThingId(m_mockThingId) << StateTypeId("120514f1-343e-4621-9bff-dac616169df9") << Thing::ThingErrorStateTypeNotFound; +} + +void TestIntegrations::getStateValue() +{ + QFETCH(ThingId, thingId); + QFETCH(StateTypeId, stateTypeId); + QFETCH(Thing::ThingError, statusCode); + + QVariantMap params; + params.insert("thingId", thingId); + params.insert("stateTypeId", stateTypeId); + QVariant response = injectAndWait("Integrations.GetStateValue", params); + + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), enumValueName(statusCode)); + if (statusCode == Thing::ThingErrorNoError) { + QVariant value = response.toMap().value("params").toMap().value("value"); + QCOMPARE(value.toInt(), 10); // Mock device has value 10 by default... + } +} + +void TestIntegrations::getStateValues_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("statusCode"); + + QTest::newRow("valid thingId") << ThingId(m_mockThingId) << Thing::ThingErrorNoError; + QTest::newRow("invalid thingId") << ThingId("094f8024-5caa-48c1-ab6a-de486a92088f") << Thing::ThingErrorThingNotFound; +} + +void TestIntegrations::getStateValues() +{ + QFETCH(ThingId, thingId); + QFETCH(Thing::ThingError, statusCode); + + QVariantMap params; + params.insert("thingId", thingId); + QVariant response = injectAndWait("Integrations.GetStateValues", params); + + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), enumValueName(statusCode)); + if (statusCode == Thing::ThingErrorNoError) { + QVariantList values = response.toMap().value("params").toMap().value("values").toList(); + QCOMPARE(values.count(), 6); // Mock device has 6 states... + } +} + +void TestIntegrations::editThings_data() +{ + QTest::addColumn("name"); + + QTest::newRow("change name") << "New name"; + QTest::newRow("change name") << "Foo device"; + QTest::newRow("change name") << "Bar device"; +} + +void TestIntegrations::editThings() +{ + QFETCH(QString, name); + + QString originalName = "Test thing"; + + // add thing + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 8889); + deviceParams.append(httpportParam); + + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", originalName); + params.insert("thingParams", deviceParams); + QVariant response = injectAndWait("Integrations.AddThing", params); + verifyThingError(response); + ThingId thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + + // edit thing + params.clear(); + params.insert("thingId", thingId); + params.insert("name", name); + + response = injectAndWait("Integrations.EditThing", params); + verifyThingError(response); + + // verify changed + QString newName; + response = injectAndWait("Integrations.GetThings"); + QVariantList things = response.toMap().value("params").toMap().value("things").toList(); + + foreach (const QVariant &deviceVariant, things) { + QVariantMap device = deviceVariant.toMap(); + if (ThingId(device.value("id").toString()) == thingId) { + newName = device.value("name").toString(); + } + } + QCOMPARE(newName, name); + + restartServer(); + + // check if the changed name is still there after loading + response = injectAndWait("Integrations.GetThings"); + things = response.toMap().value("params").toMap().value("things").toList(); + foreach (const QVariant &thingVariant, things) { + QVariantMap device = thingVariant.toMap(); + if (ThingId(device.value("id").toString()) == thingId) { + newName = device.value("name").toString(); + break; + } + } + QCOMPARE(newName, name); + + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); +} + +void TestIntegrations::testDeviceSettings() +{ + // add device + QVariantList deviceParams; + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 8889); + deviceParams.append(httpportParam); + + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Mock"); + params.insert("thingParams", deviceParams); + QVariant response = injectAndWait("Integrations.AddThing", params); + verifyThingError(response); + ThingId thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + + // check if default settings are loaded + params.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.GetThings", params); + QVariantList things = response.toMap().value("params").toMap().value("things").toList(); + QVERIFY2(things.count() == 1, "Error creating thing"); + + QVariantMap thing = things.first().toMap(); + QVERIFY2(ThingId(thing.value("id").toString()) == thingId, "thingId not matching"); + + QVariantList settings = thing.value("settings").toList(); + QCOMPARE(settings.count(), 1); + + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); + QVERIFY2(settings.first().toMap().value("value").toInt() == 5, "Setting 1 default value not matching"); + + // change a setting + params.clear(); + params.insert("thingId", thingId); + settings.clear(); + QVariantMap setting; + setting.insert("paramTypeId", mockSettingsSetting1ParamTypeId); + setting.insert("value", 7); + settings.append(setting); + params.insert("settings", settings); + response = injectAndWait("Integrations.SetThingSettings", params); + + // Check if the change happened + params.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.GetThings", params); + things = response.toMap().value("params").toMap().value("things").toList(); + QVERIFY2(things.count() == 1, "Error creating thing"); + + thing = things.first().toMap(); + QVERIFY2(ThingId(thing.value("id").toString()) == thingId, "thingId not matching"); + + settings = thing.value("settings").toList(); + QCOMPARE(settings.count(), 1); + + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); + QVERIFY2(settings.first().toMap().value("value").toInt() == 7, "Setting 1 changed value not matching"); + + restartServer(); + + // Check if the change persisted + params.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.GetThings", params); + things = response.toMap().value("params").toMap().value("things").toList(); + QVERIFY2(things.count() == 1, "Error creating thing"); + + thing = things.first().toMap(); + QVERIFY2(ThingId(thing.value("id").toString()) == thingId, "thingId not matching"); + + settings = thing.value("settings").toList(); + QCOMPARE(settings.count(), 1); + + QCOMPARE(settings.first().toMap().value("paramTypeId").toUuid(), QUuid(mockSettingsSetting1ParamTypeId)); + QVERIFY2(settings.first().toMap().value("value").toInt() == 7, "Setting 1 changed value not persisting restart"); + +} + +void TestIntegrations::reconfigureThings_data() +{ + QVariantList asyncChangeThingParams; + QVariantMap asyncParamDifferent; + asyncParamDifferent.insert("paramTypeId", mockThingAsyncParamTypeId); + asyncParamDifferent.insert("value", true); + asyncChangeThingParams.append(asyncParamDifferent); + + QVariantList httpportChangeThingParams; + QVariantMap httpportParamDifferent; + httpportParamDifferent.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParamDifferent.insert("value", 8893); // if change -> change also newPort in reconfigureDevices() + httpportChangeThingParams.append(httpportParamDifferent); + + QVariantList brokenChangedThingParams; + QVariantMap brokenParamDifferent; + brokenParamDifferent.insert("paramTypeId", mockThingBrokenParamTypeId); + brokenParamDifferent.insert("value", true); + brokenChangedThingParams.append(brokenParamDifferent); + + QVariantList asyncAndPortChangeThingParams; + asyncAndPortChangeThingParams.append(asyncParamDifferent); + asyncAndPortChangeThingParams.append(httpportParamDifferent); + + + QVariantList changeAllWritableThingParams; + changeAllWritableThingParams.append(asyncParamDifferent); + changeAllWritableThingParams.append(httpportParamDifferent); + + QTest::addColumn("broken"); + QTest::addColumn("newThingParams"); + QTest::addColumn("thingError"); + + QTest::newRow("valid - change async param") << false << asyncChangeThingParams << Thing::ThingErrorParameterNotWritable; + QTest::newRow("valid - change httpport param") << false << httpportChangeThingParams << Thing::ThingErrorNoError; + QTest::newRow("invalid - change httpport and async param") << false << asyncAndPortChangeThingParams << Thing::ThingErrorParameterNotWritable; + QTest::newRow("invalid - change all params (except broken)") << false << changeAllWritableThingParams << Thing::ThingErrorParameterNotWritable; +} + +void TestIntegrations::reconfigureThings() +{ + QFETCH(bool, broken); + QFETCH(QVariantList, newThingParams); + QFETCH(Thing::ThingError, thingError); + + // add thing + QVariantMap params; + params.insert("thingClassId", mockThingClassId); + params.insert("name", "Thing to edit"); + QVariantList thingParams; + QVariantMap asyncParam; + asyncParam.insert("paramTypeId", mockThingAsyncParamTypeId); + asyncParam.insert("value", false); + thingParams.append(asyncParam); + QVariantMap brokenParam; + brokenParam.insert("paramTypeId", mockThingBrokenParamTypeId); + brokenParam.insert("value", broken); + thingParams.append(brokenParam); + QVariantMap httpportParam; + httpportParam.insert("paramTypeId", mockThingHttpportParamTypeId); + httpportParam.insert("value", 8892); + thingParams.append(httpportParam); + params.insert("thingParams", thingParams); + + // add a mockdevice + QVariant response = injectAndWait("Integrations.AddThing", params); + verifyThingError(response); + + ThingId thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + + // now EDIT the added device + response.clear(); + QVariantMap editParams; + editParams.insert("thingId", thingId); + editParams.insert("thingParams", newThingParams); + response = injectAndWait("Integrations.ReconfigureThing", editParams); + verifyThingError(response, thingError); + + // if the edit should have been successful + if (thingError == Thing::ThingErrorNoError) { + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + bool found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == thingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + qDebug() << "expected thingParams:" << newThingParams; + // check if the edit was ok + verifyParams(newThingParams, thing.toMap().value("params").toList(), false); + found = true; + break; + } + } + QVERIFY2(found, "Thing missing in config!"); + + // Restart the core instance to check if settings are loaded at startup + restartServer(); + + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == thingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + qDebug() << "expected deviceParams:" << newThingParams; + // check if the edit was ok + verifyParams(newThingParams, thing.toMap().value("params").toList(), false); + found = true; + break; + } + } + QVERIFY2(found, "Thing missing in config!"); + + // delete it + params.clear(); + params.insert("thingId", thingId); + response.clear(); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); + return; + } else { + // The edit was not ok, check if the old params are still there + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + bool found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == thingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + qDebug() << "expected thingParams:" << newThingParams; + // check if the params are unchanged + verifyParams(thingParams, thing.toMap().value("params").toList()); + found = true; + break; + } + } + QVERIFY2(found, "Thing missing in config!"); + + // Restart the core instance to check if settings are loaded at startup + restartServer(); + + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == thingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + qDebug() << "expected thingParams:" << newThingParams; + // check if after the reboot the settings are unchanged + verifyParams(thingParams, thing.toMap().value("params").toList()); + found = true; + break; + } + } + QVERIFY2(found, "Thing missing in config!"); + } + + // delete it + params.clear(); + params.insert("thingId", thingId); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); +} + + +void TestIntegrations::reconfigureByDiscovery_data() +{ + QTest::addColumn("thingClassId"); + QTest::addColumn("resultCount"); + QTest::addColumn("error"); + QTest::addColumn("discoveryParams"); + + QVariantList discoveryParams; + QVariantMap resultCountParam; + resultCountParam.insert("paramTypeId", mockDiscoveryResultCountParamTypeId); + resultCountParam.insert("value", 2); + discoveryParams.append(resultCountParam); + + QTest::newRow("discover 2 things with params") << mockThingClassId << 2 << Thing::ThingErrorNoError << discoveryParams; +} + +void TestIntegrations::reconfigureByDiscovery() +{ + QFETCH(ThingClassId, thingClassId); + QFETCH(int, resultCount); + QFETCH(Thing::ThingError, error); + QFETCH(QVariantList, discoveryParams); + + qCDebug(dcTests()) << "Discovering..."; + QVariantMap params; + params.insert("thingClassId", thingClassId); + params.insert("discoveryParams", discoveryParams); + QVariant response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response); + if (error == Thing::ThingErrorNoError) { + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), resultCount); + } + + // add Discovered Device 1 port 55555 + QVariantList thingDescriptors = response.toMap().value("params").toMap().value("thingDescriptors").toList(); + + ThingDescriptorId descriptorId; + foreach (const QVariant &descriptor, thingDescriptors) { + // find the device with port 55555 + if (descriptor.toMap().value("description").toString() == "55555") { + descriptorId = ThingDescriptorId(descriptor.toMap().value("id").toString()); + qDebug() << descriptorId.toString(); + break; + } + } + + QVERIFY(!descriptorId.isNull()); + + qCDebug(dcTests()) << "Adding..."; + + params.clear(); + response.clear(); + params.insert("thingClassId", thingClassId); + params.insert("name", "Discoverd mock device"); + params.insert("thingDescriptorId", descriptorId); + response = injectAndWait("Integrations.AddThing", params); + + ThingId thingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + + // and now rediscover and find the existing device in the discovery results + qCDebug(dcTests()) << "Re-Discovering..."; + + params.clear(); + response.clear(); + params.insert("thingClassId", thingClassId); + params.insert("discoveryParams", discoveryParams); + response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response, error); + if (error == Thing::ThingErrorNoError) { + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), resultCount); + } + + thingDescriptors = response.toMap().value("params").toMap().value("thingDescriptors").toList(); + + // find the already added device + descriptorId = ThingDescriptorId(); // reset it first + foreach (const QVariant &descriptor, thingDescriptors) { + if (descriptor.toMap().value("thingId").toUuid().toString() == thingId.toString()) { + descriptorId = ThingDescriptorId(descriptor.toMap().value("id").toString()); + break; + } + } + QVERIFY2(!descriptorId.isNull(), QString("Tjhing %1 not found in discovery results: %2").arg(thingId.toString()).arg(qUtf8Printable(QJsonDocument::fromVariant(response).toJson())).toUtf8()); + + qCDebug(dcTests()) << "Reconfiguring..."; + + response.clear(); + params.clear(); + params.insert("thingDescriptorId", descriptorId); + // override port param + QVariantMap portParam; + portParam.insert("paramTypeId", mockThingHttpportParamTypeId); + portParam.insert("value", "55556"); + params.insert("thingParams", QVariantList() << portParam); + response = injectAndWait("Integrations.ReconfigureThing", params); + verifyThingError(response, error); + + response.clear(); + response = injectAndWait("Integrations.GetThings", QVariantMap()); + + QVariantMap deviceMap; + bool found = false; + foreach (const QVariant &thing, response.toMap().value("params").toMap().value("things").toList()) { + if (ThingId(thing.toMap().value("id").toString()) == thingId) { + qDebug() << "found added thing" << thing.toMap().value("params"); + found = true; + deviceMap = thing.toMap(); + break; + } + } + + QVERIFY2(found, "Thing missing in config!"); + QCOMPARE(deviceMap.value("id").toUuid(), QUuid(thingId)); + if (deviceMap.contains("setupComplete")) + QVERIFY2(deviceMap.value("setupComplete").toBool(), "Setup not completed after edit"); + + // Note: this shows that by discovery a not editable param (name) can be changed! + foreach (QVariant param, deviceMap.value("params").toList()) { + if (param.toMap().value("paramTypeId") == mockThingHttpportParamTypeId) { + QCOMPARE(param.toMap().value("value").toInt(), 55556); + } + } + + // check if the daemons are running + QNetworkAccessManager nam; + QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); + + // check if old daemon is still running (should not) + QNetworkRequest request(QUrl(QString("http://localhost:%1").arg(55555))); + QNetworkReply *reply = nam.get(request); + spy.wait(); + QVERIFY2(reply->error(), "The old daemon is still running"); + reply->deleteLater(); + + // check if the daemon is really running on the new port + request = QNetworkRequest(QUrl(QString("http://localhost:%1").arg(55556))); + reply = nam.get(request); + spy.wait(); + QVERIFY2(reply->error() == QNetworkReply::NoError, "The new daemon is not running"); + reply->deleteLater(); + + params.clear(); + params.insert("thingId", thingId.toString()); + response = injectAndWait("Integrations.RemoveThing", params); + verifyThingError(response); +} + +void TestIntegrations::reconfigureByDiscoveryAndPair() +{ + QVariantList discoveryParams; + QVariantMap resultCountParam; + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); + resultCountParam.insert("value", 1); + discoveryParams.append(resultCountParam); + + qCDebug(dcTests()) << "Discovering things..."; + + QVariantMap params; + params.insert("thingClassId", displayPinMockThingClassId); + params.insert("discoveryParams", discoveryParams); + QVariant response = injectAndWait("Integrations.DiscoverThings", params); + + verifyThingError(response); + QVariantList thingDescriptors = response.toMap().value("params").toMap().value("thingDescriptors").toList(); + + qCDebug(dcTests()) << "Discovery result:" << qUtf8Printable(QJsonDocument::fromVariant(thingDescriptors).toJson(QJsonDocument::Indented)); + QCOMPARE(response.toMap().value("params").toMap().value("thingDescriptors").toList().count(), 1); + + // add Discovered thing 1 port 55555 + + QVariant descriptor = thingDescriptors.first(); + ThingDescriptorId descriptorId = ThingDescriptorId(descriptor.toMap().value("id").toString()); + QVERIFY2(!descriptorId.isNull(), "ThingDescriptorId is Null"); + + qCDebug(dcTests()) << "Pairing descriptorId:" << descriptorId; + + params.clear(); + response.clear(); + params.insert("thingClassId", displayPinMockThingClassId); + params.insert("name", "Discoverd mock device"); + params.insert("thingDescriptorId", descriptorId); + response = injectAndWait("Integrations.PairThing", params); + verifyThingError(response); + + PairingTransactionId pairingTransactionId = PairingTransactionId(response.toMap().value("params").toMap().value("pairingTransactionId").toString()); + qCDebug(dcTests()) << "PairThing result:" << qUtf8Printable(QJsonDocument::fromVariant(response).toJson(QJsonDocument::Indented)); + + qCDebug(dcTests()) << "Confirming pairing for transaction ID" << pairingTransactionId; + params.clear(); + response.clear(); + params.insert("pairingTransactionId", pairingTransactionId.toString()); + params.insert("secret", "243681"); + response = injectAndWait("Integrations.ConfirmPairing", params); + verifyThingError(response); + + ThingId thingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + + qCDebug(dcTests()) << "Discovering again..."; + + // and now rediscover, and edit the first device with the second + params.clear(); + response.clear(); + params.insert("thingClassId", displayPinMockThingClassId); + params.insert("discoveryParams", discoveryParams); + response = injectAndWait("Integrations.DiscoverThings", params); + + thingDescriptors = response.toMap().value("params").toMap().value("thingDescriptors").toList(); + qCDebug(dcTests()) << "Discovery result:" << qUtf8Printable(QJsonDocument::fromVariant(thingDescriptors).toJson(QJsonDocument::Indented)); + + verifyThingError(response, Thing::ThingErrorNoError); + QCOMPARE(thingDescriptors.count(), 1); + + descriptor = thingDescriptors.first(); + QVERIFY2(ThingId(descriptor.toMap().value("thingId").toString()) == thingId, "thingId not set in descriptor"); + + // get the descriptor again + descriptorId = ThingDescriptorId(descriptor.toMap().value("id").toString()); + + QVERIFY(!descriptorId.isNull()); + + qDebug() << "Reconfiguring device by pairing again" << descriptorId; + + params.clear(); + response.clear(); + params.insert("thingClassId", displayPinMockThingClassId); + params.insert("name", "Discoverd mock"); + params.insert("thingDescriptorId", descriptorId); + response = injectAndWait("Integrations.PairThing", params); + verifyThingError(response); + + pairingTransactionId = PairingTransactionId(response.toMap().value("params").toMap().value("pairingTransactionId").toString()); + qCDebug(dcTests()) << "PairThing result:" << qUtf8Printable(QJsonDocument::fromVariant(response).toJson(QJsonDocument::Indented)); + + + qCDebug(dcTests()) << "Confirming pairing for transaction ID" << pairingTransactionId; + params.clear(); + response.clear(); + params.insert("pairingTransactionId", pairingTransactionId.toString()); + params.insert("secret", "243681"); + response = injectAndWait("Integrations.ConfirmPairing", params); + verifyThingError(response); + + thingId = ThingId(response.toMap().value("params").toMap().value("thingId").toString()); + QVERIFY(!thingId.isNull()); + +} + +void TestIntegrations::reconfigureAutoThing() +{ + qCDebug(dcTests()) << "Reconfigure auto thing"; + + // Get the autodevice + QList things = NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId); + QVERIFY2(things.count() > 0, "There needs to be at least one auto-created Mock Device for this test"); + + // Get current auto device infos + Thing *currentThing = things.first(); + ThingId thingId = currentThing->id(); + int currentPort = currentThing->paramValue(autoMockThingHttpportParamTypeId).toInt(); + + // Trigger reconfigure signal in mock device + QNetworkAccessManager *nam = new QNetworkAccessManager(this); + QSignalSpy spy(nam, &QNetworkAccessManager::finished); + QNetworkReply *reply = nam->get(QNetworkRequest(QUrl(QString("http://localhost:%1/reconfigureautodevice").arg(currentPort)))); + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + + Thing *thing = NymeaCore::instance()->thingManager()->findConfiguredThing(thingId); + QVERIFY(thing); + int newPort = thing->paramValue(autoMockThingHttpportParamTypeId).toInt(); + // Note: reconfigure autodevice increases the http port by 1 + QCOMPARE(newPort, currentPort + 1); +} + + +void TestIntegrations::removeThing_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("thingError"); + + QTest::newRow("Existing thing") << ThingId(m_mockThingId) << Thing::ThingErrorNoError; + QTest::newRow("Not existing thing") << ThingId::createThingId() << Thing::ThingErrorThingNotFound; +// QTest::newRow("Auto device") << m_mockDeviceAutoId << Thing::ThingErrorCreationMethodNotSupported; +} + +void TestIntegrations::removeThing() +{ + QFETCH(ThingId, thingId); + QFETCH(Thing::ThingError, thingError); + + NymeaSettings settings(NymeaSettings::SettingsRoleThings); + settings.beginGroup("ThingConfig"); + if (thingError == Thing::ThingErrorNoError) { + settings.beginGroup(m_mockThingId.toString()); + // Make sure we have some config values for this device + QVERIFY(settings.allKeys().count() > 0); + } + + QVariantMap params; + params.insert("thingId", thingId); + + QVariant response = injectAndWait("Integrations.RemoveThing", params); + + verifyThingError(response, thingError); + + if (Thing::ThingErrorNoError) { + // Make sure the device is gone from settings too + QCOMPARE(settings.allKeys().count(), 0); + } +} + +void TestIntegrations::removeAutoThing() +{ + // Setup connection to mock client + QNetworkAccessManager *nam = new QNetworkAccessManager(this); + QSignalSpy spy(nam, SIGNAL(finished(QNetworkReply*))); + + // First try to make a manually created device disappear. It must not go away + + QList things = NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId); + int oldCount = things.count(); + QVERIFY2(oldCount > 0, "There needs to be at least one configured Mock Device for this test"); + Thing *thing = things.first(); + + // trigger disappear signal in mock device + int port = thing->paramValue(autoMockThingHttpportParamTypeId).toInt(); + QNetworkRequest request(QUrl(QString("http://localhost:%1/disappear").arg(port))); + QNetworkReply *reply = nam->get(request); + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + QVERIFY2(NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId).count() == oldCount, "Mocked thing has disappeared even though it shouldn't"); + + // Ok, now do the same with an autocreated one. It should go away + + things = NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId); + oldCount = things.count(); + QVERIFY2(oldCount > 0, "There needs to be at least one auto-created Mock Device for this test"); + thing = things.first(); + + // trigger disappear signal in mock device + spy.clear(); + port = thing->paramValue(autoMockThingHttpportParamTypeId).toInt(); + request.setUrl(QUrl(QString("http://localhost:%1/disappear").arg(port))); + reply = nam->get(request); + + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + + // Make sure one mock device has disappeared + QCOMPARE(NymeaCore::instance()->thingManager()->findConfiguredThings(autoMockThingClassId).count(), oldCount - 1); +} + +void TestIntegrations::testBrowsing_data() +{ + QTest::addColumn("thingId"); + + QTest::newRow("regular mock") << ThingId(m_mockThingId); + QTest::newRow("async mock") << ThingId(m_mockThingAsyncId); +} + +void TestIntegrations::testBrowsing() +{ + QFETCH(ThingId, thingId); + + // Check if mockdevice is browsable + QVariant response = injectAndWait("Integrations.GetThingClasses"); + + QVariantMap mockThingClass; + foreach (const QVariant &thingClassVariant, response.toMap().value("params").toMap().value("thingClasses").toList()) { + if (ThingClassId(thingClassVariant.toMap().value("id").toString()) == mockThingClassId) { + mockThingClass = thingClassVariant.toMap(); + } + } + + QVERIFY2(ThingClassId(mockThingClass.value("id").toString()) == mockThingClassId, "Could not find mock device"); + QCOMPARE(mockThingClass.value("browsable").toBool(), true); + + + // Browse it + QVariantMap params; + params.insert("thingId", thingId); + response = injectAndWait("Integrations.BrowseThing", params); + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), QString("ThingErrorNoError")); + QVariantList browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QVERIFY2(browserEntries.count() > 0, "BrowseThing did not return any items."); + + // Browse item 001, it should be a folder with 2 items + params.insert("itemId", "001"); + response = injectAndWait("Integrations.BrowseThing", params); + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), QString("ThingErrorNoError")); + browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QVERIFY2(browserEntries.count() == 2, "BrowseThing did not return 2 items as childs in folder with id 001."); + + // Browse a non-existent item + params["itemId"] = "this-does-not-exist"; + response = injectAndWait("Integrations.BrowseThing", params); + browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), QString("ThingErrorItemNotFound")); + QCOMPARE(browserEntries.count(), 0); + + +} + +void TestIntegrations::discoverThingsParenting() +{ + // Try to discover a mock child device. We don't have a mockParent yet, so it should fail + ThingDiscoveryInfo *discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(childMockThingClassId, ParamList()); + { + QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); + spy.wait(); + } + QVERIFY(discoveryInfo->thingDescriptors().count() == 0); + + + // Now create a mock parent by discovering... + discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(parentMockThingClassId, ParamList()); + { + QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); + spy.wait(); + } + QVERIFY(discoveryInfo->thingDescriptors().count() == 1); + ThingDescriptorId descriptorId = discoveryInfo->thingDescriptors().first().id(); + + QSignalSpy addSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); + ThingSetupInfo *setupInfo = NymeaCore::instance()->thingManager()->addConfiguredThing(descriptorId, ParamList(), "Mock Parent (Discovered)"); + { + QSignalSpy spy(setupInfo, &ThingSetupInfo::finished); + spy.wait(); + } + QCOMPARE(setupInfo->status(), Thing::ThingErrorNoError); + + addSpy.wait(); + QCOMPARE(addSpy.count(), 2); // Mock parent will also auto-create a child instantly + + Thing *parentThing = addSpy.at(0).first().value(); + qCDebug(dcTests()) << "Added parent:" << parentThing->name(); + QVERIFY(parentThing->thingClassId() == parentMockThingClassId); + + + // Ok we have our parent device, let's discover for childs again + discoveryInfo = NymeaCore::instance()->thingManager()->discoverThings(childMockThingClassId, ParamList()); + { + QSignalSpy spy(discoveryInfo, &ThingDiscoveryInfo::finished); + spy.wait(); + } + QVERIFY(discoveryInfo->thingDescriptors().count() == 1); + descriptorId = discoveryInfo->thingDescriptors().first().id(); + + // Found one! Adding it... + addSpy.clear(); + setupInfo = NymeaCore::instance()->thingManager()->addConfiguredThing(descriptorId, ParamList(), "Mock Child (Discovered)"); + { + QSignalSpy spy(setupInfo, &ThingSetupInfo::finished); + spy.wait(); + } + QCOMPARE(setupInfo->status(), Thing::ThingErrorNoError); + + QCOMPARE(addSpy.count(), 1); + + Thing *childThing = addSpy.at(0).first().value(); + qCDebug(dcTests()) << "Added child:" << childThing->name(); + QVERIFY(childThing->thingClassId() == childMockThingClassId); + + // Now delete the parent and make sure the child will be deleted too + QSignalSpy removeSpy(NymeaCore::instance(), &NymeaCore::thingRemoved); + QPair > ret = NymeaCore::instance()->removeConfiguredThing(parentThing->id(), QHash()); + QCOMPARE(ret.first, Thing::ThingErrorNoError); + QCOMPARE(removeSpy.count(), 3); // The parent, the auto-mock and the discovered mock + +} + +void TestIntegrations::testExecuteBrowserItem_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("itemId"); + QTest::addColumn("thingError"); + + QTest::newRow("regular mock - good item") << ThingId(m_mockThingId) << "002" << "ThingErrorNoError"; + QTest::newRow("regular mock - bad item") << ThingId(m_mockThingId) << "001" << "ThingErrorItemNotExecutable"; + QTest::newRow("async mock - good item") << ThingId(m_mockThingAsyncId) << "002" << "ThingErrorNoError"; +} + +void TestIntegrations::testExecuteBrowserItem() +{ + QFETCH(ThingId, thingId); + QFETCH(QString, itemId); + QFETCH(QString, thingError); + + QVariantMap params; + params.insert("thingId", thingId); + params.insert("itemId", itemId); + QVariant response = injectAndWait("Integrations.ExecuteBrowserItem", params); + qCDebug(dcTests()) << "resp" << response; + + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), thingError); +} + +void TestIntegrations::testExecuteBrowserItemAction_data() +{ + QTest::addColumn("thingId"); + + QTest::newRow("regular mock") << ThingId(m_mockThingId); + QTest::newRow("async mock") << ThingId(m_mockThingAsyncId); +} + +void TestIntegrations::testExecuteBrowserItemAction() +{ + QFETCH(ThingId, thingId); + + QVariantMap getItemsParams; + getItemsParams.insert("thingId", thingId); + QVariant response = injectAndWait("Integrations.BrowseThing", getItemsParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + + QVariantList browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QVERIFY(browserEntries.count() > 2); + + QVariantMap item002; // Find the item we need for this test + foreach (const QVariant &item, browserEntries) { + if (item.toMap().value("id").toString() == "002") { + item002 = item.toMap(); + break; + } + } + QVERIFY2(item002.value("id").toString() == QString("002"), "Item with context actions not found"); + QVERIFY2(item002.value("actionTypeIds").toList().count() > 0, "Item doesn't have actionTypeIds"); + QVERIFY2(ActionTypeId(item002.value("actionTypeIds").toList().first().toString()) == mockAddToFavoritesBrowserItemActionTypeId, "AddToFavorites action type id not found in item"); + + + // Browse favorites + // ID is "favorites" in mock + // It should be ampty at this point + getItemsParams.insert("itemId", "favorites"); + response = injectAndWait("Integrations.BrowseThing", getItemsParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + + browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QVERIFY2(browserEntries.count() == 0, "Favorites should be empty at this point"); + + // Now add an item to the favorites + QVariantMap actionParams; + actionParams.insert("thingId", thingId); + actionParams.insert("itemId", "002"); + actionParams.insert("actionTypeId", mockAddToFavoritesBrowserItemActionTypeId); + response = injectAndWait("Integrations.ExecuteBrowserItemAction", actionParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), QString("ThingErrorNoError")); + + // Fetch the list again + response = injectAndWait("Integrations.BrowseThing", getItemsParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + + browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QCOMPARE(browserEntries.count(), 1); + + QString favoriteItemId = browserEntries.first().toMap().value("id").toString(); + QVERIFY2(!favoriteItemId.isEmpty(), "ItemId is empty in favorites list"); + + // Now remove the again from favorites + actionParams.clear(); + actionParams.insert("thingId", thingId); + actionParams.insert("itemId", favoriteItemId); + actionParams.insert("actionTypeId", mockRemoveFromFavoritesBrowserItemActionTypeId); + response = injectAndWait("Integrations.ExecuteBrowserItemAction", actionParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + QCOMPARE(response.toMap().value("params").toMap().value("thingError").toString(), QString("ThingErrorNoError")); + + // Fetch the list again + response = injectAndWait("Integrations.BrowseThing", getItemsParams); + QCOMPARE(response.toMap().value("status").toString(), QString("success")); + + browserEntries = response.toMap().value("params").toMap().value("items").toList(); + QCOMPARE(browserEntries.count(), 0); + +} + +void TestIntegrations::executeAction_data() +{ + QTest::addColumn("thingId"); + QTest::addColumn("actionTypeId"); + QTest::addColumn("actionParams"); + QTest::addColumn("error"); + + QVariantList params; + QVariantMap param1; + param1.insert("paramTypeId", mockWithParamsActionParam1ParamTypeId); + param1.insert("value", 5); + params.append(param1); + QVariantMap param2; + param2.insert("paramTypeId", mockWithParamsActionParam2ParamTypeId); + param2.insert("value", true); + params.append(param2); + + QTest::newRow("valid action") << ThingId(m_mockThingId) << mockWithParamsActionTypeId << params << Thing::ThingErrorNoError; + QTest::newRow("invalid thingId") << ThingId::createThingId() << mockWithParamsActionTypeId << params << Thing::ThingErrorThingNotFound; + QTest::newRow("invalid actionTypeId") << ThingId(m_mockThingId) << ActionTypeId::createActionTypeId() << params << Thing::ThingErrorActionTypeNotFound; + QTest::newRow("missing params") << ThingId(m_mockThingId) << mockWithParamsActionTypeId << QVariantList() << Thing::ThingErrorMissingParameter; + QTest::newRow("async action") << ThingId(m_mockThingId) << mockAsyncActionTypeId << QVariantList() << Thing::ThingErrorNoError; + QTest::newRow("broken action") << ThingId(m_mockThingId) << mockFailingActionTypeId << QVariantList() << Thing::ThingErrorSetupFailed; + QTest::newRow("async broken action") << ThingId(m_mockThingId) << mockAsyncFailingActionTypeId << QVariantList() << Thing::ThingErrorSetupFailed; +} + +void TestIntegrations::executeAction() +{ + QFETCH(ThingId, thingId); + QFETCH(ActionTypeId, actionTypeId); + QFETCH(QVariantList, actionParams); + QFETCH(Thing::ThingError, error); + + QVariantMap params; + params.insert("actionTypeId", actionTypeId); + params.insert("thingId", thingId); + params.insert("params", actionParams); + QVariant response = injectAndWait("Integrations.ExecuteAction", params); + qDebug() << "executeActionresponse" << response; + verifyError(response, "thingError", enumValueName(error)); + + // Fetch action execution history from mock device + QNetworkAccessManager nam; + QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); + + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); + QNetworkReply *reply = nam.get(request); + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + QByteArray data = reply->readAll(); + + if (error == Thing::ThingErrorNoError) { + QVERIFY2(actionTypeId == ActionTypeId(data), QString("ActionTypeId mismatch. Got %1, Expected: %2") + .arg(ActionTypeId(data).toString()).arg(actionTypeId.toString()).toLatin1().data()); + } else { + QVERIFY2(data.length() == 0, QString("Data is %1, should be empty.").arg(QString(data)).toLatin1().data()); + } + + // cleanup for the next run + spy.clear(); + request.setUrl(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockThing1Port))); + reply = nam.get(request); + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + + spy.clear(); + request.setUrl(QUrl(QString("http://localhost:%1/actionhistory").arg(m_mockThing1Port))); + reply = nam.get(request); + spy.wait(); + QCOMPARE(spy.count(), 1); + reply->deleteLater(); + data = reply->readAll(); + qDebug() << "cleared data:" << data; + +} + +void TestIntegrations::triggerEvent() +{ + enableNotifications({"Integrations"}); + QList things = NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId); + QVERIFY2(things.count() > 0, "There needs to be at least one configured Mock Device for this test"); + Thing *thing = things.first(); + + QSignalSpy spy(NymeaCore::instance(), SIGNAL(eventTriggered(const Event&))); + QSignalSpy notificationSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // Setup connection to mock client + QNetworkAccessManager nam; + + // trigger event in mock device + int port = thing->paramValue(mockThingHttpportParamTypeId).toInt(); + QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(port).arg(mockEvent1EventTypeId.toString()))); + QNetworkReply *reply = nam.get(request); + connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); + + // Lets wait for the notification + spy.wait(); + QVERIFY(spy.count() > 0); + for (int i = 0; i < spy.count(); i++ ){ + Event event = spy.at(i).at(0).value(); + if (event.thingId() == thing->id()) { + // Make sure the event contains all the stuff we expect + QCOMPARE(event.eventTypeId(), mockEvent1EventTypeId); + } + } + + // Check for the notification on JSON API + QVariantList notifications; + notifications = checkNotifications(notificationSpy, "Integrations.EventTriggered"); + QVERIFY2(notifications.count() == 1, "Should get Integrations.EventTriggered notification"); + QVariantMap notificationContent = notifications.first().toMap().value("params").toMap(); + + QCOMPARE(notificationContent.value("event").toMap().value("thingId").toUuid().toString(), thing->id().toString()); + QCOMPARE(notificationContent.value("event").toMap().value("eventTypeId").toUuid().toString(), mockEvent1EventTypeId.toString()); +} + +void TestIntegrations::triggerStateChangeEvent() +{ + enableNotifications({"Integrations"}); + + QList things = NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId); + QVERIFY2(things.count() > 0, "There needs to be at least one configured Mock for this test"); + Thing *thing = things.first(); + + QSignalSpy spy(NymeaCore::instance(), SIGNAL(eventTriggered(const Event&))); + QSignalSpy notificationSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // Setup connection to mock client + QNetworkAccessManager nam; + + // trigger state changed event in mock device + int port = thing->paramValue(mockThingHttpportParamTypeId).toInt(); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(port).arg(mockIntStateTypeId.toString()).arg(11))); + QNetworkReply *reply = nam.get(request); + connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); + + // Lets wait for the notification + spy.wait(); + QVERIFY(spy.count() > 0); + for (int i = 0; i < spy.count(); i++ ){ + Event event = spy.at(i).at(0).value(); + if (event.thingId() == thing->id()) { + // Make sure the event contains all the stuff we expect + QCOMPARE(event.eventTypeId().toString(), mockIntStateTypeId.toString()); + QCOMPARE(event.param(ParamTypeId(mockIntStateTypeId.toString())).value().toInt(), 11); + } + } + + // Check for the notification on JSON API + QVariantList notifications; + notifications = checkNotifications(notificationSpy, "Integrations.EventTriggered"); + QVERIFY2(notifications.count() == 1, "Should get Integrations.EventTriggered notification"); + QVariantMap notificationContent = notifications.first().toMap().value("params").toMap(); + + QCOMPARE(notificationContent.value("event").toMap().value("deviceId").toUuid().toString(), thing->id().toString()); + QCOMPARE(notificationContent.value("event").toMap().value("eventTypeId").toUuid().toString(), mockIntEventTypeId.toString()); + +} + +void TestIntegrations::params() +{ + Event event; + ParamList params; + ParamTypeId id = ParamTypeId::createParamTypeId(); + Param p(id, "foo bar"); + params.append(p); + event.setParams(params); + + QVERIFY(event.param(id).value().toString() == "foo bar"); + QVERIFY(!event.param(ParamTypeId::createParamTypeId()).value().isValid()); +} + +void TestIntegrations::asyncSetupEmitsSetupStatusUpdate() +{ + QVariantMap configuredDevices = injectAndWait("Integrations.GetThings").toMap(); + foreach (const QVariant &deviceVariant, configuredDevices.value("params").toMap().value("things").toList()) { + QVariantMap device = deviceVariant.toMap(); + qCDebug(dcTests()) << "configured thing" << device.value("setupStatus"); + } + + // Restart the core instance to check if settings are loaded at startup + restartServer(); + enableNotifications({"Integrations"}); + + QSignalSpy notificationSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + configuredDevices = injectAndWait("Integrations.GetThings").toMap(); + QList thingsWithSetupInProgress; + foreach (const QVariant &deviceVariant, configuredDevices.value("params").toMap().value("things").toList()) { + QVariantMap thing = deviceVariant.toMap(); + qCDebug(dcTests()) << "Configured thing" << thing.value("name").toString() << "with setup status" << thing.value("setupStatus").toString(); + if (thing.value("setupStatus").toString() == "ThingSetupStatusInProgress") { + thingsWithSetupInProgress << thing.value("id").toUuid(); + } + } + QVERIFY2(thingsWithSetupInProgress.count() > 0, "This test requires at least one device that is still being set up at this point."); + + QDateTime maxTime = QDateTime::currentDateTime().addSecs(10); + while (QDateTime::currentDateTime() < maxTime && thingsWithSetupInProgress.count() > 0) { + QList> notifications = notificationSpy; + while (notifications.count() > 0) { + QByteArray notificationData = notifications.takeFirst().at(1).toByteArray(); + QVariantMap notification = QJsonDocument::fromJson(notificationData).toVariant().toMap(); + if (notification.value("notification").toString() == "Integrations.ThingChanged") { + QString setupStatus = notification.value("params").toMap().value("thing").toMap().value("setupStatus").toString(); + if (setupStatus == "ThingSetupStatusComplete") { + qCDebug(dcTests()) << "Device setup completed for" << notification.value("params").toMap().value("thing").toMap().value("name").toString(); + ThingId thingId = notification.value("params").toMap().value("thing").toMap().value("id").toUuid(); + thingsWithSetupInProgress.removeAll(thingId); + } + } + } + notificationSpy.clear(); + if (thingsWithSetupInProgress.count() > 0) { + notificationSpy.wait(); + } + } + + QVERIFY2(thingsWithSetupInProgress.isEmpty(), "Some things did not finish the setup!"); +} + +#include "testintegrations.moc" +QTEST_MAIN(TestIntegrations) + diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index 72b2a751..9e34fcc8 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -70,13 +70,10 @@ private slots: void enableDisableNotifications_legacy_data(); void enableDisableNotifications_legacy(); - void deviceAddedRemovedNotifications(); void ruleAddedRemovedNotifications(); void ruleActiveChangedNotifications(); - void deviceChangedNotifications(); - void stateChangeEmitsNotifications(); void pluginConfigChangeEmitsNotification(); @@ -213,7 +210,7 @@ void TestJSONRPC::testHandshakeLocale() QVariantMap supportedDevices = injectAndWait("Devices.GetSupportedDevices").toMap(); bool found = false; foreach (const QVariant &dcMap, supportedDevices.value("params").toMap().value("deviceClasses").toList()) { - if (dcMap.toMap().value("id").toUuid() == mockDeviceAutoThingClassId) { + if (dcMap.toMap().value("id").toUuid() == autoMockThingClassId) { QCOMPARE(dcMap.toMap().value("displayName").toString(), QString("Mock Device (Auto created)")); found = true; } @@ -229,7 +226,7 @@ void TestJSONRPC::testHandshakeLocale() supportedDevices = injectAndWait("Devices.GetSupportedDevices").toMap(); found = false; foreach (const QVariant &dcMap, supportedDevices.value("params").toMap().value("deviceClasses").toList()) { - if (dcMap.toMap().value("id").toUuid() == mockDeviceAutoThingClassId) { + if (dcMap.toMap().value("id").toUuid() == autoMockThingClassId) { QCOMPARE(dcMap.toMap().value("displayName").toString(), QString("Mock Gerät (Automatisch erzeugt)")); found = true; } @@ -677,7 +674,7 @@ void TestJSONRPC::enableDisableNotifications_legacy() QStringList expectedNamespaces; if (enabled == "true") { - expectedNamespaces << "Actions" << "NetworkManager" << "Devices" << "System" << "Rules" << "States" << "Logging" << "Tags" << "JSONRPC" << "Configuration" << "Events" << "Scripts" << "Users"; + expectedNamespaces << "Actions" << "NetworkManager" << "Devices" << "Integrations" << "System" << "Rules" << "States" << "Logging" << "Tags" << "JSONRPC" << "Configuration" << "Events" << "Scripts" << "Users"; } std::sort(expectedNamespaces.begin(), expectedNamespaces.end()); @@ -690,51 +687,6 @@ void TestJSONRPC::enableDisableNotifications_legacy() QCOMPARE(expectedNamespaces, actualNamespaces); } -void TestJSONRPC::deviceAddedRemovedNotifications() -{ - enableNotifications({"Devices"}); - - // Setup connection to mock client - QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); - - // add device and wait for notification - QVariantList deviceParams; - QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); - httpportParam.insert("value", 8765); - deviceParams.append(httpportParam); - - QVariantMap params; clientSpy.clear(); - params.insert("ddeviceClassId", mockThingClassId); - params.insert("name", "Mock device"); - params.insert("deviceParams", deviceParams); - QVariant response = injectAndWait("Devices.AddConfiguredDevice", params); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - QVariantMap notificationDeviceMap = checkNotification(clientSpy, "Devices.DeviceAdded").toMap().value("params").toMap().value("device").toMap(); - - ThingId deviceId = ThingId(response.toMap().value("params").toMap().value("deviceId").toString()); - QVERIFY(!deviceId.isNull()); - - // check the DeviceAdded notification - QCOMPARE(notificationDeviceMap.value("deviceClassId").toString(), mockThingClassId.toString()); - QCOMPARE(notificationDeviceMap.value("id").toString(), deviceId.toString()); - foreach (const QVariant ¶m, notificationDeviceMap.value("params").toList()) { - if (param.toMap().value("name").toString() == "httpport") { - QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); - } - } - - // now remove the device and check the device removed notification - params.clear(); response.clear(); clientSpy.clear(); - params.insert("deviceId", deviceId); - response = injectAndWait("Devices.RemoveConfiguredDevice", params); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - checkNotification(clientSpy, "Devices.DeviceRemoved"); - - QCOMPARE(disableNotifications(), true); -} void TestJSONRPC::ruleAddedRemovedNotifications() { @@ -747,9 +699,14 @@ void TestJSONRPC::ruleAddedRemovedNotifications() // StateDescriptor QVariantMap stateDescriptor; stateDescriptor.insert("stateTypeId", mockIntStateTypeId); - stateDescriptor.insert("deviceId", m_mockThingId); + stateDescriptor.insert("thingId", m_mockThingId); + stateDescriptor.insert("deviceId", m_mockThingId); // DEPRECATED stateDescriptor.insert("operator", enumValueName(Types::ValueOperatorLess)); stateDescriptor.insert("value", "20"); + // This is a bit odd: QUuid.toString() wraps the uuids in {}, however, the implicit cast doesn't + // .toString(QUuid::WithoutBraces) has only been added in 5.11 so we can't use that either... + // Only hack I can come up with right now is to convert it to a Json and back to use the implicit cast + stateDescriptor = QJsonDocument::fromVariant(stateDescriptor).toVariant().toMap(); QVariantMap stateEvaluator; stateEvaluator.insert("stateDescriptor", stateDescriptor); @@ -757,17 +714,26 @@ void TestJSONRPC::ruleAddedRemovedNotifications() // RuleAction QVariantMap actionNoParams; actionNoParams.insert("actionTypeId", mockWithoutParamsActionTypeId); - actionNoParams.insert("deviceId", m_mockThingId); + actionNoParams.insert("thingId", m_mockThingId); + actionNoParams.insert("deviceId", m_mockThingId); // DEPRECATED + // This is a bit odd: QUuid.toString() wraps the uuids in {}, however, the implicit cast doesn't + // .toString(QUuid::WithoutBraces) has only been added in 5.11 so we can't use that either... + // Only hack I can come up with right now is to convert it to a Json and back to use the implicit cast + QVariantList actions = QVariantList() << QJsonDocument::fromVariant(actionNoParams).toVariant().toMap(); // EventDescriptor QVariantMap eventDescriptor; eventDescriptor.insert("eventTypeId", mockEvent1EventTypeId); - eventDescriptor.insert("deviceId", m_mockThingId); - QVariantList eventDescriptors = QVariantList() << eventDescriptor; + eventDescriptor.insert("thingId", m_mockThingId); + eventDescriptor.insert("deviceId", m_mockThingId); // DEPRECATED + // This is a bit odd: QUuid.toString() wraps the uuids in {}, however, the implicit cast doesn't + // .toString(QUuid::WithoutBraces) has only been added in 5.11 so we can't use that either... + // Only hack I can come up with right now is to convert it to a Json and back to use the implicit cast + QVariantList eventDescriptors = QVariantList() << QJsonDocument::fromVariant(eventDescriptor).toVariant().toMap(); QVariantMap params; params.insert("name", "Test Rule notifications"); - params.insert("actions", QVariantList() << actionNoParams); + params.insert("actions", actions); params.insert("eventDescriptors", eventDescriptors); params.insert("stateEvaluator", stateEvaluator); @@ -781,9 +747,17 @@ void TestJSONRPC::ruleAddedRemovedNotifications() QCOMPARE(notificationRuleMap.value("enabled").toBool(), true); QCOMPARE(notificationRuleMap.value("name").toString(), params.value("name").toString()); - QCOMPARE(notificationRuleMap.value("id").toString(), ruleId.toString()); - QCOMPARE(notificationRuleMap.value("actions").toList(), QVariantList() << actionNoParams); - QCOMPARE(notificationRuleMap.value("stateEvaluator").toMap().value("stateDescriptor").toMap(), stateDescriptor); + QCOMPARE(notificationRuleMap.value("id").toUuid(), QUuid(ruleId)); + QVERIFY2(notificationRuleMap.value("actions").toList() == actions, + QString("actions not matching.\nExpected: %1\nGot %2") + .arg(QString(QJsonDocument::fromVariant(actions).toJson())) + .arg(QString(QJsonDocument::fromVariant(notificationRuleMap.value("actions").toList()).toJson())) + .toUtf8()); + QVERIFY2(notificationRuleMap.value("stateEvaluator").toMap().value("stateDescriptor").toMap() == stateDescriptor, + QString("stateDescriptor not matching.\nExpected: %1\nGot %2") + .arg(QString(QJsonDocument::fromVariant(stateDescriptor).toJson())) + .arg(QString(QJsonDocument::fromVariant(notificationRuleMap.value("stateEvaluator").toMap().value("stateDescriptor").toMap()).toJson())) + .toUtf8()); QVERIFY2(notificationRuleMap.value("eventDescriptors").toList() == eventDescriptors, QString("eventDescriptors not matching.\nExpected: %1\nGot %2") .arg(QString(QJsonDocument::fromVariant(eventDescriptors).toJson())) @@ -814,9 +788,14 @@ void TestJSONRPC::ruleActiveChangedNotifications() // StateDescriptor QVariantMap stateDescriptor; stateDescriptor.insert("stateTypeId", mockIntStateTypeId); - stateDescriptor.insert("deviceId", m_mockThingId); + stateDescriptor.insert("thingId", m_mockThingId); + stateDescriptor.insert("deviceId", m_mockThingId); // DEPRECATED stateDescriptor.insert("operator", enumValueName(Types::ValueOperatorEquals)); stateDescriptor.insert("value", "20"); + // This is a bit odd: QUuid.toString() wraps the uuids in {}, however, the implicit cast doesn't + // .toString(QUuid::WithoutBraces) has only been added in 5.11 so we can't use that either... + // Only hack I can come up with right now is to convert it to a Json and back to use the implicit cast + stateDescriptor = QJsonDocument::fromVariant(stateDescriptor).toVariant().toMap(); QVariantMap stateEvaluator; stateEvaluator.insert("stateDescriptor", stateDescriptor); @@ -824,11 +803,16 @@ void TestJSONRPC::ruleActiveChangedNotifications() // RuleAction QVariantMap actionNoParams; actionNoParams.insert("actionTypeId", mockWithoutParamsActionTypeId); - actionNoParams.insert("deviceId", m_mockThingId); + actionNoParams.insert("thingId", m_mockThingId); + actionNoParams.insert("deviceId", m_mockThingId); // DEPRECATED + // This is a bit odd: QUuid.toString() wraps the uuids in {}, however, the implicit cast doesn't + // .toString(QUuid::WithoutBraces) has only been added in 5.11 so we can't use that either... + // Only hack I can come up with right now is to convert it to a Json and back to use the implicit cast + QVariantList actions = QVariantList() << QJsonDocument::fromVariant(actionNoParams).toVariant().toMap(); params.clear(); response.clear(); params.insert("name", "Test Rule notifications"); - params.insert("actions", QVariantList() << actionNoParams); + params.insert("actions", actions); params.insert("stateEvaluator", stateEvaluator); // Setup connection to mock client @@ -844,8 +828,8 @@ void TestJSONRPC::ruleActiveChangedNotifications() QVERIFY(!ruleId.isNull()); QCOMPARE(notificationRuleMap.value("enabled").toBool(), true); QCOMPARE(notificationRuleMap.value("name").toString(), params.value("name").toString()); - QCOMPARE(notificationRuleMap.value("id").toString(), ruleId.toString()); - QCOMPARE(notificationRuleMap.value("actions").toList(), QVariantList() << actionNoParams); + QCOMPARE(notificationRuleMap.value("id").toUuid(), QUuid(ruleId)); + QCOMPARE(notificationRuleMap.value("actions").toList(), actions); QCOMPARE(notificationRuleMap.value("stateEvaluator").toMap().value("stateDescriptor").toMap(), stateDescriptor); QCOMPARE(notificationRuleMap.value("exitActions").toList(), QVariantList()); @@ -855,7 +839,7 @@ void TestJSONRPC::ruleActiveChangedNotifications() // state state to 20 qDebug() << "setting mock int state to 20"; - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(20))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(20))); QNetworkReply *reply = nam.get(request); connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); @@ -868,6 +852,8 @@ void TestJSONRPC::ruleActiveChangedNotifications() clientSpy.wait(); + waitForDBSync(); + // Make sure the logg notification contains all the stuff we expect QVariantList logEntryAddedVariants = checkNotifications(clientSpy, "Logging.LogEntryAdded"); QVERIFY2(!logEntryAddedVariants.isEmpty(), "Did not get Logging.LogEntryAdded notification."); @@ -886,7 +872,7 @@ void TestJSONRPC::ruleActiveChangedNotifications() // set the rule inactive qDebug() << "setting mock int state to 42"; - QNetworkRequest request2(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(42))); + QNetworkRequest request2(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(42))); QNetworkReply *reply2 = nam.get(request2); connect(reply2, SIGNAL(finished()), reply2, SLOT(deleteLater())); @@ -907,11 +893,12 @@ void TestJSONRPC::ruleActiveChangedNotifications() logEntryAddedVariants = checkNotifications(clientSpy, "Logging.LogEntryAdded"); QVERIFY2(!logEntryAddedVariants.isEmpty(), "Did not get Logging.LogEntryAdded notification."); found = false; - foreach (const QVariant &loggEntryAddedVariant, logEntryAddedVariants) { - if (loggEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("typeId").toUuid() == mockIntStateTypeId) { + foreach (const QVariant &logEntryAddedVariant, logEntryAddedVariants) { + qCDebug(dcTests()) << "Checking log entry" << mockIntStateTypeId << qUtf8Printable(QJsonDocument::fromVariant(logEntryAddedVariant).toJson()); + if (logEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("typeId").toUuid() == mockIntStateTypeId) { found = true; - QCOMPARE(loggEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("source").toString(), QString("LoggingSourceStates")); - QCOMPARE(loggEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("value").toInt(), 42); + QCOMPARE(logEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("source").toString(), QString("LoggingSourceStates")); + QCOMPARE(logEntryAddedVariant.toMap().value("params").toMap().value("logEntry").toMap().value("value").toInt(), 42); break; } } @@ -937,91 +924,6 @@ void TestJSONRPC::ruleActiveChangedNotifications() QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid().toString(), ruleId.toString()); } -void TestJSONRPC::deviceChangedNotifications() -{ - // enable notificartions - QVariantMap params; - params.insert("enabled", true); - QVariant response = injectAndWait("JSONRPC.SetNotificationStatus", params); - QCOMPARE(response.toMap().value("params").toMap().value("enabled").toBool(), true); - - // Setup connection to mock client - QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); - - // ADD - // add device and wait for notification - QVariantList deviceParams; - QVariantMap httpportParam; - httpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); - httpportParam.insert("value", 23234); - deviceParams.append(httpportParam); - - params.clear(); response.clear(); clientSpy.clear(); - params.insert("deviceClassId", mockThingClassId); - params.insert("name", "Mock"); - params.insert("deviceParams", deviceParams); - response = injectAndWait("Devices.AddConfiguredDevice", params); - ThingId deviceId = ThingId(response.toMap().value("params").toMap().value("deviceId").toString()); - QVERIFY(!deviceId.isNull()); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - QVariantMap notificationDeviceMap = checkNotification(clientSpy, "Devices.DeviceAdded").toMap().value("params").toMap().value("device").toMap(); - - QCOMPARE(notificationDeviceMap.value("deviceClassId").toString(), mockThingClassId.toString()); - QCOMPARE(notificationDeviceMap.value("id").toString(), deviceId.toString()); - foreach (const QVariant ¶m, notificationDeviceMap.value("params").toList()) { - if (param.toMap().value("name").toString() == "httpport") { - QCOMPARE(param.toMap().value("value").toInt(), httpportParam.value("value").toInt()); - } - } - - // RECONFIGURE - // now reconfigure the device and check the deviceChanged notification - QVariantList newDeviceParams; - QVariantMap newHttpportParam; - newHttpportParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); - newHttpportParam.insert("value", 45473); - newDeviceParams.append(newHttpportParam); - - params.clear(); response.clear(); clientSpy.clear(); - params.insert("deviceId", deviceId); - params.insert("deviceParams", newDeviceParams); - response = injectAndWait("Devices.ReconfigureDevice", params); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - QVariantMap reconfigureDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceChanged").toMap().value("params").toMap().value("device").toMap(); - QCOMPARE(reconfigureDeviceNotificationMap.value("deviceClassId").toString(), mockThingClassId.toString()); - QCOMPARE(reconfigureDeviceNotificationMap.value("id").toString(), deviceId.toString()); - foreach (const QVariant ¶m, reconfigureDeviceNotificationMap.value("params").toList()) { - if (param.toMap().value("name").toString() == "httpport") { - QCOMPARE(param.toMap().value("value").toInt(), newHttpportParam.value("value").toInt()); - } - } - - // EDIT device name - QString deviceName = "Test device 1234"; - params.clear(); response.clear(); clientSpy.clear(); - params.insert("deviceId", deviceId); - params.insert("name", deviceName); - response = injectAndWait("Devices.EditDevice", params); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - QVariantMap editDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceChanged").toMap().value("params").toMap().value("device").toMap(); - QCOMPARE(editDeviceNotificationMap.value("deviceClassId").toString(), mockThingClassId.toString()); - QCOMPARE(editDeviceNotificationMap.value("id").toString(), deviceId.toString()); - QCOMPARE(editDeviceNotificationMap.value("name").toString(), deviceName); - - // REMOVE - // now remove the device and check the device removed notification - params.clear(); response.clear(); clientSpy.clear(); - params.insert("deviceId", deviceId); - response = injectAndWait("Devices.RemoveConfiguredDevice", params); - if (clientSpy.count() == 0) clientSpy.wait(); - verifyDeviceError(response); - checkNotification(clientSpy, "Devices.DeviceRemoved"); - checkNotification(clientSpy, "Logging.LogDatabaseUpdated"); -} - void TestJSONRPC::stateChangeEmitsNotifications() { enableNotifications({"Devices", "States", "Logging", "Events"}); @@ -1034,7 +936,7 @@ void TestJSONRPC::stateChangeEmitsNotifications() // trigger state change in mock device int newVal = 38; QUuid stateTypeId("80baec19-54de-4948-ac46-31eabfaceb83"); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(stateTypeId.toString()).arg(QString::number(newVal)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(stateTypeId.toString()).arg(QString::number(newVal)))); QNetworkReply *reply = nam.get(request); connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); QSignalSpy replySpy(reply, SIGNAL(finished())); @@ -1098,7 +1000,7 @@ void TestJSONRPC::stateChangeEmitsNotifications() // Fire the a statechange once again clientSpy.clear(); newVal = 42; - request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(stateTypeId.toString()).arg(newVal))); + request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(stateTypeId.toString()).arg(newVal))); reply = nam.get(request); connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); @@ -1129,7 +1031,7 @@ void TestJSONRPC::pluginConfigChangeEmitsNotification() params.insert("pluginId", mockPluginId); QVariantList pluginParams; QVariantMap param1; - param1.insert("paramTypeId", mockDevicePluginConfigParamIntParamTypeId); + param1.insert("paramTypeId", mockPluginConfigParamIntParamTypeId); param1.insert("value", 42); pluginParams.append(param1); params.insert("configuration", pluginParams); diff --git a/tests/auto/logging/testlogging.cpp b/tests/auto/logging/testlogging.cpp index ed9ac79a..b7b562e0 100644 --- a/tests/auto/logging/testlogging.cpp +++ b/tests/auto/logging/testlogging.cpp @@ -47,13 +47,12 @@ private: inline void verifyLoggingError(const QVariant &response, Logging::LoggingError error = Logging::LoggingErrorNoError) { verifyError(response, "loggingError", enumValueName(error)); } - inline void verifyDeviceError(const QVariant &response, Thing::ThingError error = Thing::ThingErrorNoError) { - verifyError(response, "deviceError", enumValueName(error)); + inline void verifyThingError(const QVariant &response, Thing::ThingError error = Thing::ThingErrorNoError) { + verifyError(response, "thingError", enumValueName(error)); } - inline void waitForDBSync() { - while (NymeaCore::instance()->logEngine()->jobsRunning()) { - qApp->processEvents(); - } + // DEPRECTATED + inline void verifyDeviceError(const QVariant &response, Thing::ThingError error = Thing::ThingErrorNoError) { + verifyError(response, "deviceError", enumValueName(error).replace("Thing", "Device")); } private slots: @@ -277,7 +276,7 @@ void TestLogging::eventLogs() QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); // trigger event in mock device - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); @@ -343,7 +342,7 @@ void TestLogging::actionLog() QVariantMap params; params.insert("actionTypeId", mockWithParamsActionTypeId); - params.insert("deviceId", m_mockThingId); + params.insert("thingId", m_mockThingId); params.insert("params", actionParams); enableNotifications({"Logging"}); @@ -351,8 +350,8 @@ void TestLogging::actionLog() QSignalSpy clientSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); // EXECUTE with params - QVariant response = injectAndWait("Actions.ExecuteAction", params); - verifyDeviceError(response); + QVariant response = injectAndWait("Integrations.ExecuteAction", params); + verifyThingError(response); // wait for the outgoing data // 3 packets: ExecuteAction reply, LogDatabaseUpdated signal and LogEntryAdded signal @@ -484,7 +483,7 @@ void TestLogging::actionLog() void TestLogging::deviceLogs() { QVariantMap params; - params.insert("deviceClassId", mockParentThingClassId); + params.insert("deviceClassId", parentMockThingClassId); params.insert("name", "Parent device"); QVariant response = injectAndWait("Devices.AddConfiguredDevice", params); @@ -526,12 +525,12 @@ void TestLogging::testDoubleValues() // Discover device QVariantList discoveryParams; QVariantMap resultCountParam; - resultCountParam.insert("paramTypeId", mockDisplayPinDiscoveryResultCountParamTypeId); + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); resultCountParam.insert("value", 1); discoveryParams.append(resultCountParam); QVariantMap params; - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("discoveryParams", discoveryParams); QVariant response = injectAndWait("Devices.GetDiscoveredDevices", params); @@ -540,7 +539,7 @@ void TestLogging::testDoubleValues() // Pair device ThingDescriptorId descriptorId = ThingDescriptorId(response.toMap().value("params").toMap().value("deviceDescriptors").toList().first().toMap().value("id").toString()); params.clear(); - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("name", "Display pin mock device"); params.insert("deviceDescriptorId", descriptorId.toString()); response = injectAndWait("Devices.PairDevice", params); @@ -566,12 +565,12 @@ void TestLogging::testDoubleValues() // Set the double state value and sniff for LogEntryAdded notification double value = 23.80; QVariantMap actionParam; - actionParam.insert("paramTypeId", mockDisplayPinDoubleActionDoubleParamTypeId.toString()); + actionParam.insert("paramTypeId", displayPinMockDoubleActionDoubleParamTypeId.toString()); actionParam.insert("value", value); params.clear(); response.clear(); params.insert("deviceId", deviceId); - params.insert("actionTypeId", mockDisplayPinDoubleActionTypeId.toString()); + params.insert("actionTypeId", displayPinMockDoubleActionTypeId.toString()); params.insert("params", QVariantList() << actionParam); response = injectAndWait("Actions.ExecuteAction", params); @@ -584,8 +583,8 @@ void TestLogging::testDoubleValues() foreach (const QVariant &logNotificationVariant, logNotificationsList) { QVariantMap logNotification = logNotificationVariant.toMap().value("params").toMap().value("logEntry").toMap(); - if (logNotification.value("typeId").toString() == mockDisplayPinDoubleActionDoubleParamTypeId.toString()) { - if (logNotification.value("typeId").toString() == mockDisplayPinDoubleActionDoubleParamTypeId.toString()) { + if (logNotification.value("typeId").toString() == displayPinMockDoubleActionDoubleParamTypeId.toString()) { + if (logNotification.value("typeId").toString() == displayPinMockDoubleActionDoubleParamTypeId.toString()) { // If state source if (logNotification.value("source").toString() == enumValueName(Logging::LoggingSourceStates)) { @@ -619,7 +618,7 @@ void TestLogging::testHouseKeeping() params.insert("name", "TestDeviceToBeRemoved"); QVariantList deviceParams; QVariantMap httpParam; - httpParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpParam.insert("value", 6667); deviceParams.append(httpParam); params.insert("deviceParams", deviceParams); diff --git a/tests/auto/rules/testrules.cpp b/tests/auto/rules/testrules.cpp index fc225093..8906be9c 100644 --- a/tests/auto/rules/testrules.cpp +++ b/tests/auto/rules/testrules.cpp @@ -141,7 +141,7 @@ private slots: void TestRules::cleanupMockHistory() { QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/clearactionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/clearactionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -162,12 +162,12 @@ ThingId TestRules::addDisplayPinDevice() // Discover device QVariantList discoveryParams; QVariantMap resultCountParam; - resultCountParam.insert("paramTypeId", mockDisplayPinDiscoveryResultCountParamTypeId); + resultCountParam.insert("paramTypeId", displayPinMockDiscoveryResultCountParamTypeId); resultCountParam.insert("value", 1); discoveryParams.append(resultCountParam); QVariantMap params; - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("discoveryParams", discoveryParams); QVariant response = injectAndWait("Devices.GetDiscoveredDevices", params); @@ -176,7 +176,7 @@ ThingId TestRules::addDisplayPinDevice() // Pair device ThingDescriptorId descriptorId = ThingDescriptorId(response.toMap().value("params").toMap().value("deviceDescriptors").toList().first().toMap().value("id").toString()); params.clear(); - params.insert("deviceClassId", mockDisplayPinThingClassId); + params.insert("deviceClassId", displayPinMockThingClassId); params.insert("name", "Display pin mock device"); params.insert("deviceDescriptorId", descriptorId.toString()); response = injectAndWait("Devices.PairDevice", params); @@ -285,7 +285,7 @@ void TestRules::verifyRuleExecuted(const ActionTypeId &actionTypeId) while (!actionFound && i < 50) { QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -305,7 +305,7 @@ void TestRules::verifyRuleNotExecuted() { QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -394,7 +394,7 @@ void TestRules::generateEvent(const EventTypeId &eventTypeId) QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // trigger event in mock device - QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(eventTypeId.toString()))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(eventTypeId.toString()))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1588,7 +1588,7 @@ void TestRules::evaluateEvent() QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // trigger event in mock device - QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1602,7 +1602,7 @@ void TestRules::evaluateEventParams() // Init bool state to true QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg("true"))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg("true"))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1641,7 +1641,7 @@ void TestRules::evaluateEventParams() // Trigger a non matching param spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg("false"))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg("false"))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1651,7 +1651,7 @@ void TestRules::evaluateEventParams() // Trigger a matching param spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg("true"))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg("true"))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1661,7 +1661,7 @@ void TestRules::evaluateEventParams() // Reset back to false to not mess with other tests spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg("false"))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg("false"))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1698,7 +1698,7 @@ void TestRules::testStateChange() { // state state to 42 qDebug() << "setting mock int state to 42"; - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(42))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(42))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1711,7 +1711,7 @@ void TestRules::testStateChange() { // set state to 45 qDebug() << "setting mock int state to 45"; spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(45))); + request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(45))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1724,7 +1724,7 @@ void TestRules::testStateChange() { // set state to 30 qDebug() << "setting mock int state to 30"; spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(30))); + request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(30))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1737,7 +1737,7 @@ void TestRules::testStateChange() { // set state to 100 qDebug() << "setting mock int state to 100"; spy.clear(); - request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(100))); + request.setUrl(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(100))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -1903,25 +1903,25 @@ void TestRules::testChildEvaluator_data() QVariantMap stateDescriptorPercentage; stateDescriptorPercentage.insert("deviceId", testDeviceId); stateDescriptorPercentage.insert("operator", enumValueName(Types::ValueOperatorGreaterOrEqual)); - stateDescriptorPercentage.insert("stateTypeId", mockDisplayPinPercentageStateTypeId); + stateDescriptorPercentage.insert("stateTypeId", displayPinMockPercentageStateTypeId); stateDescriptorPercentage.insert("value", 50); QVariantMap stateDescriptorDouble; stateDescriptorDouble.insert("deviceId", testDeviceId); stateDescriptorDouble.insert("operator", enumValueName(Types::ValueOperatorEquals)); - stateDescriptorDouble.insert("stateTypeId", mockDisplayPinDoubleActionDoubleParamTypeId); + stateDescriptorDouble.insert("stateTypeId", displayPinMockDoubleActionDoubleParamTypeId); stateDescriptorDouble.insert("value", 20.5); QVariantMap stateDescriptorAllowedValues; stateDescriptorAllowedValues.insert("deviceId", testDeviceId); stateDescriptorAllowedValues.insert("operator", enumValueName(Types::ValueOperatorEquals)); - stateDescriptorAllowedValues.insert("stateTypeId", mockDisplayPinAllowedValuesStateTypeId); + stateDescriptorAllowedValues.insert("stateTypeId", displayPinMockAllowedValuesStateTypeId); stateDescriptorAllowedValues.insert("value", "String value 2"); QVariantMap stateDescriptorColor; stateDescriptorColor.insert("deviceId", testDeviceId); stateDescriptorColor.insert("operator", enumValueName(Types::ValueOperatorEquals)); - stateDescriptorColor.insert("stateTypeId", mockDisplayPinColorStateTypeId); + stateDescriptorColor.insert("stateTypeId", displayPinMockColorStateTypeId); stateDescriptorColor.insert("value", "#00FF00"); QVariantMap firstStateEvaluator; @@ -1976,10 +1976,10 @@ void TestRules::testChildEvaluator() QFETCH(bool, active); // Init the states - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinPercentageStateTypeId.toString()), QVariant(0)); - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinDoubleActionDoubleParamTypeId.toString()), QVariant(0)); - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinAllowedValuesStateTypeId.toString()), QVariant("String value 1")); - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinColorStateTypeId.toString()), QVariant("#000000")); + setWritableStateValue(deviceId, StateTypeId(displayPinMockPercentageStateTypeId.toString()), QVariant(0)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockDoubleActionDoubleParamTypeId.toString()), QVariant(0)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockAllowedValuesStateTypeId.toString()), QVariant("String value 1")); + setWritableStateValue(deviceId, StateTypeId(displayPinMockColorStateTypeId.toString()), QVariant("#000000")); qCDebug(dcTests()) << "Adding rule"; @@ -1991,13 +1991,13 @@ void TestRules::testChildEvaluator() // Set the states qCDebug(dcTests()) << "Setting state 1"; - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinPercentageStateTypeId.toString()), QVariant::fromValue(percentageValue)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockPercentageStateTypeId.toString()), QVariant::fromValue(percentageValue)); qCDebug(dcTests()) << "Setting state 2"; - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinDoubleActionDoubleParamTypeId.toString()), QVariant::fromValue(doubleValue)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockDoubleActionDoubleParamTypeId.toString()), QVariant::fromValue(doubleValue)); qCDebug(dcTests()) << "Setting state 3"; - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinAllowedValuesStateTypeId.toString()), QVariant::fromValue(allowedValue)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockAllowedValuesStateTypeId.toString()), QVariant::fromValue(allowedValue)); qCDebug(dcTests()) << "Setting state 4"; - setWritableStateValue(deviceId, StateTypeId(mockDisplayPinColorStateTypeId.toString()), QVariant::fromValue(colorValue)); + setWritableStateValue(deviceId, StateTypeId(displayPinMockColorStateTypeId.toString()), QVariant::fromValue(colorValue)); // Verfiy if the rule executed successfully // Actions @@ -2055,7 +2055,7 @@ void TestRules::enableDisableRule() QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // trigger event in mock device - QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2079,7 +2079,7 @@ void TestRules::enableDisableRule() // trigger event in mock device spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2103,7 +2103,7 @@ void TestRules::enableDisableRule() // trigger event in mock device spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2152,7 +2152,7 @@ void TestRules::testEventBasedAction() // state state to 42 qDebug() << "setting mock int state to 42"; - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(42))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(42))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2169,7 +2169,7 @@ void TestRules::testEventBasedRuleWithExitAction() // Init bool state to true spy.clear(); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg(true))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg(true))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2224,7 +2224,7 @@ void TestRules::testEventBasedRuleWithExitAction() // trigger event spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2235,7 +2235,7 @@ void TestRules::testEventBasedRuleWithExitAction() // set bool state to false spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg(false))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg(false))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2243,7 +2243,7 @@ void TestRules::testEventBasedRuleWithExitAction() // trigger event spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2261,7 +2261,7 @@ void TestRules::testStateBasedAction() // Init bool state to true spy.clear(); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg(true))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg(true))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2269,7 +2269,7 @@ void TestRules::testStateBasedAction() // Init int state to 11 spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(11))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(11))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2312,7 +2312,7 @@ void TestRules::testStateBasedAction() // trigger event spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2330,7 +2330,7 @@ void TestRules::testStateBasedAction() // set bool state to false spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg(false))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg(false))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2338,7 +2338,7 @@ void TestRules::testStateBasedAction() // trigger event spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2356,7 +2356,7 @@ void TestRules::removePolicyUpdate() { // ADD parent device QVariantMap params; - params.insert("deviceClassId", mockParentThingClassId); + params.insert("deviceClassId", parentMockThingClassId); params.insert("name", "Parent device"); QSignalSpy addedSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); @@ -2378,7 +2378,7 @@ void TestRules::removePolicyUpdate() foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { + if (deviceMap.value("deviceClassId").toString() == childMockThingClassId.toString()) { if (deviceMap.value("parentId") == parentId.toString()) { //qDebug() << QJsonDocument::fromVariant(deviceVariant).toJson(); childId = ThingId(deviceMap.value("id").toString()); @@ -2389,8 +2389,8 @@ void TestRules::removePolicyUpdate() // Add rule with child device QVariantList eventDescriptors; - eventDescriptors.append(createEventDescriptor(childId, mockChildBoolValueEventTypeId)); - eventDescriptors.append(createEventDescriptor(parentId, mockParentBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(childId, childMockBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(parentId, parentMockBoolValueEventTypeId)); eventDescriptors.append(createEventDescriptor(m_mockThingId, mockEvent1EventTypeId)); params.clear(); response.clear(); @@ -2443,7 +2443,7 @@ void TestRules::removePolicyCascade() { // ADD parent device QVariantMap params; - params.insert("deviceClassId", mockParentThingClassId); + params.insert("deviceClassId", parentMockThingClassId); params.insert("name", "Parent device"); QSignalSpy addedSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); @@ -2465,7 +2465,7 @@ void TestRules::removePolicyCascade() foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { + if (deviceMap.value("deviceClassId").toString() == childMockThingClassId.toString()) { if (deviceMap.value("parentId") == parentId.toString()) { //qDebug() << QJsonDocument::fromVariant(deviceVariant).toJson(); childId = ThingId(deviceMap.value("id").toString()); @@ -2476,8 +2476,8 @@ void TestRules::removePolicyCascade() // Add rule with child device QVariantList eventDescriptors; - eventDescriptors.append(createEventDescriptor(childId, mockChildBoolValueEventTypeId)); - eventDescriptors.append(createEventDescriptor(parentId, mockParentBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(childId, childMockBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(parentId, parentMockBoolValueEventTypeId)); eventDescriptors.append(createEventDescriptor(m_mockThingId, mockEvent1EventTypeId)); params.clear(); response.clear(); @@ -2520,7 +2520,7 @@ void TestRules::removePolicyUpdateRendersUselessRule() { // ADD parent device QVariantMap params; - params.insert("deviceClassId", mockParentThingClassId); + params.insert("deviceClassId", parentMockThingClassId); params.insert("name", "Parent device"); QSignalSpy addedSpy(NymeaCore::instance()->thingManager(), &ThingManager::thingAdded); @@ -2543,7 +2543,7 @@ void TestRules::removePolicyUpdateRendersUselessRule() foreach (const QVariant deviceVariant, devices) { QVariantMap deviceMap = deviceVariant.toMap(); - if (deviceMap.value("deviceClassId").toString() == mockChildThingClassId.toString()) { + if (deviceMap.value("deviceClassId").toString() == childMockThingClassId.toString()) { if (deviceMap.value("parentId") == parentId.toString()) { //qDebug() << QJsonDocument::fromVariant(deviceVariant).toJson(); childId = ThingId(deviceMap.value("id").toString()); @@ -2554,8 +2554,8 @@ void TestRules::removePolicyUpdateRendersUselessRule() // Add rule with child device QVariantList eventDescriptors; - eventDescriptors.append(createEventDescriptor(childId, mockChildBoolValueEventTypeId)); - eventDescriptors.append(createEventDescriptor(parentId, mockParentBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(childId, childMockBoolValueEventTypeId)); + eventDescriptors.append(createEventDescriptor(parentId, parentMockBoolValueEventTypeId)); eventDescriptors.append(createEventDescriptor(m_mockThingId, mockEvent1EventTypeId)); params.clear(); response.clear(); @@ -2564,9 +2564,9 @@ void TestRules::removePolicyUpdateRendersUselessRule() QVariantMap action; action.insert("deviceId", childId); - action.insert("actionTypeId", mockChildBoolValueActionTypeId); + action.insert("actionTypeId", childMockBoolValueActionTypeId); QVariantMap ruleActionParam; - ruleActionParam.insert("paramTypeId", mockChildBoolValueActionBoolValueParamTypeId); + ruleActionParam.insert("paramTypeId", childMockBoolValueActionBoolValueParamTypeId); ruleActionParam.insert("value", true); action.insert("ruleActionParams", QVariantList() << ruleActionParam); params.insert("actions", QVariantList() << action); @@ -2826,7 +2826,7 @@ void TestRules::testInterfaceBasedEventRule() QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // state battery critical state to false initially - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2882,13 +2882,13 @@ void TestRules::testInterfaceBasedEventRule() // Change the state to true, action should trigger spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockDevice1Port))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockThing1Port))); reply = nam.get(request); qDebug(dcTests) << "Changing battery state -> true"; spy.wait(); spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2900,13 +2900,13 @@ void TestRules::testInterfaceBasedEventRule() // Change the state to false, action should not trigger spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockDevice1Port))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/clearactionhistory").arg(m_mockThing1Port))); reply = nam.get(request); qDebug(dcTests) << "Changing battery state -> false"; spy.wait(); spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2920,7 +2920,7 @@ void TestRules::testInterfaceBasedStateRule() QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // state battery critical state to false initially - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2974,7 +2974,7 @@ void TestRules::testInterfaceBasedStateRule() // Change the state spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -3070,7 +3070,7 @@ void TestRules::testScene() QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); // state power state to false initially - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockPowerStateTypeId.toString()).arg(false))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockPowerStateTypeId.toString()).arg(false))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -3078,7 +3078,7 @@ void TestRules::testScene() // state battery critical state to false initially spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(false))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -3105,7 +3105,7 @@ void TestRules::testScene() // trigger state change on battery critical spy.clear(); - request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); + request = QNetworkRequest(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBatteryCriticalStateTypeId.toString()).arg(true))); reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -3144,7 +3144,7 @@ void TestRules::testHousekeeping() params.insert("name", "TestDeviceToBeRemoved"); QVariantList deviceParams; QVariantMap httpParam; - httpParam.insert("paramTypeId", mockDeviceHttpportParamTypeId); + httpParam.insert("paramTypeId", mockThingHttpportParamTypeId); httpParam.insert("value", 6667); deviceParams.append(httpParam); params.insert("deviceParams", deviceParams); diff --git a/tests/auto/states/teststates.cpp b/tests/auto/states/teststates.cpp index 64f063b3..e92907c5 100644 --- a/tests/auto/states/teststates.cpp +++ b/tests/auto/states/teststates.cpp @@ -94,7 +94,7 @@ void TestStates::save_load_states() QVERIFY2(!mockDeviceClass.getStateType(mockBoolStateTypeId).cached(), "Mock bool state is cached (required to be false for this test)"); Thing* device = NymeaCore::instance()->thingManager()->findConfiguredThings(mockThingClassId).first(); - int port = device->paramValue(mockDeviceHttpportParamTypeId).toInt(); + int port = device->paramValue(mockThingHttpportParamTypeId).toInt(); QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); diff --git a/tests/auto/timemanager/testtimemanager.cpp b/tests/auto/timemanager/testtimemanager.cpp index e4dad859..ba522db1 100644 --- a/tests/auto/timemanager/testtimemanager.cpp +++ b/tests/auto/timemanager/testtimemanager.cpp @@ -2038,7 +2038,7 @@ void TestTimeManager::verifyRuleExecuted(const ActionTypeId &actionTypeId) // Verify rule got executed QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2052,7 +2052,7 @@ void TestTimeManager::verifyRuleNotExecuted() { QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/actionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2065,7 +2065,7 @@ void TestTimeManager::verifyRuleNotExecuted() void TestTimeManager::cleanupMockHistory() { QNetworkAccessManager nam; QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/clearactionhistory").arg(QString::number(m_mockDevice1Port)))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/clearactionhistory").arg(QString::number(m_mockThing1Port)))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2103,7 +2103,7 @@ void TestTimeManager::setIntState(const int &value) QSignalSpy stateSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); spy.clear(); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockIntStateTypeId.toString()).arg(value))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockIntStateTypeId.toString()).arg(value))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2143,7 +2143,7 @@ void TestTimeManager::setBoolState(const bool &value) QSignalSpy spy(&nam, SIGNAL(finished(QNetworkReply*))); QSignalSpy stateSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockDevice1Port).arg(mockBoolStateTypeId.toString()).arg(value))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/setstate?%2=%3").arg(m_mockThing1Port).arg(mockBoolStateTypeId.toString()).arg(value))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); @@ -2174,7 +2174,7 @@ void TestTimeManager::triggerMockEvent1() QSignalSpy eventSpy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); - QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1EventTypeId.toString()))); + QNetworkRequest request(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockThing1Port).arg(mockEvent1EventTypeId.toString()))); QNetworkReply *reply = nam.get(request); spy.wait(); QCOMPARE(spy.count(), 1); diff --git a/tests/testlib/nymeatestbase.cpp b/tests/testlib/nymeatestbase.cpp index 7bef2789..392a457e 100644 --- a/tests/testlib/nymeatestbase.cpp +++ b/tests/testlib/nymeatestbase.cpp @@ -46,8 +46,8 @@ NymeaTestBase::NymeaTestBase(QObject *parent) : { qRegisterMetaType(); qsrand(QDateTime::currentMSecsSinceEpoch()); - m_mockDevice1Port = 1337 + (qrand() % 10000); - m_mockDevice2Port = 7331 + (qrand() % 10000); + m_mockThing1Port = 1337 + (qrand() % 10000); + m_mockThing2Port = 7331 + (qrand() % 10000); // Important for settings QCoreApplication::instance()->setOrganizationName("nymea-test"); @@ -105,7 +105,7 @@ void NymeaTestBase::initTestCase() response = injectAndWait("Devices.GetConfiguredDevices", {}); foreach (const QVariant &device, response.toMap().value("params").toMap().value("devices").toList()) { - if (device.toMap().value("deviceClassId").toUuid() == mockDeviceAutoThingClassId) { + if (device.toMap().value("deviceClassId").toUuid() == autoMockThingClassId) { m_mockThingAutoId = ThingId(device.toMap().value("id").toString()); } } @@ -404,6 +404,13 @@ bool NymeaTestBase::disableNotifications() return true; } +void NymeaTestBase::waitForDBSync() +{ + while (NymeaCore::instance()->logEngine()->jobsRunning()) { + qApp->processEvents(); + } +} + void NymeaTestBase::restartServer() { // Destroy and recreate the core instance... @@ -430,8 +437,8 @@ void NymeaTestBase::createMockDevice() QVariantList deviceParams; QVariantMap httpPortParam; - httpPortParam.insert("paramTypeId", mockDeviceHttpportParamTypeId.toString()); - httpPortParam.insert("value", m_mockDevice1Port); + httpPortParam.insert("paramTypeId", mockThingHttpportParamTypeId.toString()); + httpPortParam.insert("value", m_mockThing1Port); deviceParams.append(httpPortParam); params.insert("deviceParams", deviceParams); diff --git a/tests/testlib/nymeatestbase.h b/tests/testlib/nymeatestbase.h index 255d19e4..2b3e64a6 100644 --- a/tests/testlib/nymeatestbase.h +++ b/tests/testlib/nymeatestbase.h @@ -121,6 +121,7 @@ protected: qDebug() << jsonDoc.toJson(); } + void waitForDBSync(); void restartServer(); void clearLoggingDatabase(); @@ -129,14 +130,14 @@ private: protected: PluginId mockPluginId = PluginId("727a4a9a-c187-446f-aadf-f1b2220607d1"); - VendorId guhVendorId = VendorId("2062d64d-3232-433c-88bc-0d33c0ba2ba6"); + VendorId nymeaVendorId = VendorId("2062d64d-3232-433c-88bc-0d33c0ba2ba6"); MockTcpServer *m_mockTcpServer; QUuid m_clientId; int m_commandId; - int m_mockDevice1Port; - int m_mockDevice2Port; + int m_mockThing1Port; + int m_mockThing2Port; ThingId m_mockThingId; ThingId m_mockThingAutoId; diff --git a/tools/nymea-plugininfocompiler/plugininfocompiler.cpp b/tools/nymea-plugininfocompiler/plugininfocompiler.cpp index 6721549d..fecc0025 100644 --- a/tools/nymea-plugininfocompiler/plugininfocompiler.cpp +++ b/tools/nymea-plugininfocompiler/plugininfocompiler.cpp @@ -244,7 +244,7 @@ void PluginInfoCompiler::writeParams(const ParamTypes ¶mTypes, const QString m_variableNames.append(variableName); write(QString("ParamTypeId %1 = ParamTypeId(\"%2\");").arg(variableName).arg(paramType.id().toString())); - m_translationStrings.insert(paramType.displayName(), QString("The name of the ParamType (DeviceClass: %1, %2Type: %3, ID: %4)").arg(thingClassName).arg(typeClass).arg(typeName).arg(paramType.id().toString())); + m_translationStrings.insert(paramType.displayName(), QString("The name of the ParamType (ThingClass: %1, %2Type: %3, ID: %4)").arg(thingClassName).arg(typeClass).arg(typeName).arg(paramType.id().toString())); writeExtern(QString("extern ParamTypeId %1;").arg(variableName)); } } @@ -276,7 +276,7 @@ void PluginInfoCompiler::writeThingClass(const ThingClass &thingClass) m_translationStrings.insert(thingClass.displayName(), QString("The name of the ThingClass (%1)").arg(thingClass.id().toString())); writeExtern(QString("extern ThingClassId %1;").arg(variableName)); - writeParams(thingClass.paramTypes(), thingClass.name(), "", "device"); + writeParams(thingClass.paramTypes(), thingClass.name(), "", "thing"); writeParams(thingClass.settingsTypes(), thingClass.name(), "", "settings"); writeParams(thingClass.discoveryParamTypes(), thingClass.name(), "", "discovery"); @@ -291,12 +291,12 @@ void PluginInfoCompiler::writeStateTypes(const StateTypes &stateTypes, const QSt foreach (const StateType &stateType, stateTypes) { QString variableName = QString("%1%2StateTypeId").arg(thingClassName, stateType.name()[0].toUpper() + stateType.name().right(stateType.name().length() - 1)); if (m_variableNames.contains(variableName)) { - qWarning().nospace() << "Error: Duplicate name " << variableName << " for StateType " << stateType.name() << " in DeviceClass " << thingClassName << ". Skipping entry."; + qWarning().nospace() << "Error: Duplicate name " << variableName << " for StateType " << stateType.name() << " in ThingClass " << thingClassName << ". Skipping entry."; return; } m_variableNames.append(variableName); write(QString("StateTypeId %1 = StateTypeId(\"%2\");").arg(variableName).arg(stateType.id().toString())); - m_translationStrings.insert(stateType.displayName(), QString("The name of the StateType (%1) of DeviceClass %2").arg(stateType.id().toString()).arg(thingClassName)); + m_translationStrings.insert(stateType.displayName(), QString("The name of the StateType (%1) of ThingClass %2").arg(stateType.id().toString()).arg(thingClassName)); writeExtern(QString("extern StateTypeId %1;").arg(variableName)); } } @@ -306,12 +306,12 @@ void PluginInfoCompiler::writeEventTypes(const EventTypes &eventTypes, const QSt foreach (const EventType &eventType, eventTypes) { QString variableName = QString("%1%2EventTypeId").arg(thingClassName, eventType.name()[0].toUpper() + eventType.name().right(eventType.name().length() - 1)); if (m_variableNames.contains(variableName)) { - qWarning().nospace() << "Error: Duplicate name " << variableName << " for EventType " << eventType.name() << " in DeviceClass " << thingClassName << ". Skipping entry."; + qWarning().nospace() << "Error: Duplicate name " << variableName << " for EventType " << eventType.name() << " in ThingClass " << thingClassName << ". Skipping entry."; return; } m_variableNames.append(variableName); write(QString("EventTypeId %1 = EventTypeId(\"%2\");").arg(variableName).arg(eventType.id().toString())); - m_translationStrings.insert(eventType.displayName(), QString("The name of the EventType (%1) of DeviceClass %2").arg(eventType.id().toString()).arg(thingClassName)); + m_translationStrings.insert(eventType.displayName(), QString("The name of the EventType (%1) of ThingClass %2").arg(eventType.id().toString()).arg(thingClassName)); writeExtern(QString("extern EventTypeId %1;").arg(variableName)); writeParams(eventType.paramTypes(), thingClassName, "Event", eventType.name()); @@ -323,12 +323,12 @@ void PluginInfoCompiler::writeActionTypes(const ActionTypes &actionTypes, const foreach (const ActionType &actionType, actionTypes) { QString variableName = QString("%1%2ActionTypeId").arg(thingClassName, actionType.name()[0].toUpper() + actionType.name().right(actionType.name().length() - 1)); if (m_variableNames.contains(variableName)) { - qWarning().nospace() << "Error: Duplicate name " << variableName << " for ActionType " << actionType.name() << " in DeviceClass " << thingClassName << ". Skipping entry."; + qWarning().nospace() << "Error: Duplicate name " << variableName << " for ActionType " << actionType.name() << " in ThingClass " << thingClassName << ". Skipping entry."; return; } m_variableNames.append(variableName); write(QString("ActionTypeId %1 = ActionTypeId(\"%2\");").arg(variableName).arg(actionType.id().toString())); - m_translationStrings.insert(actionType.displayName(), QString("The name of the ActionType (%1) of DeviceClass %2").arg(actionType.id().toString()).arg(thingClassName)); + m_translationStrings.insert(actionType.displayName(), QString("The name of the ActionType (%1) of ThingClass %2").arg(actionType.id().toString()).arg(thingClassName)); writeExtern(QString("extern ActionTypeId %1;").arg(variableName)); writeParams(actionType.paramTypes(), thingClassName, "Action", actionType.name()); @@ -340,12 +340,12 @@ void PluginInfoCompiler::writeBrowserItemActionTypes(const ActionTypes &actionTy foreach (const ActionType &actionType, actionTypes) { QString variableName = QString("%1%2BrowserItemActionTypeId").arg(thingClassName, actionType.name()[0].toUpper() + actionType.name().right(actionType.name().length() - 1)); if (m_variableNames.contains(variableName)) { - qWarning().nospace() << "Error: Duplicate name " << variableName << " for Browser Item ActionType " << actionType.name() << " in DeviceClass " << thingClassName << ". Skipping entry."; + qWarning().nospace() << "Error: Duplicate name " << variableName << " for Browser Item ActionType " << actionType.name() << " in ThingClass " << thingClassName << ". Skipping entry."; return; } m_variableNames.append(variableName); write(QString("ActionTypeId %1 = ActionTypeId(\"%2\");").arg(variableName).arg(actionType.id().toString())); - m_translationStrings.insert(actionType.displayName(), QString("The name of the Browser Item ActionType (%1) of DeviceClass %2").arg(actionType.id().toString()).arg(thingClassName)); + m_translationStrings.insert(actionType.displayName(), QString("The name of the Browser Item ActionType (%1) of ThingClass %2").arg(actionType.id().toString()).arg(thingClassName)); writeExtern(QString("extern ActionTypeId %1;").arg(variableName)); writeParams(actionType.paramTypes(), thingClassName, "BrowserItemAction", actionType.name());