From 9283d31e737292b2d57afb8f33c24f931efad346 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 18 Mar 2019 23:04:11 +0100 Subject: [PATCH] drop basicTags and deviceIcon --- doc/jsonrpc-api.qdoc | 109 +--------------------- doc/plugin-json.qdoc | 31 +------ libnymea-core/jsonrpc/jsontypes.cpp | 26 ------ libnymea-core/jsonrpc/jsontypes.h | 2 - libnymea/plugin/deviceplugin.cpp | 74 --------------- libnymea/plugin/deviceplugin.h | 2 - libnymea/types/deviceclass.cpp | 135 +--------------------------- libnymea/types/deviceclass.h | 71 +-------------- plugins/mock/devicepluginmock.json | 38 -------- 9 files changed, 6 insertions(+), 482 deletions(-) diff --git a/doc/jsonrpc-api.qdoc b/doc/jsonrpc-api.qdoc index 4bb429ea..66861fed 100644 --- a/doc/jsonrpc-api.qdoc +++ b/doc/jsonrpc-api.qdoc @@ -134,13 +134,9 @@ See also: \l{Param} "actionTypes": [ "$ref:ActionType" ], - "basicTags": [ - "$ref:BasicTag" - ], "createMethods": [ "$ref:CreateMethod" ], - "deviceIcon": "$ref:DeviceIcon", "discoveryParamTypes": [ "$ref:ParamType" ], @@ -167,7 +163,7 @@ See also: \l{Param} "vendorId": "Uuid" } \endcode -See also: \l{ActionType}, \l{CreateMethod}, \l{DeviceIcon}, \l{BasicTag}, \l{ParamType}, \l{SetupMethod}, \l{StateType}, \l{EventType}, \l{ParamType} +See also: \l{ActionType}, \l{CreateMethod}, \l{ParamType}, \l{SetupMethod}, \l{StateType}, \l{EventType}, \l{ParamType} \section2 DeviceDescriptor \code { @@ -206,47 +202,6 @@ See also: \l{ActionType}, \l{CreateMethod}, \l{DeviceIcon}, \l{BasicTag}, \l{Par "DeviceErrorParameterNotWritable" ] \endcode -\section2 DeviceIcon -\code -[ - "DeviceIconNone", - "DeviceIconBed", - "DeviceIconBlinds", - "DeviceIconCeilingLamp", - "DeviceIconCouch", - "DeviceIconDeskLamp", - "DeviceIconDesk", - "DeviceIconHifi", - "DeviceIconPower", - "DeviceIconEnergy", - "DeviceIconRadio", - "DeviceIconSmartPhone", - "DeviceIconSocket", - "DeviceIconStandardLamp", - "DeviceIconSun", - "DeviceIconTablet", - "DeviceIconThermometer", - "DeviceIconTune", - "DeviceIconTv", - "DeviceIconBattery", - "DeviceIconDishwasher", - "DeviceIconWashingMachine", - "DeviceIconLaundryDryer", - "DeviceIconIrHeater", - "DeviceIconRadiator", - "DeviceIconSwitch", - "DeviceIconMotionDetectors", - "DeviceIconWeather", - "DeviceIconTime", - "DeviceIconLightBulb", - "DeviceIconGateway", - "DeviceIconMail", - "DeviceIconNetwork", - "DeviceIconCloud", - "DeviceIconGarage", - "DeviceIconRollerShutter" -] -\endcode \section2 Event \code { @@ -3403,26 +3358,6 @@ See also: \l{Tag} "$ref:ParamType" ] }, - "BasicTag": [ - "BasicTagService", - "BasicTagDevice", - "BasicTagSensor", - "BasicTagActuator", - "BasicTagLighting", - "BasicTagEnergy", - "BasicTagMultimedia", - "BasicTagWeather", - "BasicTagGateway", - "BasicTagHeating", - "BasicTagCooling", - "BasicTagNotification", - "BasicTagSecurity", - "BasicTagTime", - "BasicTagShading", - "BasicTagAppliance", - "BasicTagCamera", - "BasicTagLock" - ], "BasicType": [ "Uuid", "String", @@ -3482,13 +3417,9 @@ See also: \l{Tag} "actionTypes": [ "$ref:ActionType" ], - "basicTags": [ - "$ref:BasicTag" - ], "createMethods": [ "$ref:CreateMethod" ], - "deviceIcon": "$ref:DeviceIcon", "discoveryParamTypes": [ "$ref:ParamType" ], @@ -3545,44 +3476,6 @@ See also: \l{Tag} "DeviceErrorPairingTransactionIdNotFound", "DeviceErrorParameterNotWritable" ], - "DeviceIcon": [ - "DeviceIconNone", - "DeviceIconBed", - "DeviceIconBlinds", - "DeviceIconCeilingLamp", - "DeviceIconCouch", - "DeviceIconDeskLamp", - "DeviceIconDesk", - "DeviceIconHifi", - "DeviceIconPower", - "DeviceIconEnergy", - "DeviceIconRadio", - "DeviceIconSmartPhone", - "DeviceIconSocket", - "DeviceIconStandardLamp", - "DeviceIconSun", - "DeviceIconTablet", - "DeviceIconThermometer", - "DeviceIconTune", - "DeviceIconTv", - "DeviceIconBattery", - "DeviceIconDishwasher", - "DeviceIconWashingMachine", - "DeviceIconLaundryDryer", - "DeviceIconIrHeater", - "DeviceIconRadiator", - "DeviceIconSwitch", - "DeviceIconMotionDetectors", - "DeviceIconWeather", - "DeviceIconTime", - "DeviceIconLightBulb", - "DeviceIconGateway", - "DeviceIconMail", - "DeviceIconNetwork", - "DeviceIconCloud", - "DeviceIconGarage", - "DeviceIconRollerShutter" - ], "Event": { "deviceId": "Uuid", "eventTypeId": "Uuid", diff --git a/doc/plugin-json.qdoc b/doc/plugin-json.qdoc index f85ae1c3..e0c3a291 100644 --- a/doc/plugin-json.qdoc +++ b/doc/plugin-json.qdoc @@ -192,9 +192,7 @@ "displayName": "The name of the device class (translatable)", "o:createMethods": [ ], "o:setupMethod": "SetupMethod", - "o:deviceIcon": "Icon", "o:interfaces": [ "interfacename" ], - "o:basicTags": [ ], "o:pairingInfo": "Information how to pair the device. (translatable)", "o:criticalStateTypeId": "uuid", "o:primaryStateTypeId": "uuid", @@ -233,34 +231,9 @@ \li \tt interfaces \li \b O \li array - \li A string list of \l{Interfaces for DeviceClasses}{interfaces} this plugin implements. Interfaces show you how types - of this DeviceClass \underline{must} look like. + \li A string list of \l{Interfaces for DeviceClasses}{interfaces} this plugin implements. Interfaces define states, events and actions to + provide more defined ways of creating device class. A plugin developer should always try to follow interface definitions if possible. \row - \li \tt basicTags - \li \b O - \li array - \li A string list of \l{DeviceClass::BasicTag}{BasicTags} for this device \unicode{0x2192} \l{DeviceClass::basicTags()}. A \l{DeviceClass} can have - multiple \l{DeviceClass::BasicTag}{BasicTags} which describe the basic category of the DeviceClass. - A \l{DeviceClass} should be eighter a Service or a Device, never both. See enum \l{DeviceClass::BasicTag} for more information. - The expected value for the \e basicTags parameters matches the enum name like this: - - \tt {DeviceClass::BasicTagService} \unicode{0x2192} \tt {"basicTags": [ "Service" ]} - - \tt {DeviceClass::BasicTagLighting} \unicode{0x2192} \tt {"basicTags": [ "Lighting" ]} - - \tt ... - \row - \li \tt deviceIcon - \li \b O - \li string - \li Defines the icon for this \l{DeviceClass}. See enum \l{DeviceClass::DeviceIcon} for more information. The expected value for the \tt deviceIcon - parameters matches the enum name like this: - - \tt {DeviceClass::DeviceIconBed} \unicode{0x2192} \tt {"deviceIcon": "Bed"} - - \tt {DeviceClass::DeviceIconPower} \unicode{0x2192} \tt {"deviceIcon": "Power"} - - \tt ... \row \li \tt createMethods \li \b O diff --git a/libnymea-core/jsonrpc/jsontypes.cpp b/libnymea-core/jsonrpc/jsontypes.cpp index f8b87dc6..90b238bc 100644 --- a/libnymea-core/jsonrpc/jsontypes.cpp +++ b/libnymea-core/jsonrpc/jsontypes.cpp @@ -70,8 +70,6 @@ bool JsonTypes::s_initialized = false; QString JsonTypes::s_lastError; QVariantList JsonTypes::s_basicType; -QVariantList JsonTypes::s_basicTag; -QVariantList JsonTypes::s_deviceIcon; QVariantList JsonTypes::s_stateOperator; QVariantList JsonTypes::s_valueOperator; QVariantList JsonTypes::s_inputType; @@ -139,8 +137,6 @@ void JsonTypes::init() s_unit = enumToStrings(Types::staticMetaObject, "Unit"); s_createMethod = enumToStrings(DeviceClass::staticMetaObject, "CreateMethod"); s_setupMethod = enumToStrings(DeviceClass::staticMetaObject, "SetupMethod"); - s_basicTag = enumToStrings(DeviceClass::staticMetaObject, "BasicTag"); - s_deviceIcon = enumToStrings(DeviceClass::staticMetaObject, "DeviceIcon"); s_removePolicy = enumToStrings(RuleEngine::staticMetaObject, "RemovePolicy"); s_deviceError = enumToStrings(DeviceManager::staticMetaObject, "DeviceError"); s_ruleError = enumToStrings(RuleEngine::staticMetaObject, "RuleError"); @@ -277,9 +273,7 @@ void JsonTypes::init() s_deviceClass.insert("pluginId", basicTypeToString(Uuid)); s_deviceClass.insert("name", basicTypeToString(String)); s_deviceClass.insert("displayName", basicTypeToString(String)); - s_deviceClass.insert("deviceIcon", deviceIconRef()); s_deviceClass.insert("interfaces", QVariantList() << basicTypeToString(String)); - s_deviceClass.insert("basicTags", QVariantList() << basicTagRef()); s_deviceClass.insert("setupMethod", setupMethodRef()); s_deviceClass.insert("createMethods", QVariantList() << createMethodRef()); s_deviceClass.insert("o:criticalStateTypeId", basicTypeToString(Uuid)); @@ -437,13 +431,11 @@ QVariantMap JsonTypes::allTypes() { QVariantMap allTypes; allTypes.insert("BasicType", basicType()); - allTypes.insert("BasicTag", basicTag()); allTypes.insert("ParamType", paramTypeDescription()); allTypes.insert("InputType", inputType()); allTypes.insert("Unit", unit()); allTypes.insert("CreateMethod", createMethod()); allTypes.insert("SetupMethod", setupMethod()); - allTypes.insert("DeviceIcon", deviceIcon()); allTypes.insert("ValueOperator", valueOperator()); allTypes.insert("StateOperator", stateOperator()); allTypes.insert("RemovePolicy", removePolicy()); @@ -782,13 +774,8 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass, const QLo 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())); variant.insert("interfaces", deviceClass.interfaces()); - QVariantList basicTags; - foreach (const DeviceClass::BasicTag &basicTag, deviceClass.basicTags()) - basicTags.append(s_basicTag.at(basicTag)); - QVariantList stateTypes; foreach (const StateType &stateType, deviceClass.stateTypes()) stateTypes.append(packStateType(stateType, deviceClass.pluginId(), locale)); @@ -818,7 +805,6 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass, const QLo if (!deviceClass.primaryActionTypeId().isNull()) variant.insert("primaryActionTypeId", deviceClass.primaryActionTypeId().toString()); - variant.insert("basicTags", basicTags); variant.insert("paramTypes", paramTypes); variant.insert("discoveryParamTypes", discoveryParamTypes); variant.insert("stateTypes", stateTypes); @@ -2121,18 +2107,6 @@ QPair JsonTypes::validateVariant(const QVariant &templateVariant, qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(unitRef()); return result; } - } else if (refName == basicTagRef()) { - QPair result = validateEnum(s_basicTag, variant); - if (!result.first) { - qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(basicTagRef()); - return result; - } - } else if (refName == deviceIconRef()) { - QPair result = validateEnum(s_deviceIcon, variant); - if (!result.first) { - qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(deviceIconRef()); - return result; - } } else if (refName == repeatingModeRef()) { QPair result = validateEnum(s_repeatingMode, variant); if (!result.first) { diff --git a/libnymea-core/jsonrpc/jsontypes.h b/libnymea-core/jsonrpc/jsontypes.h index dda5c3cb..6fc417eb 100644 --- a/libnymea-core/jsonrpc/jsontypes.h +++ b/libnymea-core/jsonrpc/jsontypes.h @@ -120,14 +120,12 @@ public: static QVariantMap allTypes(); DECLARE_TYPE(basicType, "BasicType", JsonTypes, BasicType) - DECLARE_TYPE(basicTag, "BasicTag", DeviceClass, BasicTag) DECLARE_TYPE(stateOperator, "StateOperator", Types, StateOperator) DECLARE_TYPE(valueOperator, "ValueOperator", Types, ValueOperator) DECLARE_TYPE(inputType, "InputType", Types, InputType) DECLARE_TYPE(unit, "Unit", Types, Unit) DECLARE_TYPE(createMethod, "CreateMethod", DeviceClass, CreateMethod) DECLARE_TYPE(setupMethod, "SetupMethod", DeviceClass, SetupMethod) - DECLARE_TYPE(deviceIcon, "DeviceIcon", DeviceClass, DeviceIcon) DECLARE_TYPE(deviceError, "DeviceError", DeviceManager, DeviceError) DECLARE_TYPE(removePolicy, "RemovePolicy", RuleEngine, RemovePolicy) DECLARE_TYPE(ruleError, "RuleError", RuleEngine, RuleError) diff --git a/libnymea/plugin/deviceplugin.cpp b/libnymea/plugin/deviceplugin.cpp index ca7af802..4bc17924 100644 --- a/libnymea/plugin/deviceplugin.cpp +++ b/libnymea/plugin/deviceplugin.cpp @@ -594,15 +594,6 @@ void DevicePlugin::loadMetaData() } deviceClass.setCreateMethods(createMethods); - // Read device icon - QPair deviceIconVerification = loadAndVerifyDeviceIcon(deviceClassObject.value("deviceIcon").toString()); - if (!deviceIconVerification.first) { - broken = true; - break; - } else { - deviceClass.setDeviceIcon(deviceIconVerification.second); - } - // Read params QPair > paramTypesVerification = parseParamTypes(deviceClassObject.value("paramTypes").toArray()); if (!paramTypesVerification.first) { @@ -644,19 +635,6 @@ void DevicePlugin::loadMetaData() // Read pairing info deviceClass.setPairingInfo(deviceClassObject.value("pairingInfo").toString()); - // Read basic tags - QList basicTags; - foreach (const QJsonValue &basicTagJson, deviceClassObject.value("basicTags").toArray()) { - QPair basicTagVerification = loadAndVerifyBasicTag(basicTagJson.toString()); - if (!basicTagVerification.first) { - broken = true; - break; - } else { - basicTags.append(basicTagVerification.second); - } - } - deviceClass.setBasicTags(basicTags); - QList actionTypes; QList stateTypes; QList eventTypes; @@ -1053,58 +1031,6 @@ QPair DevicePlugin::loadAndVerifyInputType(const QString return QPair(true, (Types::InputType)enumValue); } -QPair DevicePlugin::loadAndVerifyBasicTag(const QString &basicTag) const -{ - if (basicTag.isEmpty()) - return QPair(true, DeviceClass::BasicTagDevice); - - QMetaObject metaObject = DeviceClass::staticMetaObject; - int enumIndex = metaObject.indexOfEnumerator(QString("BasicTag").toLatin1().data()); - QMetaEnum metaEnum = metaObject.enumerator(enumIndex); - - int enumValue = -1; - for (int i = 0; i < metaEnum.keyCount(); i++) { - if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("BasicTag" + basicTag)) { - enumValue = metaEnum.value(i); - break; - } - } - - // inform the plugin developer about the error in the plugin json file - if (enumValue == -1) { - qCWarning(dcDeviceManager()) << QString("\"%1\" plugin:").arg(pluginName()).toLatin1().data() << QString("Invalid basicTag \"%1\" in json file.").arg(basicTag).toLatin1().data(); - return QPair(false, DeviceClass::BasicTagDevice); - } - - return QPair(true, (DeviceClass::BasicTag)enumValue); -} - -QPair DevicePlugin::loadAndVerifyDeviceIcon(const QString &deviceIcon) const -{ - if (deviceIcon.isEmpty()) - return QPair(true, DeviceClass::DeviceIconNone); - - QMetaObject metaObject = DeviceClass::staticMetaObject; - int enumIndex = metaObject.indexOfEnumerator(QString("DeviceIcon").toLatin1().data()); - QMetaEnum metaEnum = metaObject.enumerator(enumIndex); - - int enumValue = -1; - for (int i = 0; i < metaEnum.keyCount(); i++) { - if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("DeviceIcon" + deviceIcon)) { - enumValue = metaEnum.value(i); - break; - } - } - - // inform the plugin developer about the error in the plugin json file - if (enumValue == -1) { - qCWarning(dcDeviceManager()) << QString("\"%1\" plugin:").arg(pluginName()).toLatin1().data() << QString("Invalid deviceIcon \"%1\" in json file.").arg(deviceIcon).toLatin1().data(); - return QPair(false, DeviceClass::DeviceIconNone); - } - - return QPair(true, (DeviceClass::DeviceIcon)enumValue); -} - Interfaces DevicePlugin::allInterfaces() { Interfaces ret; diff --git a/libnymea/plugin/deviceplugin.h b/libnymea/plugin/deviceplugin.h index b3a19389..1d5c7845 100644 --- a/libnymea/plugin/deviceplugin.h +++ b/libnymea/plugin/deviceplugin.h @@ -113,8 +113,6 @@ private: // load and verify enum values QPair loadAndVerifyUnit(const QString &unitString) const; QPair loadAndVerifyInputType(const QString &inputType) const; - QPair loadAndVerifyBasicTag(const QString &basicTag) const; - QPair loadAndVerifyDeviceIcon(const QString &deviceIcon) const; // FIXME: This is expensive because it will open all the files. // Once DeviceManager is in libnymea-core this should probably be there too. diff --git a/libnymea/types/deviceclass.cpp b/libnymea/types/deviceclass.cpp index 80b31f8d..9a8306d5 100644 --- a/libnymea/types/deviceclass.cpp +++ b/libnymea/types/deviceclass.cpp @@ -62,103 +62,6 @@ During the setup, a button has to be pushed in order to pair the \l{Device}. */ -/*! \enum DeviceClass::BasicTag - - This enum type specifies the basic tags which describe the categories of the DeviceClass. - A DeviceClass can have multiple tags. - - \value BasicTagService - The \l{DeviceClass} describes a service. - \value BasicTagDevice - The \l{DeviceClass} describes a real device. - \value BasicTagSensor - The \l{DeviceClass} describes a sensor. Any device which can measure or detect something is a sensor. - \value BasicTagActuator - The \l{DeviceClass} describes an actuator. Any device which can do something is an actuator. - \value BasicTagLighting - The \l{DeviceClass} describes a lighting device. - \value BasicTagEnergy - The \l{DeviceClass} describes an energy device. - \value BasicTagMultimedia - The \l{DeviceClass} describes a multimedia device/service. - \value BasicTagWeather - The \l{DeviceClass} describes a weather device/service. - \value BasicTagGateway - The \l{DeviceClass} describes a gateway device. - \value BasicTagHeating - The \l{DeviceClass} describes a heating device. - \value BasicTagCooling - The \l{DeviceClass} describes a cooling device. - \value BasicTagNotification - The \l{DeviceClass} describes a notification service. - \value BasicTagSecurity - The \l{DeviceClass} describes a security device/service. - \value BasicTagTime - The \l{DeviceClass} describes a time device/service. - \value BasicTagShading - The \l{DeviceClass} describes a shading device. - \value BasicTagAppliance - The \l{DeviceClass} describes an appliance. - \value BasicTagCamera - The \l{DeviceClass} describes a camera device. - \value BasicTagLock - The \l{DeviceClass} describes a lock device. - -*/ - -/*! \enum DeviceClass::DeviceIcon - - This enum type specifies the default device icon of the DeviceClass. - Each client should have an icon set containing this list of icon types. - If a client want's to offer special icons for a special DeviceClass or device type, - he can bring it's own icon for a special DeviceClassId. If there is no special icon - defined, he can fallback to the default icon. - - \value DeviceIconNone - \value DeviceIconBed - \value DeviceIconBlinds - \value DeviceIconCeilingLamp - \value DeviceIconCouch - \value DeviceIconDeskLamp - \value DeviceIconDesk - \value DeviceIconHifi - \value DeviceIconPower - \value DeviceIconEnergy - \value DeviceIconRadio - \value DeviceIconSmartPhone - \value DeviceIconSocket - \value DeviceIconStandardLamp - \value DeviceIconSun - \value DeviceIconTablet - \value DeviceIconThermometer - \value DeviceIconTune - \value DeviceIconTv - \value DeviceIconBattery - \value DeviceIconDishwasher - \value DeviceIconWashingMachine - \value DeviceIconLaundryDryer - \value DeviceIconIrHeater - \value DeviceIconRadiator - \value DeviceIconSwitch - \value DeviceIconMotionDetectors - \value DeviceIconWeather - \value DeviceIconTime - \value DeviceIconLightBulb - \value DeviceIconGateway - \value DeviceIconMail - \value DeviceIconNetwork - \value DeviceIconCloud - \value DeviceIconGarage, - \value DeviceIconRollerShutter -*/ - -/*! \fn void DeviceClass::setBasicTags(const QList &basicTags); - Set the list of \a basicTags of this DeviceClass. -*/ - -/*! \fn void DeviceClass::setDeviceIcon(const DeviceIcon &deviceIcon); - Set the \a deviceIcon of this DeviceClass. -*/ #include "deviceclass.h" @@ -173,7 +76,6 @@ DeviceClass::DeviceClass(const PluginId &pluginId, const VendorId &vendorId, con m_criticalStateTypeId(StateTypeId()), m_primaryStateTypeId(StateTypeId()), m_primaryActionTypeId(ActionTypeId()), - m_deviceIcon(DeviceIconPower), m_createMethods(CreateMethodUser), m_setupMethod(SetupMethodJustAdd) { @@ -265,39 +167,6 @@ void DeviceClass::setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId m_primaryActionTypeId = primaryActionTypeId; } -/*! Returns the default \l{DeviceIcon} of this \l{DeviceClass}. */ -DeviceClass::DeviceIcon DeviceClass::deviceIcon() const -{ - return m_deviceIcon; -} - -/*! Set the \a deviceIcon of this \l{DeviceClass}. - - \sa DeviceClass::DeviceIcon -*/ -void DeviceClass::setDeviceIcon(const DeviceClass::DeviceIcon &deviceIcon) -{ - m_deviceIcon = deviceIcon; -} - -/*! Returns the list of basicTags of this DeviceClass. - - \sa DeviceClass::BasicTag -*/ -QList DeviceClass::basicTags() const -{ - return m_basicTags; -} - -/*! Set the list of \a basicTags of this DeviceClass. - - \sa DeviceClass::BasicTag -*/ -void DeviceClass::setBasicTags(const QList &basicTags) -{ - m_basicTags = basicTags; -} - /*! Returns the statesTypes of this DeviceClass. \{Device}{Devices} created from this \l{DeviceClass} must have their states matching to this template. */ StateTypes DeviceClass::stateTypes() const @@ -474,8 +343,8 @@ bool DeviceClass::operator==(const DeviceClass &deviceClass) const /*! Returns a list of all valid JSON properties a DeviceClass JSON definition can have. */ QStringList DeviceClass::typeProperties() { - return QStringList() << "id" << "name" << "displayName" << "createMethods" << "setupMethod" << "deviceIcon" - << "interfaces" << "basicTags" << "pairingInfo" << "criticalStateTypeId" + return QStringList() << "id" << "name" << "displayName" << "createMethods" << "setupMethod" + << "interfaces" << "pairingInfo" << "criticalStateTypeId" << "primaryStateTypeId" << "primaryActionTypeId" << "discoveryParamTypes" << "discoveryParamTypes" << "paramTypes" << "stateTypes" << "actionTypes" << "eventTypes"; } diff --git a/libnymea/types/deviceclass.h b/libnymea/types/deviceclass.h index 43f1eb97..010d4b05 100644 --- a/libnymea/types/deviceclass.h +++ b/libnymea/types/deviceclass.h @@ -41,8 +41,7 @@ class LIBNYMEA_EXPORT DeviceClass Q_ENUMS(CreateMethod) Q_ENUMS(SetupMethod) Q_ENUMS(BasicTag) - Q_ENUMS(DeviceIcon) - Q_FLAGS(CreateMethods) + Q_ENUMS(CreateMethods) public: enum CreateMethod { @@ -59,66 +58,6 @@ public: SetupMethodPushButton }; - enum BasicTag { - BasicTagService, - BasicTagDevice, - BasicTagSensor, - BasicTagActuator, - BasicTagLighting, - BasicTagEnergy, - BasicTagMultimedia, - BasicTagWeather, - BasicTagGateway, - BasicTagHeating, - BasicTagCooling, - BasicTagNotification, - BasicTagSecurity, - BasicTagTime, - BasicTagShading, - BasicTagAppliance, - BasicTagCamera, - BasicTagLock - }; - - enum DeviceIcon { - DeviceIconNone, - DeviceIconBed, - DeviceIconBlinds, - DeviceIconCeilingLamp, - DeviceIconCouch, - DeviceIconDeskLamp, - DeviceIconDesk, - DeviceIconHifi, - DeviceIconPower, - DeviceIconEnergy, - DeviceIconRadio, - DeviceIconSmartPhone, - DeviceIconSocket, - DeviceIconStandardLamp, - DeviceIconSun, - DeviceIconTablet, - DeviceIconThermometer, - DeviceIconTune, - DeviceIconTv, - DeviceIconBattery, - DeviceIconDishwasher, - DeviceIconWashingMachine, - DeviceIconLaundryDryer, - DeviceIconIrHeater, - DeviceIconRadiator, - DeviceIconSwitch, - DeviceIconMotionDetectors, - DeviceIconWeather, - DeviceIconTime, - DeviceIconLightBulb, - DeviceIconGateway, - DeviceIconMail, - DeviceIconNetwork, - DeviceIconCloud, - DeviceIconGarage, - DeviceIconRollerShutter - }; - DeviceClass(const PluginId &pluginId = PluginId(), const VendorId &vendorId = VendorId(), const DeviceClassId &id = DeviceClassId()); DeviceClassId id() const; @@ -141,12 +80,6 @@ public: ActionTypeId primaryActionTypeId() const; void setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId); - DeviceIcon deviceIcon() const; - void setDeviceIcon(const DeviceIcon &deviceIcon); - - QList basicTags() const; - void setBasicTags(const QList &basicTags); - StateTypes stateTypes() const; StateType getStateType(const StateTypeId &stateTypeId); void setStateTypes(const QList &stateTypes); @@ -192,8 +125,6 @@ private: StateTypeId m_criticalStateTypeId; StateTypeId m_primaryStateTypeId; ActionTypeId m_primaryActionTypeId; - DeviceIcon m_deviceIcon; - QList m_basicTags; QList m_stateTypes; QList m_eventTypes; QList m_actionTypes; diff --git a/plugins/mock/devicepluginmock.json b/plugins/mock/devicepluginmock.json index 91a73636..28c6e657 100644 --- a/plugins/mock/devicepluginmock.json +++ b/plugins/mock/devicepluginmock.json @@ -30,13 +30,7 @@ "id": "753f0d32-0468-4d08-82ed-1964aab03298", "name": "mock", "displayName": "Mock Device", - "deviceIcon": "Tune", "interfaces": ["system", "light", "gateway", "battery"], - "basicTags": [ - "Device", - "Actuator", - "Gateway" - ], "createMethods": ["user", "discovery"], "primaryActionTypeId": "defd3ed6-1a0d-400b-8879-a0202cf39935", "primaryStateTypeId": "80baec19-54de-4948-ac46-31eabfaceb83", @@ -201,15 +195,9 @@ "name": "mockDeviceAuto", "displayName": "Mock Device (Auto created)", "interfaces": ["system"], - "basicTags": [ - "Device", - "Actuator", - "Gateway" - ], "createMethods": ["auto"], "primaryActionTypeId": "defd3ed6-1a0d-400b-8879-a0202cf39935", "primaryStateTypeId": "80baec19-54de-4948-ac46-31eabfaceb83", - "deviceIcon": "Tune", "paramTypes": [ { "id": "d4f06047-125e-4479-9810-b54c189917f5", @@ -321,14 +309,8 @@ "name": "mockPushButton", "displayName": "Mock Device (Push Button)", "interfaces": ["system"], - "basicTags": [ - "Device", - "Actuator", - "Gateway" - ], "createMethods": ["discovery"], "setupMethod": "pushButton", - "deviceIcon": "Tune", "pairingInfo": "Wait 3 second before you continue, the push button will be pressed automatically.", "paramTypes": [ ], "discoveryParamTypes": [ @@ -419,13 +401,7 @@ "id": "296f1fd4-e893-46b2-8a42-50d1bceb8730", "name": "mockDisplayPin", "displayName": "Mock Device (Display Pin)", - "deviceIcon": "Tune", "interfaces": ["system"], - "basicTags": [ - "Device", - "Actuator", - "Gateway" - ], "createMethods": ["discovery"], "setupMethod": "displayPin", "pairingInfo": "Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.", @@ -528,13 +504,7 @@ "id": "a71fbde9-9a38-4bf8-beab-c8aade2608ba", "name": "mockParent", "displayName": "Mock Device (Parent)", - "deviceIcon": "Tune", "interfaces": ["system"], - "basicTags": [ - "Device", - "Actuator", - "Gateway" - ], "createMethods": ["user"], "paramTypes": [ ], "stateTypes": [ @@ -556,10 +526,6 @@ "displayName": "Mock Device (Child)", "createMethods": ["auto"], "paramTypes": [], - "basicTags": [ - "Device", - "Actuator" - ], "stateTypes": [ { "id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0", @@ -577,10 +543,6 @@ "id": "515ffdf1-55e5-498d-9abc-4e2fe768f3a9", "name": "mockInputType", "displayName": "Mock Device (InputTypes)", - "deviceIcon": "Tune", - "basicTags": [ - "Device" - ], "createMethods": ["user"], "paramTypes": [ {