/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright 2013 - 2020, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. * This project including source code and documentation is protected by * copyright law, and remains the property of nymea GmbH. All rights, including * reproduction, publication, editing and translation, are reserved. The use of * this project is subject to the terms of a license agreement to be concluded * with nymea GmbH in accordance with the terms of use of nymea GmbH, available * under https://nymea.io/license * * GNU General Public License Usage * Alternatively, this project may be redistributed and/or modified under the * terms of the GNU General Public License as published by the Free Software * Foundation, GNU version 3. This project is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along with * this project. If not, see . * * For any further details and any questions please contact us under * contact@nymea.io or see our FAQ/Licensing Information on * https://nymea.io/license/faq * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef LIBNYMEAAPPCORE_H #define LIBNYMEAAPPCORE_H #include "engine.h" #include "connection/nymeahosts.h" #include "connection/nymeahost.h" #include "connection/discovery/nymeadiscovery.h" #include "vendorsproxy.h" #include "deviceclassesproxy.h" #include "devicesproxy.h" #include "pluginsproxy.h" #include "thingdiscovery.h" #include "interfacesmodel.h" #include "rulemanager.h" #include "models/rulesfiltermodel.h" #include "types/ruleactions.h" #include "types/ruleaction.h" #include "types/ruleactionparams.h" #include "types/ruleactionparam.h" #include "types/eventdescriptors.h" #include "types/eventdescriptor.h" #include "types/timedescriptor.h" #include "types/timeeventitems.h" #include "types/timeeventitem.h" #include "types/repeatingoption.h" #include "types/calendaritems.h" #include "types/calendaritem.h" #include "types/rule.h" #include "types/interfaces.h" #include "types/interface.h" #include "types/statedescriptor.h" #include "types/stateevaluator.h" #include "types/stateevaluators.h" #include "types/browseritems.h" #include "types/browseritem.h" #include "models/logsmodel.h" #include "models/logsmodelng.h" #include "models/barseriesadapter.h" #include "models/xyseriesadapter.h" #include "models/interfacesproxy.h" #include "configuration/nymeaconfiguration.h" #include "configuration/serverconfiguration.h" #include "configuration/serverconfigurations.h" #include "configuration/mqttpolicy.h" #include "configuration/mqttpolicies.h" #include "wifisetup/btwifisetup.h" #include "types/wirelessaccesspoint.h" #include "types/wirelessaccesspoints.h" #include "models/wirelessaccesspointsproxy.h" #include "tagsmanager.h" #include "models/tagsproxymodel.h" #include "models/taglistmodel.h" #include "types/tag.h" #include "ruletemplates/ruletemplates.h" #include "ruletemplates/ruletemplate.h" #include "ruletemplates/eventdescriptortemplate.h" #include "ruletemplates/timedescriptortemplate.h" #include "ruletemplates/calendaritemtemplate.h" #include "ruletemplates/timeeventitemtemplate.h" #include "ruletemplates/stateevaluatortemplate.h" #include "ruletemplates/statedescriptortemplate.h" #include "ruletemplates/ruleactiontemplate.h" #include "ruletemplates/ruleactionparamtemplate.h" #include "connection/awsclient.h" #include "models/devicemodel.h" #include "models/sortfilterproxymodel.h" #include "system/systemcontroller.h" #include "types/package.h" #include "types/packages.h" #include "types/repository.h" #include "types/repositories.h" #include "models/packagesfiltermodel.h" #include "configuration/networkmanager.h" #include "types/networkdevices.h" #include "types/networkdevice.h" #include "scriptsyntaxhighlighter.h" #include "scriptmanager.h" #include "scripting/codecompletion.h" #include "scripting/completionmodel.h" #include "scripting/scriptautosaver.h" #include "types/script.h" #include "types/scripts.h" #include "types/types.h" #include "usermanager.h" #include "types/tokeninfos.h" #include "types/tokeninfo.h" #include "types/userinfo.h" #include "thinggroup.h" #include "types/statetypesproxy.h" #include "types/ioconnection.h" #include "types/ioconnections.h" #include "types/ioconnectionwatcher.h" #include "zigbee/zigbeemanager.h" #include "zigbee/zigbeeadapter.h" #include "zigbee/zigbeeadapters.h" #include "zigbee/zigbeeadaptersproxy.h" #include "zigbee/zigbeenetwork.h" #include "zigbee/zigbeenetworks.h" #include static QObject* interfacesModel_provider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) return new Interfaces(); } static QObject* awsClientProvider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) return AWSClient::instance(); } static QObject* typesProvider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) return Types::instance(); } void registerQmlTypes() { const char uri[] = "Nymea"; qmlRegisterType(uri, 1, 0, "Engine"); qmlRegisterUncreatableType(uri, 1, 0, "ThingManager", "Can't create this in QML. Get it from the Engine."); qmlRegisterUncreatableType(uri, 1, 0, "DeviceManager", "Can't create this in QML. Get it from the Engine."); qmlRegisterUncreatableType(uri, 1, 0, "JsonRpcClient", "Can't create this in QML. Get it from the Engine."); qmlRegisterUncreatableType(uri, 1, 0, "NymeaConnection", "Can't create this in QML. Get it from the Engine."); // libnymea-common qmlRegisterSingletonType(uri, 1, 0, "Types", typesProvider); qmlRegisterUncreatableType(uri, 1, 0, "ParamType", "Can't create this in QML. Get it from the ParamTypes."); qmlRegisterUncreatableType(uri, 1, 0, "ParamTypes", "Can't create this in QML. Get it from the DeviceClass."); qmlRegisterUncreatableType(uri, 1, 0, "EventType", "Can't create this in QML. Get it from the EventTypes."); qmlRegisterUncreatableType(uri, 1, 0, "EventTypes", "Can't create this in QML. Get it from the DeviceClass."); qmlRegisterUncreatableType(uri, 1, 0, "StateType", "Can't create this in QML. Get it from the StateTypes."); qmlRegisterUncreatableType(uri, 1, 0, "StateTypes", "Can't create this in QML. Get it from the DeviceClass."); qmlRegisterUncreatableType(uri, 1, 0, "ActionType", "Can't create this in QML. Get it from the ActionTypes."); qmlRegisterUncreatableType(uri, 1, 0, "ActionTypes", "Can't create this in QML. Get it from the DeviceClass."); qmlRegisterType(uri, 1, 0, "StateTypesProxy"); qmlRegisterUncreatableType(uri, 1, 0, "State", "Can't create this in QML. Get it from the States."); qmlRegisterUncreatableType(uri, 1, 0, "States", "Can't create this in QML. Get it from the Device."); qmlRegisterUncreatableType(uri, 1, 0, "BrowserItems", "Can't create this in QML. Get it from DeviceManager."); qmlRegisterUncreatableType(uri, 1, 0, "BrowserItem", "Can't create this in QML. Get it from BroweserItems."); qmlRegisterUncreatableType(uri, 1, 0, "Vendor", "Can't create this in QML. Get it from the Vendors."); qmlRegisterUncreatableType(uri, 1, 0, "Vendors", "Can't create this in QML. Get it from the DeviceManager."); qmlRegisterType(uri, 1, 0, "VendorsProxy"); qmlRegisterUncreatableType(uri, 1, 0, "Device", "Can't create this in QML. Get it from the Devices."); qmlRegisterUncreatableType(uri, 1, 0, "Thing", "Can't create this in QML. Get it from the Things."); qmlRegisterUncreatableType(uri, 1, 0, "Devices", "Can't create this in QML. Get it from the DeviceManager."); qmlRegisterUncreatableType(uri, 1, 0, "Things", "Can't create this in QML. Get it from the ThingManager."); qmlRegisterType(uri, 1, 0, "DevicesProxy"); qmlRegisterType(uri, 1, 0, "ThingsProxy"); qmlRegisterType(uri, 1, 0, "InterfacesModel"); qmlRegisterType(uri, 1, 0, "InterfacesSortModel"); qmlRegisterUncreatableType(uri, 1, 0, "ThingClass", "Can't create this in QML. Get it from the ThingClasses."); qmlRegisterUncreatableType(uri, 1, 0, "ThingClasses", "Can't create this in QML. Get it from the ThingManager."); qmlRegisterUncreatableType(uri, 1, 0, "DeviceClass", "Can't create this in QML. Get it from the DeviceClasses."); qmlRegisterUncreatableType(uri, 1, 0, "DeviceClasses", "Can't create this in QML. Get it from the DeviceManager."); qmlRegisterType(uri, 1, 0, "DeviceClassesProxy"); qmlRegisterType(uri, 1, 0, "ThingDiscovery"); qmlRegisterType(uri, 1, 0, "ThingDiscoveryProxy"); qmlRegisterUncreatableType(uri, 1, 0, "DeviceDescriptor", "Get it from DeviceDiscovery"); qmlRegisterUncreatableType(uri, 1, 0, "ThingDescriptor", "Get it from ThingDiscovery"); qmlRegisterType(uri, 1, 0, "DeviceModel"); qmlRegisterUncreatableType(uri, 1, 0, "RuleManager", "Get it from the Engine"); qmlRegisterUncreatableType(uri, 1, 0, "Rules", "Get it from RuleManager"); qmlRegisterUncreatableType(uri, 1, 0, "Rule", "Get it from Rules"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActions", "Get them from the rule"); qmlRegisterUncreatableType(uri, 1, 0, "RuleAction", "Get it from RuleActions"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionParams", "Get it from RuleActions"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionParam", "Get it from RuleActionParams"); qmlRegisterType(uri, 1, 0, "RulesFilterModel"); qmlRegisterUncreatableType(uri, 1, 0, "EventDescriptors", "Get them from rules"); qmlRegisterUncreatableType(uri, 1, 0, "EventDescriptor", "Get them from rules"); qmlRegisterUncreatableType(uri, 1, 0, "ParamTypes", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "ParamType", "Uncreatable"); qmlRegisterType(uri, 1, 0, "Param"); qmlRegisterUncreatableType(uri, 1, 0, "ParamDescriptor", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "ParamDescriptors", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "StateDescriptor", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "StateEvaluator", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "StateEvaluators", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "TimeDescriptor", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "TimeEventItems", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "TimeEventItem", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "RepeatingOption", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "CalendarItems", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "CalendarItem", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "Interface", "Uncreatable"); qmlRegisterSingletonType(uri, 1, 0, "Interfaces", interfacesModel_provider); qmlRegisterType(uri, 1, 0, "InterfacesProxy"); qmlRegisterUncreatableType(uri, 1, 0, "ThingGroup", "Uncreatable"); qmlRegisterUncreatableType(uri, 1, 0, "Plugin", "Can't create this in QML. Get it from the Plugins."); qmlRegisterUncreatableType(uri, 1, 0, "Plugins", "Can't create this in QML. Get it from the DeviceManager."); qmlRegisterType(uri, 1, 0, "PluginsProxy"); qmlRegisterUncreatableType(uri, 1, 0, "NymeaConfiguration", "Get it from Engine"); qmlRegisterUncreatableType(uri, 1, 0, "ServerConfiguration", "Get it from NymeaConfiguration"); qmlRegisterUncreatableType(uri, 1, 0, "ServerConfigurations", "Get it from NymeaConfiguration"); qmlRegisterUncreatableType(uri, 1, 0, "WebServerConfiguration", "Get it from NymeaConfiguration"); qmlRegisterUncreatableType(uri, 1, 0, "WebServerConfigurations", "Get it from NymeaConfiguration"); qmlRegisterUncreatableType(uri, 1, 0, "MqttPolicy", "Get it from NymeaConfiguration"); qmlRegisterUncreatableType(uri, 1, 0, "MqttPolicies", "Get it from NymeaConfiguration"); qmlRegisterType(uri, 1, 0, "NymeaDiscovery"); qmlRegisterUncreatableType(uri, 1, 0, "NymeaHosts", "Get it from NymeaDiscovery"); qmlRegisterType(uri, 1, 0, "NymeaHostsFilterModel"); qmlRegisterUncreatableType(uri, 1, 0, "NymeaHost", "Get it from NymeaHosts"); qmlRegisterUncreatableType(uri, 1, 0, "Connection", "Get it from NymeaHost"); qmlRegisterType(uri, 1, 0, "LogsModel"); qmlRegisterType(uri, 1, 0, "LogsModelNg"); qmlRegisterUncreatableType(uri, 1, 0, "LogEntry", "Get them from LogsModel"); qmlRegisterType(uri, 1, 0, "BarSeriesAdapter"); qmlRegisterType(uri, 1, 0, "XYSeriesAdapter"); qmlRegisterUncreatableType(uri, 1, 0, "TagsManager", "Get it from Engine"); qmlRegisterUncreatableType(uri, 1, 0, "Tags", "Get it from TagsManager"); qmlRegisterUncreatableType(uri, 1, 0, "Tag", "Get it from Tags"); qmlRegisterType(uri, 1, 0, "TagsProxyModel"); qmlRegisterType(uri, 1, 0, "TagListModel"); qmlRegisterType(uri, 1, 0, "TagListProxyModel"); qmlRegisterType(uri, 1, 0, "BtWiFiSetup"); qmlRegisterType(uri, 1, 0, "BluetoothDiscovery"); qmlRegisterUncreatableType(uri, 1, 0, "BluetoothDeviceInfo", "Can't create this in QML. Get it from the DeviceInfos."); qmlRegisterUncreatableType(uri, 1, 0, "BluetoothDeviceInfos", "Can't create this in QML. Get it from the BluetoothDiscovery."); qmlRegisterUncreatableType(uri, 1, 0, "WirelessAccessPoint", "Can't create this in QML. Get it from the WirelessAccessPoints."); qmlRegisterUncreatableType(uri, 1, 0, "WirelessAccessPoints", "Can't create this in QML. Get it from the Engine instance."); qmlRegisterType(uri, 1, 0, "WirelessAccessPointsProxy"); qmlRegisterSingletonType(uri, 1, 0, "AWSClient", awsClientProvider); qmlRegisterUncreatableType(uri, 1, 0, "AWSDevice", "Can't create this in QML. Get it from AWSClient"); qmlRegisterType(uri, 1, 0, "RuleTemplates"); qmlRegisterType(uri, 1, 0, "RuleTemplatesFilterModel"); qmlRegisterUncreatableType(uri, 1, 0, "RuleTemplate", "Get them from RuleTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "EventDescriptorTemplates", "Get it from RuleTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "EventDescriptorTemplate", "Get it from EventDescriptorTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "TimeDescriptorTemplate", "Get it from RuleTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "CalendarItemTemplates", "Get it from TimeDescriptorTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "CalendarItemTemplate", "Get it from CalendarItemTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "TimeEventItemTemplates", "Get it from TimeDescriptorTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "TimeEventItemTemplate", "Get it from TimeEventItemTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "StateEvaluatorTemplate", "Get it from RuleTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "StateDescriptorTemplate", "Get it from StateEvaluatorTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionTemplates", "Get it from RuleTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionTemplate", "Get it from RuleActionTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionParamTemplates", "Get it from RuleActionTemplate"); qmlRegisterUncreatableType(uri, 1, 0, "RuleActionParamTemplate", "Get it from RuleActionParamTemplates"); qmlRegisterUncreatableType(uri, 1, 0, "SystemController", "Get it from Engine"); qmlRegisterUncreatableType(uri, 1, 0, "Packages", "Get it from SystemController"); qmlRegisterUncreatableType(uri, 1, 0, "Package", "Get it from Packages"); qmlRegisterUncreatableType(uri, 1, 0, "Repositories", "Get it from SystemController"); qmlRegisterUncreatableType(uri, 1, 0, "Repository", "Get it from Repositories"); qmlRegisterType(uri, 1, 0, "PackagesFilterModel"); qmlRegisterType(uri, 1, 0, "ZigbeeManager"); qmlRegisterUncreatableType(uri, 1, 0, "ZigbeeAdapter", "Get it from the ZigbeeAdapters"); qmlRegisterUncreatableType(uri, 1, 0, "ZigbeeAdapters", "Get it from ZigbeeManager"); qmlRegisterType(uri, 1, 0, "ZigbeeAdaptersProxy"); qmlRegisterUncreatableType(uri, 1, 0, "ZigbeeNetwork", "Get it from the ZigbeeManager"); qmlRegisterUncreatableType(uri, 1, 0, "ZigbeeNetworks", "Get it from the ZigbeeManager"); qmlRegisterType(uri, 1, 0, "NetworkManager"); qmlRegisterUncreatableType(uri, 1, 0, "NetworkDevices", "Get it from NetworkManager"); qmlRegisterUncreatableType(uri, 1, 0, "WiredNetworkDevices", "Get it from NetworkManager"); qmlRegisterUncreatableType(uri, 1, 0, "WirelessNetworkDevices", "Get it from NetworkManager"); qmlRegisterUncreatableType(uri, 1, 0, "NetworkDevice", "Get it from NetworkDevices"); qmlRegisterUncreatableType(uri, 1, 0, "WiredNetworkDevice", "Get it from NetworkDevices"); qmlRegisterUncreatableType(uri, 1, 0, "WirelessNetworkDevice", "Get it from NetworkDevices"); qmlRegisterUncreatableType(uri, 1, 0, "ScriptManager", "Get it from Engine"); qmlRegisterUncreatableType(uri, 1, 0, "Scripts", "Getit from ScriptManager"); qmlRegisterUncreatableType