diff --git a/libnymea-core/cloud/cloudnotifications.cpp b/libnymea-core/cloud/cloudnotifications.cpp index c51c5338..a25e4ffa 100644 --- a/libnymea-core/cloud/cloudnotifications.cpp +++ b/libnymea-core/cloud/cloudnotifications.cpp @@ -46,7 +46,7 @@ QJsonObject CloudNotifications::metaData() const { QVariantMap pluginMetaData; pluginMetaData.insert("id", "ccc6dbc8-e352-48a1-8e87-3c89a4669fc2"); - pluginMetaData.insert("name", "cloudNotifications"); + pluginMetaData.insert("name", "CloudNotifications"); pluginMetaData.insert("displayName", tr("Cloud Notifications")); QVariantList interfaces; @@ -131,6 +131,10 @@ QJsonObject CloudNotifications::metaData() const QVariantList vendors; vendors.append(guhVendor); pluginMetaData.insert("vendors", vendors); + + // Mark this plugin as built-in + pluginMetaData.insert("builtIn", true); + return QJsonObject::fromVariantMap(pluginMetaData); } diff --git a/libnymea-core/jsonrpc/actionhandler.cpp b/libnymea-core/jsonrpc/actionhandler.cpp index 4a787aeb..d0616441 100644 --- a/libnymea-core/jsonrpc/actionhandler.cpp +++ b/libnymea-core/jsonrpc/actionhandler.cpp @@ -100,7 +100,7 @@ JsonReply *ActionHandler::GetActionType(const QVariantMap ¶ms) const foreach (const ActionType &actionType, deviceClass.actionTypes()) { if (actionType.id() == actionTypeId) { QVariantMap data = statusToReply(DeviceManager::DeviceErrorNoError); - data.insert("actionType", JsonTypes::packActionType(actionType)); + data.insert("actionType", JsonTypes::packActionType(actionType, deviceClass.pluginId(), params.value("locale").toLocale())); return createReply(data); } } diff --git a/libnymea-core/jsonrpc/configurationhandler.cpp b/libnymea-core/jsonrpc/configurationhandler.cpp index 2d8e077f..6e5c8869 100644 --- a/libnymea-core/jsonrpc/configurationhandler.cpp +++ b/libnymea-core/jsonrpc/configurationhandler.cpp @@ -75,7 +75,7 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent): setReturns("GetTimeZones", returns); params.clear(); returns.clear(); - setDescription("GetAvailableLanguages", "Returns a list of locale codes available for the server. i.e. en_US, de_AT"); + setDescription("GetAvailableLanguages", "DEPRECATED - Use the locale property in the Handshake message instead - Returns a list of locale codes available for the server. i.e. en_US, de_AT"); setParams("GetAvailableLanguages", params); returns.insert("languages", QVariantList() << JsonTypes::basicTypeToString(JsonTypes::String)); setReturns("GetAvailableLanguages", returns); @@ -122,7 +122,7 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent): setReturns("SetTimeZone", returns); params.clear(); returns.clear(); - setDescription("SetLanguage", "Sets the server language to the given language. See also: \"GetAvailableLanguages\""); + setDescription("SetLanguage", "DEPRECATED - Use the locale property in the Handshake message instead - Sets the server language to the given language. See also: \"GetAvailableLanguages\""); params.insert("language", JsonTypes::basicTypeToString(JsonTypes::String)); setParams("SetLanguage", params); returns.insert("configurationError", JsonTypes::configurationErrorRef()); @@ -295,7 +295,7 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent): connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::timeZoneChanged, this, &ConfigurationHandler::onBasicConfigurationChanged); connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::localeChanged, this, &ConfigurationHandler::onBasicConfigurationChanged); connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::debugServerEnabledChanged, this, &ConfigurationHandler::onBasicConfigurationChanged); - connect(NymeaCore::instance()->deviceManager(), &DeviceManager::languageUpdated, this, &ConfigurationHandler::onLanguageChanged); + connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::localeChanged, this, &ConfigurationHandler::onLanguageChanged); connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::tcpServerConfigurationChanged, this, &ConfigurationHandler::onTcpServerConfigurationChanged); connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::tcpServerConfigurationRemoved, this, &ConfigurationHandler::onTcpServerConfigurationRemoved); connect(NymeaCore::instance()->configuration(), &NymeaConfiguration::webServerConfigurationChanged, this, &ConfigurationHandler::onWebServerConfigurationChanged); diff --git a/libnymea-core/jsonrpc/devicehandler.cpp b/libnymea-core/jsonrpc/devicehandler.cpp index 811a7b9f..9bdee4bd 100644 --- a/libnymea-core/jsonrpc/devicehandler.cpp +++ b/libnymea-core/jsonrpc/devicehandler.cpp @@ -60,6 +60,7 @@ #include "types/deviceclass.h" #include "plugin/device.h" #include "plugin/deviceplugin.h" +#include "translator.h" #include @@ -319,14 +320,14 @@ JsonReply* DeviceHandler::GetSupportedVendors(const QVariantMap ¶ms) const Q_UNUSED(params) QVariantMap returns; - returns.insert("vendors", JsonTypes::packSupportedVendors()); + returns.insert("vendors", JsonTypes::packSupportedVendors(params.value("locale").toLocale())); return createReply(returns); } JsonReply* DeviceHandler::GetSupportedDevices(const QVariantMap ¶ms) const { QVariantMap returns; - returns.insert("deviceClasses", JsonTypes::packSupportedDevices(VendorId(params.value("vendorId").toString()))); + returns.insert("deviceClasses", JsonTypes::packSupportedDevices(VendorId(params.value("vendorId").toString()), params.value("locale").toLocale())); return createReply(returns); } @@ -354,7 +355,7 @@ JsonReply* DeviceHandler::GetPlugins(const QVariantMap ¶ms) const Q_UNUSED(params) QVariantMap returns; - returns.insert("plugins", JsonTypes::packPlugins()); + returns.insert("plugins", JsonTypes::packPlugins(params.value("locale").toLocale())); return createReply(returns); } @@ -437,7 +438,7 @@ JsonReply *DeviceHandler::PairDevice(const QVariantMap ¶ms) QVariantMap returns; returns.insert("deviceError", JsonTypes::deviceErrorToString(status)); if (status == DeviceManager::DeviceErrorNoError) { - returns.insert("displayMessage", deviceClass.pairingInfo()); + returns.insert("displayMessage", NymeaCore::instance()->deviceManager()->translator()->translate(deviceClass.pluginId(), deviceClass.pairingInfo(), params.value("locale").toLocale())); returns.insert("pairingTransactionId", pairingTransactionId.toString()); returns.insert("setupMethod", JsonTypes::setupMethod().at(deviceClass.setupMethod())); } @@ -565,7 +566,7 @@ JsonReply* DeviceHandler::GetEventTypes(const QVariantMap ¶ms) const QVariantList eventList; DeviceClass deviceClass = NymeaCore::instance()->deviceManager()->findDeviceClass(DeviceClassId(params.value("deviceClassId").toString())); foreach (const EventType &eventType, deviceClass.eventTypes()) { - eventList.append(JsonTypes::packEventType(eventType)); + eventList.append(JsonTypes::packEventType(eventType, deviceClass.pluginId(), params.value("locale").toLocale())); } returns.insert("eventTypes", eventList); return createReply(returns); @@ -578,7 +579,7 @@ JsonReply* DeviceHandler::GetActionTypes(const QVariantMap ¶ms) const QVariantList actionList; DeviceClass deviceClass = NymeaCore::instance()->deviceManager()->findDeviceClass(DeviceClassId(params.value("deviceClassId").toString())); foreach (const ActionType &actionType, deviceClass.actionTypes()) { - actionList.append(JsonTypes::packActionType(actionType)); + actionList.append(JsonTypes::packActionType(actionType, deviceClass.pluginId(), params.value("locale").toLocale())); } returns.insert("actionTypes", actionList); return createReply(returns); @@ -591,7 +592,7 @@ JsonReply* DeviceHandler::GetStateTypes(const QVariantMap ¶ms) const QVariantList stateList; DeviceClass deviceClass = NymeaCore::instance()->deviceManager()->findDeviceClass(DeviceClassId(params.value("deviceClassId").toString())); foreach (const StateType &stateType, deviceClass.stateTypes()) { - stateList.append(JsonTypes::packStateType(stateType)); + stateList.append(JsonTypes::packStateType(stateType, deviceClass.pluginId(), NymeaCore::instance()->configuration()->locale())); } returns.insert("stateTypes", stateList); return createReply(returns); diff --git a/libnymea-core/jsonrpc/eventhandler.cpp b/libnymea-core/jsonrpc/eventhandler.cpp index c96737be..430e698c 100644 --- a/libnymea-core/jsonrpc/eventhandler.cpp +++ b/libnymea-core/jsonrpc/eventhandler.cpp @@ -88,7 +88,7 @@ JsonReply* EventHandler::GetEventType(const QVariantMap ¶ms) const foreach (const EventType &eventType, deviceClass.eventTypes()) { if (eventType.id() == eventTypeId) { QVariantMap data = statusToReply(DeviceManager::DeviceErrorNoError); - data.insert("eventType", JsonTypes::packEventType(eventType)); + data.insert("eventType", JsonTypes::packEventType(eventType, deviceClass.pluginId(), params.value("locale").toLocale())); return createReply(data); } } diff --git a/libnymea-core/jsonrpc/jsonrpcserver.cpp b/libnymea-core/jsonrpc/jsonrpcserver.cpp index 5aabd58d..a670638f 100644 --- a/libnymea-core/jsonrpc/jsonrpcserver.cpp +++ b/libnymea-core/jsonrpc/jsonrpcserver.cpp @@ -75,7 +75,16 @@ JsonRPCServer::JsonRPCServer(const QSslConfiguration &sslConfiguration, QObject QVariantMap params; params.clear(); returns.clear(); - setDescription("Hello", "Upon first connection, nymea will automatically send a welcome message containing information about the setup. If this message is lost for whatever reason (connections with multiple hops might drop this if nymea sends it too early), the exact same message can be retrieved multiple times by calling this Hello method. Note that the contents might change if the system changed its state in the meantime, e.g. initialSetupRequired might turn false if the initial setup has been performed in the meantime."); + setDescription("Hello", "Initiates a connection. Use this method to perform an initial handshake of the " + "connection. Optionally, a parameter \"locale\" is can be passed to set up the used " + "locale for this connection. Strings such as DeviceClass displayNames etc will be " + "localized to this locale. If this parameter is omitted, the default system locale " + "(depending on the configuration) is used. The reply of this method contains information " + "about this core instance such as version information, uuid and its name. The locale value" + "indicates the locale used for this connection. Note: This method can be called multiple " + "times. The locale used in the last call for this connection will be used. Other values, " + "like initialSetupRequired might change if the setup has been performed in the meantime."); + params.insert("o:locale", JsonTypes::basicTypeToString(JsonTypes::String)); setParams("Hello", params); returns.insert("id", JsonTypes::basicTypeToString(JsonTypes::Int)); returns.insert("server", JsonTypes::basicTypeToString(JsonTypes::String)); @@ -83,6 +92,7 @@ JsonRPCServer::JsonRPCServer(const QSslConfiguration &sslConfiguration, QObject returns.insert("version", JsonTypes::basicTypeToString(JsonTypes::String)); returns.insert("uuid", JsonTypes::basicTypeToString(JsonTypes::Uuid)); returns.insert("language", JsonTypes::basicTypeToString(JsonTypes::String)); + returns.insert("locale", JsonTypes::basicTypeToString(JsonTypes::String)); returns.insert("protocol version", JsonTypes::basicTypeToString(JsonTypes::String)); returns.insert("initialSetupRequired", JsonTypes::basicTypeToString(JsonTypes::Bool)); returns.insert("authenticationRequired", JsonTypes::basicTypeToString(JsonTypes::Bool)); @@ -225,11 +235,20 @@ QString JsonRPCServer::name() const return QStringLiteral("JSONRPC"); } -JsonReply *JsonRPCServer::Hello(const QVariantMap ¶ms) const +JsonReply *JsonRPCServer::Hello(const QVariantMap ¶ms) { Q_UNUSED(params); TransportInterface *interface = reinterpret_cast(property("transportInterface").toLongLong()); - return createReply(createWelcomeMessage(interface)); + + qCDebug(dcJsonRpc()) << params; + QUuid clientId = this->property("clientId").toUuid(); + if (params.contains("locale")) { + m_clientLocales.insert(clientId, QLocale(params.value("locale").toString())); + } + + qCDebug(dcJsonRpc()) << "Client" << clientId << "initiated handshake." << m_clientLocales.value(clientId); + + return createReply(createWelcomeMessage(interface, clientId)); } JsonReply* JsonRPCServer::Introspect(const QVariantMap ¶ms) const @@ -465,7 +484,7 @@ void JsonRPCServer::sendUnauthorizedResponse(TransportInterface *interface, cons interface->sendData(clientId, data); } -QVariantMap JsonRPCServer::createWelcomeMessage(TransportInterface *interface) const +QVariantMap JsonRPCServer::createWelcomeMessage(TransportInterface *interface, const QUuid &clientId) const { QVariantMap handshake; handshake.insert("id", 0); @@ -473,7 +492,9 @@ QVariantMap JsonRPCServer::createWelcomeMessage(TransportInterface *interface) c handshake.insert("name", NymeaCore::instance()->configuration()->serverName()); handshake.insert("version", NYMEA_VERSION_STRING); handshake.insert("uuid", NymeaCore::instance()->configuration()->serverUuid().toString()); - handshake.insert("language", NymeaCore::instance()->configuration()->locale().name()); + // "language" is deprecated + handshake.insert("language", m_clientLocales.value(clientId).name()); + handshake.insert("locale", m_clientLocales.value(clientId).name()); handshake.insert("protocol version", JSON_PROTOCOL_VERSION); handshake.insert("initialSetupRequired", (interface->configuration().authenticationEnabled ? NymeaCore::instance()->userManager()->initRequired() : false)); handshake.insert("authenticationRequired", interface->configuration().authenticationEnabled); @@ -601,6 +622,13 @@ void JsonRPCServer::processJsonPacket(TransportInterface *interface, const QUuid qCDebug(dcJsonRpc()) << "Invoking method" << targetNamespace << method.toLatin1().data(); + if (targetNamespace != "JSONRPC" || method != "Hello") { + // Unless this is the Hello message, which allows setting the locale explicity, attach the locale + // for this connection + // If the client did request a locale in the Hello message, use that locale + params.insert("locale", m_clientLocales.value(clientId)); + } + JsonReply *reply; QMetaObject::invokeMethod(handler, method.toLatin1().data(), Q_RETURN_ARG(JsonReply*, reply), Q_ARG(QVariantMap, params)); if (reply->type() == JsonReply::TypeAsync) { @@ -736,7 +764,10 @@ void JsonRPCServer::clientConnected(const QUuid &clientId) // If authentication is required, notifications are disabled by default. Clients must enable them with a valid token m_clientNotifications.insert(clientId, !interface->configuration().authenticationEnabled); - interface->sendData(clientId, QJsonDocument::fromVariant(createWelcomeMessage(interface)).toJson(QJsonDocument::Compact)); + // Initialize the connection locale to the settings default + m_clientLocales.insert(clientId, NymeaCore::instance()->configuration()->locale()); + + interface->sendData(clientId, QJsonDocument::fromVariant(createWelcomeMessage(interface, clientId)).toJson(QJsonDocument::Compact)); } void JsonRPCServer::clientDisconnected(const QUuid &clientId) @@ -745,6 +776,7 @@ void JsonRPCServer::clientDisconnected(const QUuid &clientId) m_clientTransports.remove(clientId); m_clientNotifications.remove(clientId); m_clientBuffers.remove(clientId); + m_clientLocales.remove(clientId); if (m_pushButtonTransactions.values().contains(clientId)) { NymeaCore::instance()->userManager()->cancelPushButtonAuth(m_pushButtonTransactions.key(clientId)); } diff --git a/libnymea-core/jsonrpc/jsonrpcserver.h b/libnymea-core/jsonrpc/jsonrpcserver.h index 984712e4..e85a6da6 100644 --- a/libnymea-core/jsonrpc/jsonrpcserver.h +++ b/libnymea-core/jsonrpc/jsonrpcserver.h @@ -47,7 +47,7 @@ public: // JsonHandler API implementation QString name() const; - Q_INVOKABLE JsonReply *Hello(const QVariantMap ¶ms) const; + Q_INVOKABLE JsonReply *Hello(const QVariantMap ¶ms); Q_INVOKABLE JsonReply *Introspect(const QVariantMap ¶ms) const; Q_INVOKABLE JsonReply *Version(const QVariantMap ¶ms) const; Q_INVOKABLE JsonReply *SetNotificationStatus(const QVariantMap ¶ms); @@ -77,7 +77,7 @@ private: void sendResponse(TransportInterface *interface, const QUuid &clientId, int commandId, const QVariantMap ¶ms = QVariantMap()); void sendErrorResponse(TransportInterface *interface, const QUuid &clientId, int commandId, const QString &error); void sendUnauthorizedResponse(TransportInterface *interface, const QUuid &clientId, int commandId, const QString &error); - QVariantMap createWelcomeMessage(TransportInterface *interface) const; + QVariantMap createWelcomeMessage(TransportInterface *interface, const QUuid &clientId) const; void processJsonPacket(TransportInterface *interface, const QUuid &clientId, const QByteArray &data); @@ -105,6 +105,7 @@ private: QHash m_clientTransports; QHash m_clientBuffers; QHash m_clientNotifications; + QHash m_clientLocales; QHash m_pushButtonTransactions; QHash m_pairingRequests; diff --git a/libnymea-core/jsonrpc/jsontypes.cpp b/libnymea-core/jsonrpc/jsontypes.cpp index 2e82a0e8..4b6e66ad 100644 --- a/libnymea-core/jsonrpc/jsontypes.cpp +++ b/libnymea-core/jsonrpc/jsontypes.cpp @@ -56,6 +56,8 @@ #include "ruleengine.h" #include "loggingcategories.h" #include "logging/logvaluetool.h" +#include "translator.h" +#include "plugin/deviceplugin.h" #include #include @@ -498,12 +500,12 @@ QVariantMap JsonTypes::allTypes() } /*! Returns a variant map of the given \a eventType. */ -QVariantMap JsonTypes::packEventType(const EventType &eventType) +QVariantMap JsonTypes::packEventType(const EventType &eventType, const PluginId &pluginId, const QLocale &locale) { QVariantMap variant; variant.insert("id", eventType.id().toString()); variant.insert("name", eventType.name()); - variant.insert("displayName", eventType.displayName()); + variant.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(pluginId, eventType.displayName(), locale)); variant.insert("index", eventType.index()); if (!eventType.ruleRelevant()) variant.insert("ruleRelevant", false); @@ -513,7 +515,7 @@ QVariantMap JsonTypes::packEventType(const EventType &eventType) QVariantList paramTypes; foreach (const ParamType ¶mType, eventType.paramTypes()) - paramTypes.append(packParamType(paramType)); + paramTypes.append(packParamType(paramType, pluginId, locale)); variant.insert("paramTypes", paramTypes); return variant; @@ -553,16 +555,16 @@ QVariantMap JsonTypes::packEventDescriptor(const EventDescriptor &eventDescripto } /*! Returns a variant map of the given \a actionType. */ -QVariantMap JsonTypes::packActionType(const ActionType &actionType) +QVariantMap JsonTypes::packActionType(const ActionType &actionType, const PluginId &pluginId, const QLocale &locale) { QVariantMap variantMap; variantMap.insert("id", actionType.id().toString()); variantMap.insert("name", actionType.name()); - variantMap.insert("displayName", actionType.displayName()); + variantMap.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(pluginId, actionType.displayName(), locale)); variantMap.insert("index", actionType.index()); QVariantList paramTypes; foreach (const ParamType ¶mType, actionType.paramTypes()) - paramTypes.append(packParamType(paramType)); + paramTypes.append(packParamType(paramType, pluginId, locale)); variantMap.insert("paramTypes", paramTypes); return variantMap; @@ -630,12 +632,12 @@ QVariantMap JsonTypes::packState(const State &state) } /*! Returns a variant map of the given \a stateType. */ -QVariantMap JsonTypes::packStateType(const StateType &stateType) +QVariantMap JsonTypes::packStateType(const StateType &stateType, const PluginId &pluginId, const QLocale &locale) { QVariantMap variantMap; variantMap.insert("id", stateType.id().toString()); variantMap.insert("name", stateType.name()); - variantMap.insert("displayName", stateType.displayName()); + variantMap.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(pluginId, stateType.displayName(), locale)); variantMap.insert("index", stateType.index()); variantMap.insert("type", basicTypeToString(stateType.type())); variantMap.insert("defaultValue", stateType.defaultValue()); @@ -721,12 +723,12 @@ QVariantMap JsonTypes::packParamDescriptor(const ParamDescriptor ¶mDescripto } /*! Returns a variant map of the given \a paramType. */ -QVariantMap JsonTypes::packParamType(const ParamType ¶mType) +QVariantMap JsonTypes::packParamType(const ParamType ¶mType, const PluginId &pluginId, const QLocale &locale) { QVariantMap variantMap; variantMap.insert("id", paramType.id().toString()); variantMap.insert("name", paramType.name()); - variantMap.insert("displayName", paramType.displayName()); + variantMap.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(pluginId, paramType.displayName(), locale)); variantMap.insert("type", basicTypeToString(paramType.type())); variantMap.insert("index", paramType.index()); @@ -756,22 +758,28 @@ QVariantMap JsonTypes::packParamType(const ParamType ¶mType) } /*! Returns a variant map of the given \a vendor. */ -QVariantMap JsonTypes::packVendor(const Vendor &vendor) +QVariantMap JsonTypes::packVendor(const Vendor &vendor, const QLocale &locale) { + DevicePlugin *plugin = nullptr; + foreach (DevicePlugin *p, NymeaCore::instance()->deviceManager()->plugins()) { + if (p->supportedVendors().contains(vendor)) { + plugin = p; + } + } QVariantMap variantMap; variantMap.insert("id", vendor.id().toString()); variantMap.insert("name", vendor.name()); - variantMap.insert("displayName", vendor.displayName()); + variantMap.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(plugin->pluginId(), vendor.displayName(), locale)); return variantMap; } /*! Returns a variant map of the given \a deviceClass. */ -QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) +QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass, const QLocale &locale) { QVariantMap variant; variant.insert("id", deviceClass.id().toString()); variant.insert("name", deviceClass.name()); - variant.insert("displayName", deviceClass.displayName()); + variant.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(deviceClass.pluginId(), deviceClass.displayName(), locale)); variant.insert("vendorId", deviceClass.vendorId().toString()); variant.insert("pluginId", deviceClass.pluginId().toString()); variant.insert("deviceIcon", s_deviceIcon.at(deviceClass.deviceIcon())); @@ -783,23 +791,23 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) QVariantList stateTypes; foreach (const StateType &stateType, deviceClass.stateTypes()) - stateTypes.append(packStateType(stateType)); + stateTypes.append(packStateType(stateType, deviceClass.pluginId(), locale)); QVariantList eventTypes; foreach (const EventType &eventType, deviceClass.eventTypes()) - eventTypes.append(packEventType(eventType)); + eventTypes.append(packEventType(eventType, deviceClass.pluginId(), locale)); QVariantList actionTypes; foreach (const ActionType &actionType, deviceClass.actionTypes()) - actionTypes.append(packActionType(actionType)); + actionTypes.append(packActionType(actionType, deviceClass.pluginId(), locale)); QVariantList paramTypes; foreach (const ParamType ¶mType, deviceClass.paramTypes()) - paramTypes.append(packParamType(paramType)); + paramTypes.append(packParamType(paramType, deviceClass.pluginId(), locale)); QVariantList discoveryParamTypes; foreach (const ParamType ¶mType, deviceClass.discoveryParamTypes()) - discoveryParamTypes.append(packParamType(paramType)); + discoveryParamTypes.append(packParamType(paramType, deviceClass.pluginId(), locale)); if (!deviceClass.criticalStateTypeId().isNull()) variant.insert("criticalStateTypeId", deviceClass.criticalStateTypeId().toString()); @@ -822,16 +830,16 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) } /*! Returns a variant map of the given \a plugin. */ -QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin) +QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin, const QLocale &locale) { QVariantMap pluginMap; pluginMap.insert("id", plugin->pluginId().toString()); pluginMap.insert("name", plugin->pluginName()); - pluginMap.insert("displayName", plugin->pluginDisplayName()); + pluginMap.insert("displayName", NymeaCore::instance()->deviceManager()->translator()->translate(plugin->pluginId(), plugin->pluginDisplayName(), locale)); QVariantList params; foreach (const ParamType ¶m, plugin->configurationDescription()) - params.append(packParamType(param)); + params.append(packParamType(param, plugin->pluginId(), locale)); pluginMap.insert("paramTypes", params); return pluginMap; @@ -1130,21 +1138,21 @@ QVariantMap JsonTypes::packWirelessNetworkDevice(WirelessNetworkDevice *networkD } /*! Returns a variant list of the supported vendors. */ -QVariantList JsonTypes::packSupportedVendors() +QVariantList JsonTypes::packSupportedVendors(const QLocale &locale) { QVariantList supportedVendors; foreach (const Vendor &vendor, NymeaCore::instance()->deviceManager()->supportedVendors()) - supportedVendors.append(packVendor(vendor)); + supportedVendors.append(packVendor(vendor, locale)); return supportedVendors; } /*! Returns a variant list of the supported devices with the given \a vendorId. */ -QVariantList JsonTypes::packSupportedDevices(const VendorId &vendorId) +QVariantList JsonTypes::packSupportedDevices(const VendorId &vendorId, const QLocale &locale) { QVariantList supportedDeviceList; foreach (const DeviceClass &deviceClass, NymeaCore::instance()->deviceManager()->supportedDevices(vendorId)) - supportedDeviceList.append(packDeviceClass(deviceClass)); + supportedDeviceList.append(packDeviceClass(deviceClass, locale)); return supportedDeviceList; } @@ -1246,41 +1254,41 @@ QVariantList JsonTypes::packRuleDescriptions(const QList &rules) } /*! Returns a variant list of action types for the given \a deviceClass. */ -QVariantList JsonTypes::packActionTypes(const DeviceClass &deviceClass) +QVariantList JsonTypes::packActionTypes(const DeviceClass &deviceClass, const QLocale &locale) { QVariantList actionTypes; foreach (const ActionType &actionType, deviceClass.actionTypes()) - actionTypes.append(JsonTypes::packActionType(actionType)); + actionTypes.append(JsonTypes::packActionType(actionType, deviceClass.pluginId(), locale)); return actionTypes; } /*! Returns a variant list of state types for the given \a deviceClass. */ -QVariantList JsonTypes::packStateTypes(const DeviceClass &deviceClass) +QVariantList JsonTypes::packStateTypes(const DeviceClass &deviceClass, const QLocale &locale) { QVariantList stateTypes; foreach (const StateType &stateType, deviceClass.stateTypes()) - stateTypes.append(JsonTypes::packStateType(stateType)); + stateTypes.append(JsonTypes::packStateType(stateType, deviceClass.pluginId(), locale)); return stateTypes; } /*! Returns a variant list of event types for the given \a deviceClass. */ -QVariantList JsonTypes::packEventTypes(const DeviceClass &deviceClass) +QVariantList JsonTypes::packEventTypes(const DeviceClass &deviceClass, const QLocale &locale) { QVariantList eventTypes; foreach (const EventType &eventType, deviceClass.eventTypes()) - eventTypes.append(JsonTypes::packEventType(eventType)); + eventTypes.append(JsonTypes::packEventType(eventType, deviceClass.pluginId(), locale)); return eventTypes; } /*! Returns a variant list containing all plugins. */ -QVariantList JsonTypes::packPlugins() +QVariantList JsonTypes::packPlugins(const QLocale &locale) { QVariantList pluginsList; foreach (DevicePlugin *plugin, NymeaCore::instance()->deviceManager()->plugins()) { - QVariantMap pluginMap = packPlugin(plugin); + QVariantMap pluginMap = packPlugin(plugin, locale); pluginsList.append(pluginMap); } return pluginsList; diff --git a/libnymea-core/jsonrpc/jsontypes.h b/libnymea-core/jsonrpc/jsontypes.h index 7cfa785a..dda5c3cb 100644 --- a/libnymea-core/jsonrpc/jsontypes.h +++ b/libnymea-core/jsonrpc/jsontypes.h @@ -180,23 +180,23 @@ public: DECLARE_OBJECT(mqttPolicy, "MqttPolicy") // pack types - static QVariantMap packEventType(const EventType &eventType); + static QVariantMap packEventType(const EventType &eventType, const PluginId &pluginId, const QLocale &locale); static QVariantMap packEvent(const Event &event); static QVariantMap packEventDescriptor(const EventDescriptor &event); - static QVariantMap packActionType(const ActionType &actionType); + static QVariantMap packActionType(const ActionType &actionType, const PluginId &pluginId, const QLocale &locale); static QVariantMap packAction(const Action &action); static QVariantMap packRuleAction(const RuleAction &ruleAction); static QVariantMap packRuleActionParam(const RuleActionParam &ruleActionParam); static QVariantMap packState(const State &state); - static QVariantMap packStateType(const StateType &stateType); + static QVariantMap packStateType(const StateType &stateType, const PluginId &pluginId, const QLocale &locale); static QVariantMap packStateDescriptor(const StateDescriptor &stateDescriptor); static QVariantMap packStateEvaluator(const StateEvaluator &stateEvaluator); static QVariantMap packParam(const Param ¶m); - static QVariantMap packParamType(const ParamType ¶mType); + static QVariantMap packParamType(const ParamType ¶mType, const PluginId &pluginId, const QLocale &locale); static QVariantMap packParamDescriptor(const ParamDescriptor ¶mDescriptor); - static QVariantMap packVendor(const Vendor &vendor); - static QVariantMap packDeviceClass(const DeviceClass &deviceClass); - static QVariantMap packPlugin(DevicePlugin *plugin); + static QVariantMap packVendor(const Vendor &vendor, const QLocale &locale); + static QVariantMap packDeviceClass(const DeviceClass &deviceClass, const QLocale &locale); + static QVariantMap packPlugin(DevicePlugin *pluginid, const QLocale &locale); static QVariantMap packDevice(Device *device); static QVariantMap packDeviceDescriptor(const DeviceDescriptor &descriptor); static QVariantMap packRule(const Rule &rule); @@ -213,8 +213,8 @@ public: static QVariantList packRules(const QList rules); static QVariantList packCreateMethods(DeviceClass::CreateMethods createMethods); - static QVariantList packSupportedVendors(); - static QVariantList packSupportedDevices(const VendorId &vendorId); + static QVariantList packSupportedVendors(const QLocale &locale); + static QVariantList packSupportedDevices(const VendorId &vendorId, const QLocale &locale); static QVariantList packConfiguredDevices(); static QVariantList packDeviceStates(Device *device); static QVariantList packDeviceDescriptors(const QList deviceDescriptors); @@ -227,10 +227,10 @@ public: static QVariantList packRuleDescriptions(); static QVariantList packRuleDescriptions(const QList &rules); - static QVariantList packActionTypes(const DeviceClass &deviceClass); - static QVariantList packStateTypes(const DeviceClass &deviceClass); - static QVariantList packEventTypes(const DeviceClass &deviceClass); - static QVariantList packPlugins(); + static QVariantList packActionTypes(const DeviceClass &deviceClass, const QLocale &locale); + static QVariantList packStateTypes(const DeviceClass &deviceClass, const QLocale &locale); + static QVariantList packEventTypes(const DeviceClass &deviceClass, const QLocale &locale); + static QVariantList packPlugins(const QLocale &locale); static QVariantMap packTokenInfo(const TokenInfo &tokenInfo); diff --git a/libnymea-core/jsonrpc/statehandler.cpp b/libnymea-core/jsonrpc/statehandler.cpp index e70fbff3..4b34641e 100644 --- a/libnymea-core/jsonrpc/statehandler.cpp +++ b/libnymea-core/jsonrpc/statehandler.cpp @@ -68,7 +68,7 @@ JsonReply* StateHandler::GetStateType(const QVariantMap ¶ms) const foreach (const StateType &stateType, deviceClass.stateTypes()) { if (stateType.id() == stateTypeId) { QVariantMap data = statusToReply(DeviceManager::DeviceErrorNoError); - data.insert("stateType", JsonTypes::packStateType(stateType)); + data.insert("stateType", JsonTypes::packStateType(stateType, deviceClass.pluginId(), params.value("locale").toLocale())); return createReply(data); } } diff --git a/libnymea-core/nymeacore.cpp b/libnymea-core/nymeacore.cpp index 104b5290..ea9ebff1 100644 --- a/libnymea-core/nymeacore.cpp +++ b/libnymea-core/nymeacore.cpp @@ -118,6 +118,7 @@ #include "cloud/cloudtransport.h" #include +#include namespace nymeaserver { @@ -184,7 +185,6 @@ void NymeaCore::init() { CloudTransport *cloudTransport = m_cloudManager->createTransportInterface(); m_serverManager->jsonServer()->registerTransportInterface(cloudTransport, false); - connect(m_configuration, &NymeaConfiguration::localeChanged, this, &NymeaCore::onLocaleChanged); connect(m_configuration, &NymeaConfiguration::serverNameChanged, m_serverManager, &ServerManager::setServerName); connect(m_deviceManager, &DeviceManager::pluginConfigChanged, this, &NymeaCore::pluginConfigChanged); @@ -533,9 +533,20 @@ QStringList NymeaCore::getAvailableLanguages() { qCDebug(dcApplication()) << "Loading translations from" << NymeaSettings::translationsPath(); - QDir translationDirectory(NymeaSettings::translationsPath()); - translationDirectory.setNameFilters(QStringList() << "*.qm"); - QStringList translationFiles = translationDirectory.entryList(); + QStringList searchPaths; + searchPaths << QCoreApplication::applicationDirPath() + "/../translations"; + searchPaths << NymeaSettings::translationsPath(); + + QStringList translationFiles; + foreach (const QString &path, searchPaths) { + QDir translationDirectory(path); + translationDirectory.setNameFilters(QStringList() << "*.qm"); + translationFiles = translationDirectory.entryList(); + qCDebug(dcTranslations()) << translationFiles.count() << "translations in" << path; + if (translationFiles.count() > 0) { + break; + } + } QStringList availableLanguages; foreach (QString translationFile, translationFiles) { @@ -687,11 +698,6 @@ void NymeaCore::onDateTimeChanged(const QDateTime &dateTime) executeRuleActions(actions); } -void NymeaCore::onLocaleChanged() -{ - m_deviceManager->setLocale(m_configuration->locale()); -} - /*! Return the instance of the log engine */ LogEngine* NymeaCore::logEngine() const { diff --git a/libnymea-core/nymeacore.h b/libnymea-core/nymeacore.h index f3aee522..7911e5d9 100644 --- a/libnymea-core/nymeacore.h +++ b/libnymea-core/nymeacore.h @@ -136,7 +136,6 @@ private: private slots: void gotEvent(const Event &event); void onDateTimeChanged(const QDateTime &dateTime); - void onLocaleChanged(); void actionExecutionFinished(const ActionId &id, DeviceManager::DeviceError status); void onDeviceDisappeared(const DeviceId &deviceId); void deviceManagerLoaded(); diff --git a/libnymea-core/servers/rest/deviceclassesresource.cpp b/libnymea-core/servers/rest/deviceclassesresource.cpp index 02a0edb1..586edfab 100644 --- a/libnymea-core/servers/rest/deviceclassesresource.cpp +++ b/libnymea-core/servers/rest/deviceclassesresource.cpp @@ -184,7 +184,7 @@ HttpReply *DeviceClassesResource::getDeviceClass() qCDebug(dcRest) << "Get device class with id " << m_deviceClass.id(); HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packDeviceClass(m_deviceClass)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packDeviceClass(m_deviceClass, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } @@ -193,7 +193,7 @@ HttpReply *DeviceClassesResource::getActionTypes() qCDebug(dcRest) << "Get action types for device class" << m_deviceClass.id(); HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packActionTypes(m_deviceClass)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packActionTypes(m_deviceClass, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } @@ -205,7 +205,7 @@ HttpReply *DeviceClassesResource::getActionType(const ActionTypeId &actionTypeId if (actionType.id() == actionTypeId) { HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packActionType(actionType)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packActionType(actionType, m_deviceClass.pluginId(), NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } } @@ -217,7 +217,7 @@ HttpReply *DeviceClassesResource::getStateTypes() qCDebug(dcRest) << "Get state types for device class" << m_deviceClass.id(); HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packStateTypes(m_deviceClass)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packStateTypes(m_deviceClass, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } @@ -229,7 +229,7 @@ HttpReply *DeviceClassesResource::getStateType(const StateTypeId &stateTypeId) if (stateType.id() == stateTypeId) { HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packStateType(stateType)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packStateType(stateType, m_deviceClass.pluginId(), NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } } @@ -241,7 +241,7 @@ HttpReply *DeviceClassesResource::getEventTypes() qCDebug(dcRest) << "Get event types for device class" << m_deviceClass.id(); HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packEventTypes(m_deviceClass)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packEventTypes(m_deviceClass, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } @@ -253,7 +253,7 @@ HttpReply *DeviceClassesResource::getEventType(const EventTypeId &eventTypeId) if (eventType.id() == eventTypeId) { HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packEventType(eventType)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packEventType(eventType, m_deviceClass.pluginId(), NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } } @@ -307,7 +307,7 @@ HttpReply *DeviceClassesResource::getDeviceClasses(const VendorId &vendorId) HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packSupportedDevices(vendorId)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packSupportedDevices(vendorId, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } diff --git a/libnymea-core/servers/rest/deviceclassesresource.h b/libnymea-core/servers/rest/deviceclassesresource.h index 96e94338..aba8fb86 100644 --- a/libnymea-core/servers/rest/deviceclassesresource.h +++ b/libnymea-core/servers/rest/deviceclassesresource.h @@ -37,7 +37,7 @@ class DeviceClassesResource : public RestResource { Q_OBJECT public: - explicit DeviceClassesResource(QObject *parent = 0); + explicit DeviceClassesResource(QObject *parent = nullptr); QString name() const override; diff --git a/libnymea-core/servers/rest/devicesresource.cpp b/libnymea-core/servers/rest/devicesresource.cpp index 68693cde..069db826 100644 --- a/libnymea-core/servers/rest/devicesresource.cpp +++ b/libnymea-core/servers/rest/devicesresource.cpp @@ -41,6 +41,7 @@ #include "servers/httprequest.h" #include "jsonrpc/jsontypes.h" #include "nymeacore.h" +#include "translator.h" #include @@ -442,7 +443,7 @@ HttpReply *DevicesResource::pairDevice(const QByteArray &payload) const return createDeviceErrorReply(HttpReply::BadRequest, status); QVariantMap returns; - returns.insert("displayMessage", deviceClass.pairingInfo()); + returns.insert("displayMessage", NymeaCore::instance()->deviceManager()->translator()->translate(deviceClass.pluginId(), deviceClass.pairingInfo(), NymeaCore::instance()->configuration()->locale())); returns.insert("pairingTransactionId", pairingTransactionId.toString()); returns.insert("setupMethod", JsonTypes::setupMethod().at(deviceClass.setupMethod())); HttpReply *reply = createSuccessReply(); diff --git a/libnymea-core/servers/rest/pluginsresource.cpp b/libnymea-core/servers/rest/pluginsresource.cpp index dd0a10bd..66b16257 100644 --- a/libnymea-core/servers/rest/pluginsresource.cpp +++ b/libnymea-core/servers/rest/pluginsresource.cpp @@ -139,7 +139,7 @@ HttpReply *PluginsResource::getPlugins() const qCDebug(dcRest) << "Get plugins"; HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packPlugins()).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packPlugins(NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } @@ -150,7 +150,7 @@ HttpReply *PluginsResource::getPlugin(const PluginId &pluginId) const foreach (DevicePlugin *plugin, NymeaCore::instance()->deviceManager()->plugins()) { if (plugin->pluginId() == pluginId) { reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packPlugin(plugin)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packPlugin(plugin, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } } diff --git a/libnymea-core/servers/rest/vendorsresource.cpp b/libnymea-core/servers/rest/vendorsresource.cpp index e8c2058f..2194be13 100644 --- a/libnymea-core/servers/rest/vendorsresource.cpp +++ b/libnymea-core/servers/rest/vendorsresource.cpp @@ -111,7 +111,7 @@ HttpReply *VendorsResource::getVendors() const QVariantList vendorsList; foreach (const Vendor &vendor, NymeaCore::instance()->deviceManager()->supportedVendors()) { - vendorsList.append(JsonTypes::packVendor(vendor)); + vendorsList.append(JsonTypes::packVendor(vendor, NymeaCore::instance()->configuration()->locale())); } reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); reply->setPayload(QJsonDocument::fromVariant(vendorsList).toJson()); @@ -125,7 +125,7 @@ HttpReply *VendorsResource::getVendor(const VendorId &vendorId) const if (vendor.id() == vendorId) { HttpReply *reply = createSuccessReply(); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); - reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packVendor(vendor)).toJson()); + reply->setPayload(QJsonDocument::fromVariant(JsonTypes::packVendor(vendor, NymeaCore::instance()->configuration()->locale())).toJson()); return reply; } } diff --git a/libnymea/devicemanager.cpp b/libnymea/devicemanager.cpp index c7e2be1b..be059f81 100644 --- a/libnymea/devicemanager.cpp +++ b/libnymea/devicemanager.cpp @@ -181,6 +181,7 @@ #include "typeutils.h" #include "nymeasettings.h" #include "unistd.h" +#include "translator.h" #include "plugintimer.h" @@ -198,7 +199,8 @@ DeviceManager::DeviceManager(HardwareManager *hardwareManager, const QLocale &locale, QObject *parent) : QObject(parent), m_hardwareManager(hardwareManager), - m_locale(locale) + m_locale(locale), + m_translator(new Translator(this)) { qRegisterMetaType(); qRegisterMetaType(); @@ -219,6 +221,8 @@ DeviceManager::DeviceManager(HardwareManager *hardwareManager, const QLocale &lo /*! Destructor of the DeviceManager. Each loaded \l{DevicePlugin} will be deleted. */ DeviceManager::~DeviceManager() { + delete m_translator; + foreach (Device *device, m_configuredDevices) { storeDeviceStates(device); } @@ -288,44 +292,6 @@ void DeviceManager::registerStaticPlugin(DevicePlugin *plugin, const QJsonObject loadPlugin(plugin); } -/*! Set the \a locale of all plugins and reload the translated strings. */ -void DeviceManager::setLocale(const QLocale &locale) -{ - qCDebug(dcDeviceManager()) << "Setting locale:" << locale; - m_locale = locale; - foreach (DevicePlugin *plugin, m_devicePlugins.values()) { - QCoreApplication::removeTranslator(plugin->translator()); - plugin->setLocale(m_locale); - QCoreApplication::installTranslator(plugin->translator()); - plugin->loadMetaData(); - } - - // Reload all plugin meta data - - m_supportedVendors.clear(); - m_supportedDevices.clear(); - - foreach (DevicePlugin *plugin, m_devicePlugins.values()) { - - foreach (const Vendor &vendor, plugin->supportedVendors()) { - if (m_supportedVendors.contains(vendor.id())) - continue; - - m_supportedVendors.insert(vendor.id(), vendor); - } - - foreach (const DeviceClass &deviceClass, plugin->supportedDevices()) { - if (!m_supportedVendors.contains(deviceClass.vendorId())) { - qCWarning(dcDeviceManager) << "Vendor not found. Ignoring device. VendorId:" << deviceClass.vendorId() << "DeviceClass:" << deviceClass.name() << deviceClass.id(); - continue; - } - m_supportedDevices.insert(deviceClass.id(), deviceClass); - } - } - - emit languageUpdated(); -} - /*! Returns the pointer to the \l{HardwareManager} of the system. \sa HardwareManager @@ -400,13 +366,15 @@ Interface DeviceManager::findInterface(const QString &name) * Optionally filtered by \a vendorId. */ QList DeviceManager::supportedDevices(const VendorId &vendorId) const { - QList ret; if (vendorId.isNull()) { - ret = m_supportedDevices.values(); - } else { - foreach (const DeviceClassId &deviceClassId, m_vendorDeviceMap.value(vendorId)) { - ret.append(m_supportedDevices.value(deviceClassId)); + return m_supportedDevices.values(); + } + QList ret; + foreach (const DeviceClass &deviceClass, m_supportedDevices) { + if (!vendorId.isNull() && deviceClass.vendorId() != vendorId) { + continue; } + ret.append(deviceClass); } return ret; } @@ -928,13 +896,13 @@ DeviceManager::DeviceError DeviceManager::verifyParam(const ParamType ¶mType return DeviceErrorInvalidParameter; } - if (!param.value().canConvert(paramType.type())) { - qCWarning(dcDeviceManager) << "Wrong parameter type for param" << param.paramTypeId().toString() << " Got:" << param.value() << " Expected:" << QVariant::typeToName(paramType.type()); + if (!param.value().canConvert(static_cast(paramType.type()))) { + qCWarning(dcDeviceManager) << "Wrong parameter type for param" << param.paramTypeId().toString() << " Got:" << param.value() << " Expected:" << QVariant::typeToName(static_cast(paramType.type())); return DeviceErrorInvalidParameter; } - if (!param.value().convert(paramType.type())) { - qCWarning(dcDeviceManager) << "Could not convert value of param" << param.paramTypeId().toString() << " to:" << QVariant::typeToName(paramType.type()) << " Got:" << param.value(); + if (!param.value().convert(static_cast(paramType.type()))) { + qCWarning(dcDeviceManager) << "Could not convert value of param" << param.paramTypeId().toString() << " to:" << QVariant::typeToName(static_cast(paramType.type())) << " Got:" << param.value(); return DeviceErrorInvalidParameter; } @@ -993,6 +961,13 @@ DeviceManager::DeviceError DeviceManager::verifyParam(const ParamType ¶mType return DeviceErrorNoError; } +/*! Returns the translator. The translator can be used to translate plugin data. + * */ +Translator *DeviceManager::translator() const +{ + return m_translator; +} + /*! Execute the given \l{Action}. * This will find the \l{Device} \a action refers to the \l{Action}{deviceId()} and * its \l{DevicePlugin}. Then will dispatch the execution to the \l{DevicePlugin}.*/ @@ -1079,9 +1054,6 @@ void DeviceManager::loadPlugins() void DeviceManager::loadPlugin(DevicePlugin *pluginIface) { - pluginIface->setLocale(m_locale); - qApp->installTranslator(pluginIface->translator()); - pluginIface->initPlugin(this); qCDebug(dcDeviceManager) << "**** Loaded plugin" << pluginIface->pluginName(); @@ -1141,6 +1113,7 @@ void DeviceManager::loadPlugin(DevicePlugin *pluginIface) connect(pluginIface, &DevicePlugin::pairingFinished, this, &DeviceManager::slotPairingFinished); connect(pluginIface, &DevicePlugin::autoDevicesAppeared, this, &DeviceManager::onAutoDevicesAppeared); connect(pluginIface, &DevicePlugin::autoDeviceDisappeared, this, &DeviceManager::onAutoDeviceDisappeared); + } void DeviceManager::loadConfiguredDevices() diff --git a/libnymea/devicemanager.h b/libnymea/devicemanager.h index 9d542887..394c9b12 100644 --- a/libnymea/devicemanager.h +++ b/libnymea/devicemanager.h @@ -39,6 +39,7 @@ #include #include #include +#include #include "hardwaremanager.h" @@ -46,6 +47,7 @@ class Device; class DevicePlugin; class DevicePairingInfo; class HardwareManager; +class Translator; class LIBNYMEA_EXPORT DeviceManager : public QObject { @@ -96,8 +98,6 @@ public: static QList pluginsMetadata(); void registerStaticPlugin(DevicePlugin* plugin, const QJsonObject &metaData); - void setLocale(const QLocale &locale); - HardwareManager *hardwareManager() const; QList plugins() const; @@ -136,9 +136,9 @@ public: DeviceError verifyParam(const QList paramTypes, const Param ¶m); DeviceError verifyParam(const ParamType ¶mType, const Param ¶m); + Translator* translator() const; signals: void loaded(); - void languageUpdated(); void pluginConfigChanged(const PluginId &id, const ParamList &config); void eventTriggered(const Event &event); void deviceStateChanged(Device *device, const QUuid &stateTypeId, const QVariant &value); @@ -186,6 +186,7 @@ private: HardwareManager *m_hardwareManager; QLocale m_locale; + Translator *m_translator = nullptr; QHash m_supportedVendors; QHash m_supportedInterfaces; QHash > m_vendorDeviceMap; diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index 103901b9..2e1b544b 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -73,7 +73,8 @@ HEADERS += devicemanager.h \ hardwaremanager.h \ nymeadbusservice.h \ network/mqtt/mqttprovider.h \ - network/mqtt/mqttchannel.h + network/mqtt/mqttchannel.h \ + translator.h SOURCES += devicemanager.cpp \ loggingcategories.cpp \ @@ -132,7 +133,8 @@ SOURCES += devicemanager.cpp \ hardwaremanager.cpp \ nymeadbusservice.cpp \ network/mqtt/mqttprovider.cpp \ - network/mqtt/mqttchannel.cpp + network/mqtt/mqttchannel.cpp \ + translator.cpp # install plugininfo python script for libnymea-dev diff --git a/libnymea/loggingcategories.cpp b/libnymea/loggingcategories.cpp index d93ddb5e..a2eba450 100644 --- a/libnymea/loggingcategories.cpp +++ b/libnymea/loggingcategories.cpp @@ -53,3 +53,4 @@ Q_LOGGING_CATEGORY(dcAWSTraffic, "AWSTraffic") Q_LOGGING_CATEGORY(dcBluetoothServer, "BluetoothServer") Q_LOGGING_CATEGORY(dcBluetoothServerTraffic, "BluetoothServerTraffic") Q_LOGGING_CATEGORY(dcMqtt, "Mqtt") +Q_LOGGING_CATEGORY(dcTranslations, "Translations") diff --git a/libnymea/loggingcategories.h b/libnymea/loggingcategories.h index 4d1a8d21..809241dd 100644 --- a/libnymea/loggingcategories.h +++ b/libnymea/loggingcategories.h @@ -61,5 +61,6 @@ Q_DECLARE_LOGGING_CATEGORY(dcAWSTraffic) Q_DECLARE_LOGGING_CATEGORY(dcBluetoothServer) Q_DECLARE_LOGGING_CATEGORY(dcBluetoothServerTraffic) Q_DECLARE_LOGGING_CATEGORY(dcMqtt) +Q_DECLARE_LOGGING_CATEGORY(dcTranslations) #endif // LOGGINGCATEGORYS_H diff --git a/libnymea/plugin/deviceplugin.cpp b/libnymea/plugin/deviceplugin.cpp index 2e2fc74c..ca7af802 100644 --- a/libnymea/plugin/deviceplugin.cpp +++ b/libnymea/plugin/deviceplugin.cpp @@ -104,8 +104,7 @@ /*! DevicePlugin constructor. DevicePlugins will be instantiated by the DeviceManager, its \a parent. */ DevicePlugin::DevicePlugin(QObject *parent): - QObject(parent), - m_translator(new QTranslator(this)) + QObject(parent) { } @@ -124,7 +123,7 @@ QString DevicePlugin::pluginName() const /*! Returns the displayName of this DevicePlugin, to be shown to the user, translated. */ QString DevicePlugin::pluginDisplayName() const { - return translateValue(m_metaData.value("name").toString(), m_metaData.value("displayName").toString()); + return m_metaData.value("displayName").toString(); } /*! Returns the id of this DevicePlugin. @@ -141,7 +140,7 @@ QList DevicePlugin::supportedVendors() const QList vendors; foreach (const QJsonValue &vendorJson, m_metaData.value("vendors").toArray()) { Vendor vendor(vendorJson.toObject().value("id").toString(), vendorJson.toObject().value("name").toString()); - vendor.setDisplayName(translateValue(m_metaData.value("name").toString(), vendorJson.toObject().value("displayName").toString())); + vendor.setDisplayName(vendorJson.toObject().value("displayName").toString()); vendors.append(vendor); } return vendors; @@ -155,33 +154,6 @@ QList DevicePlugin::supportedDevices() const return m_supportedDevices; } -/*! Returns the translator of this \l{DevicePlugin}. */ -QTranslator *DevicePlugin::translator() -{ - return m_translator; -} - -/*! Returns true if the given \a locale could be set for this \l{DevicePlugin}. */ -bool DevicePlugin::setLocale(const QLocale &locale) -{ - // check if there are local translations - if (m_translator->load(locale, m_metaData.value("id").toString(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm")) { - qCDebug(dcDeviceManager()) << "* Load translation" << locale.name() << "for" << pluginName() << "from" << QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath() + "/" + m_metaData.value("id").toString() + "-" + locale.name() + ".qm"; - return true; - } - - // otherwise use the system translations - if (m_translator->load(locale, m_metaData.value("id").toString(), "-", NymeaSettings::translationsPath(), ".qm")) { - qCDebug(dcDeviceManager()) << "* Load translation" << locale.name() << "for" << pluginName() << "from" << NymeaSettings::translationsPath(); - return true; - } - - if (locale.name() != "en_US") - qCWarning(dcDeviceManager()) << "* Could not load translation" << locale.name() << "for plugin" << pluginName(); - - return false; -} - /*! Override this if your plugin supports Device with DeviceClass::CreationMethodAuto. This will be called at startup, after the configured devices have been loaded. This is the earliest time you should start emitting autoDevicesAppeared(). If you @@ -327,7 +299,7 @@ QPair > DevicePlugin::parseParamTypes(const QJsonArray &a } ParamType paramType(ParamTypeId(pt.value("id").toString()), pt.value("name").toString(), t, pt.value("defaultValue").toVariant()); - paramType.setDisplayName(translateValue(m_metaData.value("name").toString(), pt.value("displayName").toString())); + paramType.setDisplayName(pt.value("displayName").toString()); // Set allowed values @@ -458,6 +430,11 @@ DeviceManager::DeviceError DevicePlugin::setConfigValue(const ParamTypeId ¶m return DeviceManager::DeviceErrorNoError; } +bool DevicePlugin::isBuiltIn() const +{ + return m_metaData.value("builtIn").toBool(); +} + /*! Returns a pointer to the \l{DeviceManager}. When implementing a plugin, use this to find the \l{Device}{Devices} you need. */ @@ -529,7 +506,7 @@ void DevicePlugin::loadMetaData() // Note: The DevicePlugin has no type class, so we define the json properties here QStringList pluginMandatoryJsonProperties = QStringList() << "id" << "name" << "displayName" << "vendors"; - QStringList pluginJsonProperties = QStringList() << "id" << "name" << "displayName" << "vendors" << "paramTypes"; + QStringList pluginJsonProperties = QStringList() << "id" << "name" << "displayName" << "vendors" << "paramTypes" << "builtIn"; QPair verificationResult = verifyFields(pluginJsonProperties, pluginMandatoryJsonProperties, m_metaData); @@ -593,7 +570,7 @@ void DevicePlugin::loadMetaData() DeviceClass deviceClass(pluginId(), vendorId, deviceClassObject.value("id").toString()); deviceClass.setName(deviceClassObject.value("name").toString()); - deviceClass.setDisplayName(translateValue(m_metaData.value("name").toString(), deviceClassObject.value("displayName").toString())); + deviceClass.setDisplayName(deviceClassObject.value("displayName").toString()); // Read create methods DeviceClass::CreateMethods createMethods; @@ -665,7 +642,7 @@ void DevicePlugin::loadMetaData() deviceClass.setSetupMethod(setupMethod); // Read pairing info - deviceClass.setPairingInfo(translateValue(m_metaData.value("name").toString(), deviceClassObject.value("pairingInfo").toString())); + deviceClass.setPairingInfo(deviceClassObject.value("pairingInfo").toString()); // Read basic tags QList basicTags; @@ -725,7 +702,7 @@ void DevicePlugin::loadMetaData() StateType stateType(st.value("id").toString()); stateType.setName(st.value("name").toString()); - stateType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayName").toString())); + stateType.setDisplayName(st.value("displayName").toString()); stateType.setIndex(index++); stateType.setType(t); QPair unitVerification = loadAndVerifyUnit(st.value("unit").toString()); @@ -775,9 +752,9 @@ void DevicePlugin::loadMetaData() eventType.setRuleRelevant(st.value("eventRuleRelevant").toBool()); eventType.setName(st.value("name").toString()); - eventType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayNameEvent").toString())); + eventType.setDisplayName(st.value("displayNameEvent").toString()); ParamType paramType(ParamTypeId(stateType.id().toString()), st.value("name").toString(), stateType.type()); - paramType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayName").toString())); + paramType.setDisplayName(st.value("displayName").toString()); paramType.setAllowedValues(stateType.possibleValues()); paramType.setDefaultValue(stateType.defaultValue()); paramType.setMinValue(stateType.minValue()); @@ -791,7 +768,7 @@ void DevicePlugin::loadMetaData() if (writableState) { ActionType actionType(ActionTypeId(stateType.id().toString())); actionType.setName(stateType.name()); - actionType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayNameAction").toString())); + actionType.setDisplayName(st.value("displayNameAction").toString()); actionType.setIndex(stateType.index()); actionType.setParamTypes(QList() << paramType); actionTypes.append(actionType); @@ -821,7 +798,7 @@ void DevicePlugin::loadMetaData() ActionType actionType(at.value("id").toString()); actionType.setName(at.value("name").toString()); - actionType.setDisplayName(translateValue(m_metaData.value("name").toString(), at.value("displayName").toString())); + actionType.setDisplayName(at.value("displayName").toString()); actionType.setIndex(index++); QPair > paramVerification = parseParamTypes(at.value("paramTypes").toArray()); @@ -859,7 +836,7 @@ void DevicePlugin::loadMetaData() EventType eventType(et.value("id").toString()); eventType.setName(et.value("name").toString()); - eventType.setDisplayName(translateValue(m_metaData.value("name").toString(), et.value("displayName").toString())); + eventType.setDisplayName(et.value("displayName").toString()); eventType.setIndex(index++); if (et.contains("ruleRelevant")) eventType.setRuleRelevant(et.value("ruleRelevant").toBool()); @@ -1024,15 +1001,6 @@ void DevicePlugin::loadMetaData() } } -QString DevicePlugin::translateValue(const QString &context, const QString &string) const -{ - QString translation = m_translator->translate(context.toUtf8().constData(), string.toUtf8().constData()); - if (translation.isEmpty()) - translation = string; - - return translation; -} - QPair DevicePlugin::loadAndVerifyUnit(const QString &unitString) const { if (unitString.isEmpty()) diff --git a/libnymea/plugin/deviceplugin.h b/libnymea/plugin/deviceplugin.h index 5bdeacbd..b3a19389 100644 --- a/libnymea/plugin/deviceplugin.h +++ b/libnymea/plugin/deviceplugin.h @@ -63,9 +63,6 @@ public: QList supportedVendors() const; QList supportedDevices() const; - QTranslator *translator(); - bool setLocale(const QLocale &locale); - virtual void startMonitoringAutoDevices(); virtual DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms); @@ -85,6 +82,8 @@ public: QVariant configValue(const ParamTypeId ¶mTypeId) const; DeviceManager::DeviceError setConfigValue(const ParamTypeId ¶mTypeId, const QVariant &value); + bool isBuiltIn() const; + signals: void emitEvent(const Event &event); void devicesDiscovered(const DeviceClassId &deviceClassId, const QList &deviceDescriptors); @@ -111,8 +110,6 @@ private: // Returns QPair verifyFields(const QStringList &possibleFields, const QStringList &mandatoryFields, const QJsonObject &value) const; - QString translateValue(const QString &context, const QString &string) const; - // load and verify enum values QPair loadAndVerifyUnit(const QString &unitString) const; QPair loadAndVerifyInputType(const QString &inputType) const; @@ -127,7 +124,6 @@ private: static Interface mergeInterfaces(const Interface &iface1, const Interface &iface2); static QStringList generateInterfaceParentList(const QString &interface); - QTranslator *m_translator = nullptr; DeviceManager *m_deviceManager = nullptr; QList m_configurationDescription; diff --git a/libnymea/translator.cpp b/libnymea/translator.cpp new file mode 100644 index 00000000..69c31d0b --- /dev/null +++ b/libnymea/translator.cpp @@ -0,0 +1,134 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library 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 * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "translator.h" +#include "nymeasettings.h" + +#include "loggingcategories.h" +#include "plugin/deviceplugin.h" +#include +#include + +Translator::Translator(DeviceManager *deviceManager): + m_deviceManager(deviceManager) +{ + +} + +Translator::~Translator() +{ + foreach (const TranslatorContext &ctx, m_translatorContexts) { + foreach (QTranslator *t, ctx.translators) { + t->deleteLater(); + } + } + m_translatorContexts.clear(); +} + +QString Translator::translate(const PluginId &pluginId, const QString &string, const QLocale &locale) +{ + DevicePlugin *plugin = m_deviceManager->plugin(pluginId); + + if (!m_translatorContexts.contains(plugin->pluginId()) || !m_translatorContexts.value(plugin->pluginId()).translators.contains(locale.name())) { + loadTranslator(plugin, locale); + } + + QTranslator* translator = m_translatorContexts.value(plugin->pluginId()).translators.value(locale.name()); + QString translatedString = translator->translate(plugin->pluginName().toUtf8(), string.toUtf8()); + return translatedString.isEmpty() ? string : translatedString; +} + +void Translator::loadTranslator(DevicePlugin *plugin, const QLocale &locale) +{ + if (!m_translatorContexts.contains(plugin->pluginId())) { + // Create default translator for this plugin + TranslatorContext defaultCtx; + defaultCtx.pluginId = plugin->pluginId(); + defaultCtx.translators.insert("en_US", new QTranslator()); + m_translatorContexts.insert(plugin->pluginId(), defaultCtx); + if (locale == QLocale("en_US")) { + return; + } + } + + bool loaded = false; + // check if there are local translations + QTranslator* translator = new QTranslator(); + + if (plugin->isBuiltIn()) { + if (translator->load(locale, QCoreApplication::instance()->applicationName(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm")) { + qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath() + "/" + QCoreApplication::applicationName() + "-[" + locale.name() + "].qm"; + loaded = true; + } else if (translator->load(locale, QCoreApplication::instance()->applicationName(), "-", NymeaSettings::translationsPath(), ".qm")) { + qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << NymeaSettings::translationsPath()+ "/" + QCoreApplication::applicationName() + "-[" + locale.name() + "].qm"; + loaded = true; + } + } else { + QString pluginId = plugin->pluginId().toString().remove(QRegExp("[{}]")); + + QStringList searchDirs = QString(qgetenv("NYMEA_PLUGINS_PATH")).split(':'); + searchDirs << QCoreApplication::applicationDirPath() + "/../lib/nymea/plugins"; + searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; + searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/"; + + foreach (const QString &pluginPath, searchDirs) { + if (translator->load(locale, pluginId, "-", QDir(pluginPath + "/translations/").absolutePath(), ".qm")) { + qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(pluginPath + "/translations/").absolutePath(); + loaded = true; + break; + } + foreach (const QString &subdir, QDir(pluginPath).entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + if (translator->load(locale, pluginId, "-", QDir(pluginPath + "/" + subdir + "/translations/").absolutePath(), ".qm")) { + qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(pluginPath + "/" + subdir + "/translations/").absolutePath() + "/" + pluginId + "-[" + locale.name() + "].qm"; + loaded = true; + break; + } + } + if (loaded) { + break; + } + } + + // otherwise use the system translations + if (!loaded && translator->load(locale, pluginId, "-", NymeaSettings::translationsPath(), ".qm")) { + qCDebug(dcTranslations()) << "* Load translation" << locale.name() << "for" << plugin->pluginName() << "from" << NymeaSettings::translationsPath() + "/" + pluginId + "-[" + locale.name() + "].qm"; + loaded = true; + } + + if (!loaded && locale.name() != "en_US") { + qCWarning(dcTranslations()) << "* Could not load translation" << locale.name() << "for plugin" << plugin->pluginName() << "(" << pluginId << ")"; + } + } + + + if (!loaded) { + translator = m_translatorContexts.value(plugin->pluginId()).translators.value("en_US"); + } + + if (!m_translatorContexts.contains(plugin->pluginId())) { + TranslatorContext ctx; + ctx.pluginId = plugin->pluginId(); + m_translatorContexts.insert(plugin->pluginId(), ctx); + } + m_translatorContexts[plugin->pluginId()].translators.insert(locale.name(), translator); + +} diff --git a/libnymea/translator.h b/libnymea/translator.h new file mode 100644 index 00000000..9c000266 --- /dev/null +++ b/libnymea/translator.h @@ -0,0 +1,55 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library 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 * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include "typeutils.h" +#include "types/deviceclass.h" + +#include + +class DevicePlugin; +class DeviceManager; + +class Translator +{ +public: + Translator(DeviceManager *deviceManager); + ~Translator(); + + QString translate(const PluginId &pluginId, const QString &string, const QLocale &locale); + +private: + void loadTranslator(DevicePlugin *plugin, const QLocale &locale); + +private: + DeviceManager *m_deviceManager = nullptr; + + struct TranslatorContext { + PluginId pluginId; + QHash translators; + }; + QHash m_translatorContexts; +}; + +#endif // TRANSLATOR_H diff --git a/libnymea/types/deviceclass.cpp b/libnymea/types/deviceclass.cpp index 912381da..80b31f8d 100644 --- a/libnymea/types/deviceclass.cpp +++ b/libnymea/types/deviceclass.cpp @@ -485,3 +485,9 @@ QStringList DeviceClass::mandatoryTypeProperties() { return QStringList() << "id" << "name" << "displayName"; } + +QDebug operator<<(QDebug &dbg, const DeviceClass &deviceClass) +{ + dbg << "DeviceClass ID:" << deviceClass.id() << "Name:" << deviceClass.name(); + return dbg; +} diff --git a/libnymea/types/deviceclass.h b/libnymea/types/deviceclass.h index 1e2171ea..43f1eb97 100644 --- a/libnymea/types/deviceclass.h +++ b/libnymea/types/deviceclass.h @@ -207,4 +207,6 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(DeviceClass::CreateMethods) +QDebug operator<<(QDebug &dbg, const DeviceClass &deviceClass); + #endif diff --git a/libnymea/types/vendor.cpp b/libnymea/types/vendor.cpp index f56b5ba0..ada2ecdd 100644 --- a/libnymea/types/vendor.cpp +++ b/libnymea/types/vendor.cpp @@ -74,3 +74,8 @@ void Vendor::setDisplayName(const QString &displayName) { m_displayName = displayName; } + +bool Vendor::operator==(const Vendor &other) const +{ + return m_id == other.id(); +} diff --git a/libnymea/types/vendor.h b/libnymea/types/vendor.h index d1283d90..7521aa69 100644 --- a/libnymea/types/vendor.h +++ b/libnymea/types/vendor.h @@ -43,6 +43,8 @@ public: QString displayName() const; void setDisplayName(const QString &displayName); + bool operator==(const Vendor &other) const; + private: VendorId m_id; QString m_name; diff --git a/nymea.pri b/nymea.pri index 60872a70..c3f55acf 100644 --- a/nymea.pri +++ b/nymea.pri @@ -6,7 +6,7 @@ NYMEA_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/ # define protocol versions JSON_PROTOCOL_VERSION_MAJOR=1 -JSON_PROTOCOL_VERSION_MINOR=13 +JSON_PROTOCOL_VERSION_MINOR=14 REST_API_VERSION=1 COPYRIGHT_YEAR_FROM=2013 diff --git a/nymea.pro b/nymea.pro index 3b89712c..86fb8226 100644 --- a/nymea.pro +++ b/nymea.pro @@ -23,19 +23,22 @@ test.commands = LD_LIBRARY_PATH=$$top_builddir/libnymea-core:$$top_builddir/libn # Translations: # make lupdate to update .ts files -TRANSLATIONS += $$files(translations/*.ts, true) -TRANSLATIONS += $$files(plugins/mock/translations/*.ts, true) +CORE_TRANSLATIONS += $$files($${top_srcdir}/translations/*.ts, true) +lupdate.commands = lupdate -recursive -no-obsolete $${top_srcdir} -ts $${CORE_TRANSLATIONS}; +PLUGIN_TRANSLATIONS += $$files($${top_srcdir}/plugins/mock/translations/*.ts, true) +lupdate.commands += lupdate -recursive -no-obsolete $${top_builddir}/plugins/mock/ -ts $${PLUGIN_TRANSLATIONS}; lupdate.depends = FORCE -lupdate.commands = lupdate -recursive -no-obsolete $$_FILE_; +TRANSLATIONS = $${CORE_TRANSLATIONS} $${PLUGIN_TRANSLATIONS} # make lrelease to compile .ts to .qm lrelease.depends = FORCE lrelease.commands = lrelease $$_FILE_; \ - rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/; + rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/; \ + rsync -a $$top_srcdir/plugins/mock/translations/*.qm $$top_builddir/plugins/mock/translations/; +first.depends = $(first) lrelease # Install translation files translations.path = /usr/share/nymea/translations -translations.files = $$[QT_SOURCE_TREE]/translations/*.qm translations.depends = lrelease INSTALLS += translations diff --git a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts index 09c28f96..81d12e9b 100644 --- a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts +++ b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts @@ -2,523 +2,748 @@ - CloudNotifications + mockDevice - - - Cloud Notifications + Mock Devices + The name of the plugin mockDevice (727a4a9a-c187-446f-aadf-f1b2220607d1) - - User ID + configParamInt + The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: e1f72121-a426-45e2-b475-8262b5cdf103) - - Device + configParamBool + The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: c75723b6-ea4f-4982-9751-6c5e39c88145) - - Title + guh GmbH + The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6) - - Message text + Mock Device + The name of the DeviceClass (753f0d32-0468-4d08-82ed-1964aab03298) - - Send notification - - - - - connected - - - - - Connected changed - - - - - DevicePluginMock - - - Display pin!! The pin is 243681 - Pin anzeigen!! Der pin lautet 243581 - - - - SimplePushButtonHandler - - - If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus. - - - - - nymea - - - -nymea is an open source IoT (Internet of Things) server, -which allows to control a lot of different devices from many different -manufacturers. With the powerful rule engine you are able to connect any -device available in the system and create individual scenes and behaviors -for your environment. - - - - - - - Run nymead in the foreground, not as daemon. - - - - - Debug categories to enable. Prefix with "No" to disable. Suffix with "Warnings" to address warnings. -Examples: --d AWSTraffic --d NoDeviceManager --d NoBluetoothWarnings - -Categories are: - - - - - Enables all debug categories except *Traffic and *Debug categories. Single debug categories can be disabled again with -d parameter. - - - - - Specify a log file to write to, if this option is not specified, logs will be printed to the standard output. - - - - - If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus. - - - - - No such debug category: - - - - - nymeaserver::DebugServerHandler - - - - Debug nymea - The header title of the debug server interface - - - - - nymea debug interface - The main title of the debug server interface - - - - - Information - The name of the section tab in the debug server interface - - - - - - Network - The name of the section tab in the debug server interface + http port + The name of the ParamType (DeviceClass: mock, Type: device, ID: d4f06047-125e-4479-9810-b54c189917f5) ---------- -The network section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: d4f06047-125e-4479-9810-b54c189917f5) - - Welcome to the debug interface. - The welcome message of the debug interface - - - - - This debug interface was designed to provide an easy possibility to get helpful information about the running nymea server. - - - - - Be aware that this debug interface is a security risk and could offer access to sensible data. - The warning message of the debug interface - - - - - Server information - The server information section of the debug interface - - - - - User - The user name in the server infromation section of the debug interface - - - - - Compiled with Qt version - The Qt build version description in the server infromation section of the debug interface - - - - - Qt runtime version - The Qt runtime version description in the server infromation section of the debug interface - - - - - Command - The command description in the server infromation section of the debug interface - - - - - Snap name - The snap name description in the server infromation section of the debug interface - - - - - Snap version - The snap version description in the server infromation section of the debug interface - - - - - Snap directory - The snap directory description in the server infromation section of the debug interface - - - - - Snap application data - The snap application data description in the server infromation section of the debug interface - - - - - Snap user data - The snap user data description in the server infromation section of the debug interface - - - - - Snap common data - The snap common data description in the server infromation section of the debug interface - - - - - Server name - The server name description in the server infromation section of the debug interface - - - - - Server version - The server version description in the server infromation section of the debug interface - - - - - JSON-RPC version - The API version description in the server infromation section of the debug interface - - - - - Language - The language description in the server infromation section of the debug interface - - - - - Timezone - The timezone description in the server infromation section of the debug interface - - - - - Server UUID - The server id description in the server infromation section of the debug interface - - - - - Settings path - The settings path description in the server infromation section of the debug interface - - - - - Translations path - The translation path description in the server infromation section of the debug interface - - - - - Generate report - In the server information section of the debug interface - - - - - If you want to provide all the debug information to a developer, you can generate a report file, which contains all information needed for reproducing a system and get information about possible problems. - - - - - Do not share these generated information public, since they can contain sensible data and should be shared very carefully and only with people you trust! - The warning message of the debug interface - - - - - Generate report file - The generate debug report button text of the debug interface - - - - - Log database - The log databse download description of the debug interface - - - - - Plugin paths - The plugins path description in the server infromation section of the debug interface - - - - - - Downloads - The name of the section tab in the debug server interface + async + The name of the ParamType (DeviceClass: mock, Type: device, ID: f2977061-4dd0-4ef5-85aa-3b7134743be3) ---------- -The downloads section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: f2977061-4dd0-4ef5-85aa-3b7134743be3) - - - Logs - The name of the section tab in the debug server interface + broken + The name of the ParamType (DeviceClass: mock, Type: device, ID: ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) ---------- -The download logs section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) - - - - - - - - - - Download - The download button description of the debug interface + resultCount + The name of the ParamType (DeviceClass: mock, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) +---------- +The name of the ParamType (DeviceClass: mockPushButton, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) +---------- +The name of the ParamType (DeviceClass: mockDisplayPin, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) - - System logs - The syslog download description of the debug interface + Dummy int state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83) +---------- +The name of the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83) - - - - - - - - - Show + Dummy int state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83 +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83 - - Settings - The settings download section title of the debug interface + Dummy bool state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: bool, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310) +---------- +The name of the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: boolValue, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310) - - nymead settings - The nymead settings download description of the debug interface + Dummy bool state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: bool, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310 +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: boolValue, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310 - - Device settings - The device settings download description of the debug interface + Dummy double state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: double, ID: 7cac53ee-7048-4dc9-b000-7b585390f34c) - - Device states settings - The device states settings download description of the debug interface + Dummy double state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: double, ID: 7cac53ee-7048-4dc9-b000-7b585390f34c - - Rules settings - The rules settings download description of the debug interface + battery level + The name of the autocreated EventType (DeviceClass: mock, StateType: batteryLevel, ID: 6c8ab9a6-0164-4795-b829-f4394fe4edc4) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: batteryLevel, ID: 6c8ab9a6-0164-4795-b829-f4394fe4edc4 - - Plugins settings - The plugins settings download description of the debug interface + battery level critical + The name of the autocreated EventType (DeviceClass: mock, StateType: batteryCritical, ID: 580bc611-1a55-41f3-996f-8d3ccf543db3) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: batteryCritical, ID: 580bc611-1a55-41f3-996f-8d3ccf543db3 - - Tag settings - The tag settings download description of the debug interface + powered changed + The name of the autocreated EventType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - MQTT policies - The MQTT policies download description of the debug interface + powered + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - This section allows you to perform different network connectivity tests in order to find out if the device where nymea is running has full network connectivity. - The network section description of the debug interface + set power + The name of the autocreated ActionType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - Ping - The ping section of the debug interface + Mock Action 1 (with params) + The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass mock +---------- +The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass mockDeviceAuto - - This test makes four ping attempts to the nymea.io server. + mockActionParam1 + The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: a2d3a256-a551-4712-a65b-ecd5a436a1cb) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: a2d3a256-a551-4712-a65b-ecd5a436a1cb) - - Start ping test - The ping button text of the debug interface + mockActionParam2 + The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: 304a4899-18be-4e3b-94f4-d03be52f3233) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: 304a4899-18be-4e3b-94f4-d03be52f3233) - - DNS lookup - The DNS lookup section of the debug interface + Mock Action 2 (without params) + The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass mock +---------- +The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass mockDeviceAuto - - This test makes a dynamic name server lookup for nymea.io. + Mock Action 3 (async) + The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass mock +---------- +The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass mockDeviceAuto - - Start DNS lookup test - The ping button text of the debug interface + Mock Action 4 (broken) + The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass mock +---------- +The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass mockDeviceAuto - - Trace path - The trace section of the debug interface + Mock Action 5 (async, broken) + The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass mock +---------- +The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass mockDeviceAuto - - This test showes the trace path from the nymea device to the nymea.io server. + Mock Event 1 + The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass mock +---------- +The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass mockDeviceAuto - - Start trace path test - The trace path button text of the debug interface + Mock Event 2 + The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass mock +---------- +The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass mockDeviceAuto - - Server live logs - The network section of the debug interface + mockParamInt + The name of the ParamType (DeviceClass: mock, EventType: mockEvent2, ID: 0550e16d-60b9-4ba5-83f4-4d3cee656121) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, EventType: event2, ID: 0550e16d-60b9-4ba5-83f4-4d3cee656121) - - This section allowes you to see the live logs of the nymea server. + Mock Device (Auto created) + The name of the DeviceClass (ab4257b3-7548-47ee-9bd4-7dc3004fd197) + Mock Gerät (Automatisch erzeugt) + + + Wait 3 second before you continue, the push button will be pressed automatically. + The pairing info of deviceClass mockPushButton - - Start logs - The connect button for the log stream of the debug interface + Mock Device (Push Button) + The name of the DeviceClass (9e03144c-e436-4eea-82d9-ccb33ef778db) - - - Released under the GNU GENERAL PUBLIC LICENSE Version 2. - The footer license note of the debug interface + color changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) - - Error %1 - The HTTP error message of the debug interface. The %1 represents the error code ie.e 404 + color + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) - - - - - - - - - - Could not find file "%1". - The HTTP error message of the debug interface. The %1 represents the file name. + Set color + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) - - - - - - - - - - Could not open file "%1". - The HTTP error message of the debug interface. The %1 represents the file name. + percentage changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + percentage + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + Set percentage + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + allowed values changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + allowed values + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + Set allowed values + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + double value changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + double value + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + Set double value + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + bool value changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated EventType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the autocreated EventType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + bool value + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + Set bool value + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated ActionType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the autocreated ActionType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + Timeout action + The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass mockPushButton +---------- +The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass mockDisplayPin + + + + Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681. + The pairing info of deviceClass mockDisplayPin + + + + Mock Device (Display Pin) + The name of the DeviceClass (296f1fd4-e893-46b2-8a42-50d1bceb8730) + + + + pin + The name of the ParamType (DeviceClass: mockDisplayPin, Type: device, ID: da820e07-22dc-4173-9c07-2f49a4e265f9) + + + + Mock Device (Parent) + The name of the DeviceClass (a71fbde9-9a38-4bf8-beab-c8aade2608ba) + + + + Mock Device (Child) + The name of the DeviceClass (40893c9f-bc47-40c1-8bf7-b390c7c1b4fc) + + + + Mock Device (InputTypes) + The name of the DeviceClass (515ffdf1-55e5-498d-9abc-4e2fe768f3a9) + + + + Text line + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e6acf0c7-4b8e-4296-ac62-855d20deb816) + + + + Text area + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 716f0994-bc01-42b0-b64d-59236f7320d2) + + + + Password text + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e5c0d14b-c9f1-4aca-a56e-85bfa6977150) + + + + Search text + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 22add8c9-ee4f-43ad-8931-58e999313ac3) + + + + Mail address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: a8494faf-3a0f-4cf3-84b7-4b39148a838d) + + + + IPv4 address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 9e5f86a0-4bb3-4892-bff8-3fc4032af6e2) + + + + IPv6 address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 43bf3832-dd48-4090-a836-656e8b60216e) + + + + URL + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: fa67229f-fcef-496f-b671-59a4b48f3ab5) + + + + Mac address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e93db587-7919-48f3-8c88-1651de63c765) + + + + Bool changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: bool, ID: 3bad3a09-5826-4ed7-a832-10e3e2ee2a7d) + + + + Bool + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: bool, ID: 3bad3a09-5826-4ed7-a832-10e3e2ee2a7d + + + + Writable Bool changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Writable Bool + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Set Writable Bool + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Int changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: int, ID: d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb) + + + + Int + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: int, ID: d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb + + + + Writable Int changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Writable Int + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Set Writable Int + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Writable Int (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + Writable Int (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + Set Writable Int (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + UInt changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: uint, ID: 19e74fcc-bfd5-491f-8eb6-af128e8f1162) + + + + UInt + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: uint, ID: 19e74fcc-bfd5-491f-8eb6-af128e8f1162 + + + + Writable UInt changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Writable UInt + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Set Writable UInt + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Writable UInt (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Writable UInt (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Set Writable UInt (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Double changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: double, ID: f7d2063d-959e-46ac-8568-8b99722d3b22) + + + + Double + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: double, ID: f7d2063d-959e-46ac-8568-8b99722d3b22 + + + + Writable Double changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Writable Double + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Set Writable Double + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Writable Double (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + Writable Double (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + Set Writable Double (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + String changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: string, ID: 27f69ca9-a321-40ff-bfee-4b0272a671b4) + + + + String + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: string, ID: 27f69ca9-a321-40ff-bfee-4b0272a671b4 + + + + Writable String changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Writable String + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Set Writable String + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Writable String (selection) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Writable String (selection) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Set Writable String (selection) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Color changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: color, ID: 4507d5c6-b692-4bd6-87f2-00364bc0cb4d) + + + + Color + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: color, ID: 4507d5c6-b692-4bd6-87f2-00364bc0cb4d + + + + Writable Color changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Writable Color + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Set Writable Color + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Time changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: time, ID: 8250c71e-59bc-41ab-b576-99fcfc34e8d1) + + + + Time + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: time, ID: 8250c71e-59bc-41ab-b576-99fcfc34e8d1 + + + + Writable Time changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Writable Time + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Set Writable Time + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Timestamp (Int) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: timestampInt, ID: 2c91b5ef-c2d1-4367-bc65-5a13abf69641) + + + + Timestamp (Int) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: timestampInt, ID: 2c91b5ef-c2d1-4367-bc65-5a13abf69641 + + + + Writable Timestamp (Int) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Writable Timestamp (Int) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Set Writable Timestamp (Int) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Timestamp (UInt) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: timestampUInt, ID: 6c9a96e8-0d48-4f42-8967-848358fd7f79) + + + + Timestamp (UInt) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: timestampUInt, ID: 6c9a96e8-0d48-4f42-8967-848358fd7f79 + + + + Writable Timestamp (UInt) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) + + + + Writable Timestamp (UInt) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) + + + + Set Writable Timestamp (UInt) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) diff --git a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts index f2b93d60..24941460 100644 --- a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts +++ b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts @@ -2,523 +2,748 @@ - CloudNotifications + mockDevice - - - Cloud Notifications + Mock Devices + The name of the plugin mockDevice (727a4a9a-c187-446f-aadf-f1b2220607d1) - - User ID + configParamInt + The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: e1f72121-a426-45e2-b475-8262b5cdf103) - - Device + configParamBool + The name of the ParamType (DeviceClass: mockDevice, Type: plugin, ID: c75723b6-ea4f-4982-9751-6c5e39c88145) - - Title + guh GmbH + The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6) - - Message text + Mock Device + The name of the DeviceClass (753f0d32-0468-4d08-82ed-1964aab03298) - - Send notification - - - - - connected - - - - - Connected changed - - - - - DevicePluginMock - - - Display pin!! The pin is 243681 - - - - - SimplePushButtonHandler - - - If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus. - - - - - nymea - - - -nymea is an open source IoT (Internet of Things) server, -which allows to control a lot of different devices from many different -manufacturers. With the powerful rule engine you are able to connect any -device available in the system and create individual scenes and behaviors -for your environment. - - - - - - - Run nymead in the foreground, not as daemon. - - - - - Debug categories to enable. Prefix with "No" to disable. Suffix with "Warnings" to address warnings. -Examples: --d AWSTraffic --d NoDeviceManager --d NoBluetoothWarnings - -Categories are: - - - - - Enables all debug categories except *Traffic and *Debug categories. Single debug categories can be disabled again with -d parameter. - - - - - Specify a log file to write to, if this option is not specified, logs will be printed to the standard output. - - - - - If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus. - - - - - No such debug category: - - - - - nymeaserver::DebugServerHandler - - - - Debug nymea - The header title of the debug server interface - - - - - nymea debug interface - The main title of the debug server interface - - - - - Information - The name of the section tab in the debug server interface - - - - - - Network - The name of the section tab in the debug server interface + http port + The name of the ParamType (DeviceClass: mock, Type: device, ID: d4f06047-125e-4479-9810-b54c189917f5) ---------- -The network section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: d4f06047-125e-4479-9810-b54c189917f5) - - Welcome to the debug interface. - The welcome message of the debug interface - - - - - This debug interface was designed to provide an easy possibility to get helpful information about the running nymea server. - - - - - Be aware that this debug interface is a security risk and could offer access to sensible data. - The warning message of the debug interface - - - - - Server information - The server information section of the debug interface - - - - - User - The user name in the server infromation section of the debug interface - - - - - Compiled with Qt version - The Qt build version description in the server infromation section of the debug interface - - - - - Qt runtime version - The Qt runtime version description in the server infromation section of the debug interface - - - - - Command - The command description in the server infromation section of the debug interface - - - - - Snap name - The snap name description in the server infromation section of the debug interface - - - - - Snap version - The snap version description in the server infromation section of the debug interface - - - - - Snap directory - The snap directory description in the server infromation section of the debug interface - - - - - Snap application data - The snap application data description in the server infromation section of the debug interface - - - - - Snap user data - The snap user data description in the server infromation section of the debug interface - - - - - Snap common data - The snap common data description in the server infromation section of the debug interface - - - - - Server name - The server name description in the server infromation section of the debug interface - - - - - Server version - The server version description in the server infromation section of the debug interface - - - - - JSON-RPC version - The API version description in the server infromation section of the debug interface - - - - - Language - The language description in the server infromation section of the debug interface - - - - - Timezone - The timezone description in the server infromation section of the debug interface - - - - - Server UUID - The server id description in the server infromation section of the debug interface - - - - - Settings path - The settings path description in the server infromation section of the debug interface - - - - - Translations path - The translation path description in the server infromation section of the debug interface - - - - - Generate report - In the server information section of the debug interface - - - - - If you want to provide all the debug information to a developer, you can generate a report file, which contains all information needed for reproducing a system and get information about possible problems. - - - - - Do not share these generated information public, since they can contain sensible data and should be shared very carefully and only with people you trust! - The warning message of the debug interface - - - - - Generate report file - The generate debug report button text of the debug interface - - - - - Log database - The log databse download description of the debug interface - - - - - Plugin paths - The plugins path description in the server infromation section of the debug interface - - - - - - Downloads - The name of the section tab in the debug server interface + async + The name of the ParamType (DeviceClass: mock, Type: device, ID: f2977061-4dd0-4ef5-85aa-3b7134743be3) ---------- -The downloads section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: f2977061-4dd0-4ef5-85aa-3b7134743be3) - - - Logs - The name of the section tab in the debug server interface + broken + The name of the ParamType (DeviceClass: mock, Type: device, ID: ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) ---------- -The download logs section of the debug interface +The name of the ParamType (DeviceClass: mockDeviceAuto, Type: device, ID: ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) - - - - - - - - - - Download - The download button description of the debug interface + resultCount + The name of the ParamType (DeviceClass: mock, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) +---------- +The name of the ParamType (DeviceClass: mockPushButton, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) +---------- +The name of the ParamType (DeviceClass: mockDisplayPin, Type: discovery, ID: d222adb4-2f9c-4c3f-8655-76400d0fb6ce) - - System logs - The syslog download description of the debug interface + Dummy int state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83) +---------- +The name of the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83) - - - - - - - - - Show + Dummy int state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83 +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: int, ID: 80baec19-54de-4948-ac46-31eabfaceb83 - - Settings - The settings download section title of the debug interface + Dummy bool state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: bool, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310) +---------- +The name of the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: boolValue, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310) - - nymead settings - The nymead settings download description of the debug interface + Dummy bool state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: bool, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310 +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDeviceAuto, StateType: boolValue, ID: 9dd6a97c-dfd1-43dc-acbd-367932742310 - - Device settings - The device settings download description of the debug interface + Dummy double state changed + The name of the autocreated EventType (DeviceClass: mock, StateType: double, ID: 7cac53ee-7048-4dc9-b000-7b585390f34c) - - Device states settings - The device states settings download description of the debug interface + Dummy double state + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: double, ID: 7cac53ee-7048-4dc9-b000-7b585390f34c - - Rules settings - The rules settings download description of the debug interface + battery level + The name of the autocreated EventType (DeviceClass: mock, StateType: batteryLevel, ID: 6c8ab9a6-0164-4795-b829-f4394fe4edc4) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: batteryLevel, ID: 6c8ab9a6-0164-4795-b829-f4394fe4edc4 - - Plugins settings - The plugins settings download description of the debug interface + battery level critical + The name of the autocreated EventType (DeviceClass: mock, StateType: batteryCritical, ID: 580bc611-1a55-41f3-996f-8d3ccf543db3) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: batteryCritical, ID: 580bc611-1a55-41f3-996f-8d3ccf543db3 - - Tag settings - The tag settings download description of the debug interface + powered changed + The name of the autocreated EventType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - MQTT policies - The MQTT policies download description of the debug interface + powered + The name of the ParamType for the autocreated EventType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - This section allows you to perform different network connectivity tests in order to find out if the device where nymea is running has full network connectivity. - The network section description of the debug interface + set power + The name of the autocreated ActionType (DeviceClass: mock, StateType: power, ID: 064aed0d-da4c-49d4-b236-60f97e98ff84) - - Ping - The ping section of the debug interface + Mock Action 1 (with params) + The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass mock +---------- +The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass mockDeviceAuto - - This test makes four ping attempts to the nymea.io server. + mockActionParam1 + The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: a2d3a256-a551-4712-a65b-ecd5a436a1cb) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: a2d3a256-a551-4712-a65b-ecd5a436a1cb) - - Start ping test - The ping button text of the debug interface + mockActionParam2 + The name of the ParamType (DeviceClass: mock, ActionType: withParams, ID: 304a4899-18be-4e3b-94f4-d03be52f3233) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, ActionType: withParams, ID: 304a4899-18be-4e3b-94f4-d03be52f3233) - - DNS lookup - The DNS lookup section of the debug interface + Mock Action 2 (without params) + The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass mock +---------- +The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass mockDeviceAuto - - This test makes a dynamic name server lookup for nymea.io. + Mock Action 3 (async) + The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass mock +---------- +The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass mockDeviceAuto - - Start DNS lookup test - The ping button text of the debug interface + Mock Action 4 (broken) + The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass mock +---------- +The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass mockDeviceAuto - - Trace path - The trace section of the debug interface + Mock Action 5 (async, broken) + The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass mock +---------- +The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass mockDeviceAuto - - This test showes the trace path from the nymea device to the nymea.io server. + Mock Event 1 + The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass mock +---------- +The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass mockDeviceAuto - - Start trace path test - The trace path button text of the debug interface + Mock Event 2 + The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass mock +---------- +The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass mockDeviceAuto - - Server live logs - The network section of the debug interface + mockParamInt + The name of the ParamType (DeviceClass: mock, EventType: mockEvent2, ID: 0550e16d-60b9-4ba5-83f4-4d3cee656121) +---------- +The name of the ParamType (DeviceClass: mockDeviceAuto, EventType: event2, ID: 0550e16d-60b9-4ba5-83f4-4d3cee656121) - - This section allowes you to see the live logs of the nymea server. + Mock Device (Auto created) + The name of the DeviceClass (ab4257b3-7548-47ee-9bd4-7dc3004fd197) - - Start logs - The connect button for the log stream of the debug interface + Wait 3 second before you continue, the push button will be pressed automatically. + The pairing info of deviceClass mockPushButton - - - Released under the GNU GENERAL PUBLIC LICENSE Version 2. - The footer license note of the debug interface + Mock Device (Push Button) + The name of the DeviceClass (9e03144c-e436-4eea-82d9-ccb33ef778db) - - Error %1 - The HTTP error message of the debug interface. The %1 represents the error code ie.e 404 + color changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) - - - - - - - - - - Could not find file "%1". - The HTTP error message of the debug interface. The %1 represents the file name. + color + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) - - - - - - - - - - Could not open file "%1". - The HTTP error message of the debug interface. The %1 represents the file name. + Set color + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: color, ID: 20dc7c22-c50e-42db-837c-2bbced939f8e) + + + + percentage changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + percentage + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + Set percentage + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: percentage, ID: 72981c04-267a-4ba0-a59e-9921d2f3af9c) + + + + allowed values changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + allowed values + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + Set allowed values + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: allowedValues, ID: 05f63f9c-f61e-4dcf-ad55-3f13fde2765b) + + + + double value changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + double value + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + Set double value + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: double, ID: 53cd7c55-49b7-441b-b970-9048f20f0e2c) + + + + bool value changed + The name of the autocreated EventType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated EventType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated EventType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the autocreated EventType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + bool value + The name of the ParamType for the autocreated EventType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the ParamType for the autocreated EventType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + Set bool value + The name of the autocreated ActionType (DeviceClass: mockPushButton, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated ActionType (DeviceClass: mockDisplayPin, StateType: bool, ID: e680f7a4-b39e-46da-be41-fa3170fe3768) +---------- +The name of the autocreated ActionType (DeviceClass: mockParent, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) +---------- +The name of the autocreated ActionType (DeviceClass: mockChild, StateType: boolValue, ID: d24ede5f-4064-4898-bb84-cfb533b1fbc0) + + + + Timeout action + The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass mockPushButton +---------- +The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass mockDisplayPin + + + + Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681. + The pairing info of deviceClass mockDisplayPin + + + + Mock Device (Display Pin) + The name of the DeviceClass (296f1fd4-e893-46b2-8a42-50d1bceb8730) + + + + pin + The name of the ParamType (DeviceClass: mockDisplayPin, Type: device, ID: da820e07-22dc-4173-9c07-2f49a4e265f9) + + + + Mock Device (Parent) + The name of the DeviceClass (a71fbde9-9a38-4bf8-beab-c8aade2608ba) + + + + Mock Device (Child) + The name of the DeviceClass (40893c9f-bc47-40c1-8bf7-b390c7c1b4fc) + + + + Mock Device (InputTypes) + The name of the DeviceClass (515ffdf1-55e5-498d-9abc-4e2fe768f3a9) + + + + Text line + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e6acf0c7-4b8e-4296-ac62-855d20deb816) + + + + Text area + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 716f0994-bc01-42b0-b64d-59236f7320d2) + + + + Password text + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e5c0d14b-c9f1-4aca-a56e-85bfa6977150) + + + + Search text + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 22add8c9-ee4f-43ad-8931-58e999313ac3) + + + + Mail address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: a8494faf-3a0f-4cf3-84b7-4b39148a838d) + + + + IPv4 address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 9e5f86a0-4bb3-4892-bff8-3fc4032af6e2) + + + + IPv6 address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: 43bf3832-dd48-4090-a836-656e8b60216e) + + + + URL + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: fa67229f-fcef-496f-b671-59a4b48f3ab5) + + + + Mac address + The name of the ParamType (DeviceClass: mockInputType, Type: device, ID: e93db587-7919-48f3-8c88-1651de63c765) + + + + Bool changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: bool, ID: 3bad3a09-5826-4ed7-a832-10e3e2ee2a7d) + + + + Bool + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: bool, ID: 3bad3a09-5826-4ed7-a832-10e3e2ee2a7d + + + + Writable Bool changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Writable Bool + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Set Writable Bool + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableBool, ID: a7c11774-f31f-4d64-99d1-e0ae5fb35a5c) + + + + Int changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: int, ID: d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb) + + + + Int + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: int, ID: d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb + + + + Writable Int changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Writable Int + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Set Writable Int + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableInt, ID: 857a8422-983c-47d6-a15f-d8450b3162f7) + + + + Writable Int (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + Writable Int (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + Set Writable Int (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableIntMinMax, ID: 86a107bc-510a-4d38-bfeb-0a9c2b6d8d87) + + + + UInt changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: uint, ID: 19e74fcc-bfd5-491f-8eb6-af128e8f1162) + + + + UInt + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: uint, ID: 19e74fcc-bfd5-491f-8eb6-af128e8f1162 + + + + Writable UInt changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Writable UInt + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Set Writable UInt + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUInt, ID: 563e9c4c-5198-400a-9f6c-358f4752af58) + + + + Writable UInt (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Writable UInt (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Set Writable UInt (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableUIntMinMax, ID: 79238998-eaab-4d71-b406-5d78f1749751) + + + + Double changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: double, ID: f7d2063d-959e-46ac-8568-8b99722d3b22) + + + + Double + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: double, ID: f7d2063d-959e-46ac-8568-8b99722d3b22 + + + + Writable Double changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Writable Double + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Set Writable Double + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDouble, ID: 8e2eb91b-d60b-4461-9a50-d7b8ad263170) + + + + Writable Double (min/max) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + Writable Double (min/max) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + Set Writable Double (min/max) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableDoubleMinMax, ID: 00d3425e-1da6-4748-8906-4555ceefb136) + + + + String changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: string, ID: 27f69ca9-a321-40ff-bfee-4b0272a671b4) + + + + String + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: string, ID: 27f69ca9-a321-40ff-bfee-4b0272a671b4 + + + + Writable String changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Writable String + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Set Writable String + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableString, ID: ef511043-bd1a-4a5f-984c-222b7da43f38) + + + + Writable String (selection) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Writable String (selection) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Set Writable String (selection) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableStringSelection, ID: 209d7afc-6fe9-4fe9-939b-e472ea0ad639) + + + + Color changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: color, ID: 4507d5c6-b692-4bd6-87f2-00364bc0cb4d) + + + + Color + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: color, ID: 4507d5c6-b692-4bd6-87f2-00364bc0cb4d + + + + Writable Color changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Writable Color + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Set Writable Color + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableColor, ID: 455f4f68-3cb0-4e8a-a707-62e4a2a8035c) + + + + Time changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: time, ID: 8250c71e-59bc-41ab-b576-99fcfc34e8d1) + + + + Time + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: time, ID: 8250c71e-59bc-41ab-b576-99fcfc34e8d1 + + + + Writable Time changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Writable Time + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Set Writable Time + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTime, ID: d64c8b3f-ca7d-47f6-b271-867ffd80a4d4) + + + + Timestamp (Int) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: timestampInt, ID: 2c91b5ef-c2d1-4367-bc65-5a13abf69641) + + + + Timestamp (Int) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: timestampInt, ID: 2c91b5ef-c2d1-4367-bc65-5a13abf69641 + + + + Writable Timestamp (Int) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Writable Timestamp (Int) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2 +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Set Writable Timestamp (Int) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampInt, ID: 88b6746a-b009-4df6-8986-d7884ffd94b2) + + + + Timestamp (UInt) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: timestampUInt, ID: 6c9a96e8-0d48-4f42-8967-848358fd7f79) + + + + Timestamp (UInt) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: timestampUInt, ID: 6c9a96e8-0d48-4f42-8967-848358fd7f79 + + + + Writable Timestamp (UInt) changed + The name of the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) + + + + Writable Timestamp (UInt) + The name of the ParamType for the autocreated EventType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee +---------- +The name of the ParamType for the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) + + + + Set Writable Timestamp (UInt) + The name of the autocreated ActionType (DeviceClass: mockInputType, StateType: writableTimestampUInt, ID: 45d0069a-63ac-4265-8170-8152778608ee) diff --git a/plugins/plugins.pri b/plugins/plugins.pri index 48bd0855..0938aec8 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -3,7 +3,7 @@ include(../nymea.pri) TEMPLATE = lib CONFIG += plugin -QT += network bluetooth +QT += network INCLUDEPATH += $$top_srcdir/libnymea LIBS += -L../../libnymea -lnymea diff --git a/server/main.cpp b/server/main.cpp index dce5a2b2..fa40b3bc 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -131,7 +131,8 @@ int main(int argc, char *argv[]) "AWSTraffic", "BluetoothServer", "BluetoothServerTraffic", - "Mqtt" + "Mqtt", + "Translations" }; QStringList loggingFiltersPlugins; @@ -145,7 +146,7 @@ int main(int argc, char *argv[]) // check if there are local translations if (!translator.load(QLocale::system(), application.applicationName(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm")) if (!translator.load(QLocale::system(), application.applicationName(), "-", NymeaSettings::translationsPath(), ".qm")) - qWarning(dcApplication()) << "Could not find nymead translations for" << QLocale::system().name() << endl << (QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath()) << endl << NymeaSettings::translationsPath(); + qWarning(dcTranslations()) << "Could not find nymead translations for" << QLocale::system().name() << endl << (QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath()) << endl << NymeaSettings::translationsPath(); diff --git a/tests/auto/api.json b/tests/auto/api.json index dbbb1d3b..ec176e34 100644 --- a/tests/auto/api.json +++ b/tests/auto/api.json @@ -1,4 +1,4 @@ -1.13 +1.14 { "methods": { "Actions.ExecuteAction": { @@ -78,7 +78,7 @@ } }, "Configuration.GetAvailableLanguages": { - "description": "Returns a list of locale codes available for the server. i.e. en_US, de_AT", + "description": "DEPRECATED - Use the locale property in the Handshake message instead - Returns a list of locale codes available for the server. i.e. en_US, de_AT", "params": { }, "returns": { @@ -163,7 +163,7 @@ } }, "Configuration.SetLanguage": { - "description": "Sets the server language to the given language. See also: \"GetAvailableLanguages\"", + "description": "DEPRECATED - Use the locale property in the Handshake message instead - Sets the server language to the given language. See also: \"GetAvailableLanguages\"", "params": { "language": "String" }, @@ -492,14 +492,16 @@ } }, "JSONRPC.Hello": { - "description": "Upon first connection, nymea will automatically send a welcome message containing information about the setup. If this message is lost for whatever reason (connections with multiple hops might drop this if nymea sends it too early), the exact same message can be retrieved multiple times by calling this Hello method. Note that the contents might change if the system changed its state in the meantime, e.g. initialSetupRequired might turn false if the initial setup has been performed in the meantime.", + "description": "Initiates a connection. Use this method to perform an initial handshake of the connection. Optionally, a parameter \"locale\" is can be passed to set up the used locale for this connection. Strings such as DeviceClass displayNames etc will be localized to this locale. If this parameter is omitted, the default system locale (depending on the configuration) is used. The reply of this method contains information about this core instance such as version information, uuid and its name. The locale valueindicates the locale used for this connection. Note: This method can be called multiple times. The locale used in the last call for this connection will be used. Other values, like initialSetupRequired might change if the setup has been performed in the meantime.", "params": { + "o:locale": "String" }, "returns": { "authenticationRequired": "Bool", "id": "Int", "initialSetupRequired": "Bool", "language": "String", + "locale": "String", "name": "String", "protocol version": "String", "pushButtonAuthAvailable": "Bool", diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index 4bc529b7..07c5e4cf 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -35,6 +35,8 @@ private slots: void testHandshake(); + void testHandshakeLocale(); + void testInitialSetup(); void testRevokeToken(); @@ -131,7 +133,9 @@ void TestJSONRPC::initTestCase() { NymeaTestBase::initTestCase(); QLoggingCategory::setFilterRules("*.debug=false\n" - "JsonRpc*.debug=true"); +// "JsonRpc*.debug=true\n" + "Translations.debug=true\n" + "Tests.debug=true"); } void TestJSONRPC::testHandshake() @@ -170,6 +174,42 @@ void TestJSONRPC::testHandshake() QCOMPARE(handShake.value("params").toMap().value("version").toString(), nymeaVersionString); } +void TestJSONRPC::testHandshakeLocale() +{ + // first test if the handshake message is auto-sent upon connecting + QSignalSpy spy(m_mockTcpServer, SIGNAL(outgoingData(QUuid,QByteArray))); + + // Test withouth locale data + QVariantMap handShake = injectAndWait("JSONRPC.Hello").toMap(); + QCOMPARE(handShake.value("params").toMap().value("locale").toString(), QString("en_US")); + + 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() == mockDeviceAutoClassId) { + QCOMPARE(dcMap.toMap().value("displayName").toString(), QString("Mock Device (Auto created)")); + found = true; + } + } + QVERIFY(found); + + // And now with locale info + QVariantMap params; + params.insert("locale", "de_DE"); + handShake = injectAndWait("JSONRPC.Hello", params).toMap(); + QCOMPARE(handShake.value("params").toMap().value("locale").toString(), QString("de_DE")); + + supportedDevices = injectAndWait("Devices.GetSupportedDevices").toMap(); + found = false; + foreach (const QVariant &dcMap, supportedDevices.value("params").toMap().value("deviceClasses").toList()) { + if (dcMap.toMap().value("id").toUuid() == mockDeviceAutoClassId) { + QCOMPARE(dcMap.toMap().value("displayName").toString(), QString("Mock Gerät (Automatisch erzeugt)")); + found = true; + } + } + QVERIFY(found); +} + void TestJSONRPC::testInitialSetup() { foreach (const QString &user, NymeaCore::instance()->userManager()->users()) {