move basic tags from type utils to DeviceClass
This commit is contained in:
parent
ac1e3d32a1
commit
bf1235b4a7
@ -180,11 +180,11 @@
|
||||
\li - \underline{\e name:} The visible name of the \l{DeviceClass} \unicode{0x2192} \l{DeviceClass::name()}
|
||||
\li - \underline{\e idName:} This parameter will be used to define the DeviceClassId variable named <idName>DeviceClassId in the plugininfo.h, so it can be used in the code.
|
||||
\li - \underline{\e deviceClassesId:} The actual uuid (\l{DeviceClassId}) of the \l{DeviceClass} \unicode{0x2192} \l{DeviceClass::id()}.
|
||||
\li - \underline{\e basicTags:} A list of \l{Types::BasicTag}{BasicTags} for this device \unicode{0x2192} \l{DeviceClass::basicTags()}. A \l{DeviceClass} can have multiple \l{Types::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{Types::BasicTag} for more information. The expected value for the \e basicTags parameters matches the enum name like this:
|
||||
\li - \underline{\e basicTags:} A 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 {Types::BasicTagService} \unicode{0x2192} \tt {"basicTags": [ "Service" ]}
|
||||
\tt {DeviceClass::BasicTagService} \unicode{0x2192} \tt {"basicTags": [ "Service" ]}
|
||||
|
||||
\tt {Types::BasicTagLighting} \unicode{0x2192} \tt {"basicTags": [ "Lighting" ]}
|
||||
\tt {DeviceClass::BasicTagLighting} \unicode{0x2192} \tt {"basicTags": [ "Lighting" ]}
|
||||
|
||||
\tt ...
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
\li The logical OR \tt | operator for two \l{State}{States}
|
||||
\endtable
|
||||
|
||||
|
||||
|
||||
\chapter Types::ValueOperator
|
||||
\table
|
||||
\header
|
||||
@ -52,6 +50,7 @@
|
||||
\li The \tt >= operator to compare two \a values of a \l{Param}.
|
||||
\endtable
|
||||
|
||||
|
||||
\chapter Types::InputType
|
||||
\table
|
||||
\header
|
||||
@ -100,88 +99,6 @@
|
||||
\li The \l{ParamType} indicates that a MAC hardware address is requested as \l{Types::InputType}{InputType}.
|
||||
\endtable
|
||||
|
||||
|
||||
\chapter Types::BasicTag
|
||||
A \l{DeviceClass} can have multiple \l{Types::BasicTag}{BasicTags} which describe the basic category of the DeviceClass. A \l{DeviceClass} should be at least a \tt Service or a \tt Device, never both.
|
||||
\table
|
||||
\header
|
||||
\li Constant
|
||||
\li Value
|
||||
\li Description
|
||||
\row
|
||||
\li Types::BasicTagService
|
||||
\li 0
|
||||
\li The \l{DeviceClass} describes a service.
|
||||
\row
|
||||
\li Types::BasicTagDevice
|
||||
\li 1
|
||||
\li The \l{DeviceClass} describes a real device.
|
||||
\row
|
||||
\li Types::BasicTagSensor
|
||||
\li 2
|
||||
\li The \l{DeviceClass} describes a sensor. Any device which can measure or detect something is a sensor.
|
||||
\row
|
||||
\li Types::BasicTagActuator
|
||||
\li 3
|
||||
\li The \l{DeviceClass} describes an actuator. Any device which can do something is an actuator.
|
||||
\row
|
||||
\li Types::BasicTagLighting
|
||||
\li 4
|
||||
\li The \l{DeviceClass} describes a lighting device.
|
||||
\row
|
||||
\li Types::BasicTagEnergy
|
||||
\li 5
|
||||
\li The \l{DeviceClass} describes an energy device.
|
||||
\row
|
||||
\li Types::BasicTagMultimedia
|
||||
\li 6
|
||||
\li The \l{DeviceClass} describes a multimedia device.
|
||||
\row
|
||||
\li Types::BasicTagWeather
|
||||
\li 7
|
||||
\li The \l{DeviceClass} describes a weather service/device.
|
||||
\row
|
||||
\li Types::BasicTagGateway
|
||||
\li 8
|
||||
\li The \l{DeviceClass} describes a gateway device.
|
||||
\row
|
||||
\li Types::BasicTagHeating
|
||||
\li 9
|
||||
\li The \l{DeviceClass} describes a heating device.
|
||||
\row
|
||||
\li Types::BasicTagCooling
|
||||
\li 10
|
||||
\li The \l{DeviceClass} describes a cooling device.
|
||||
\row
|
||||
\li Types::BasicTagNotification
|
||||
\li 11
|
||||
\li The \l{DeviceClass} describes a notification device/service.
|
||||
\row
|
||||
\li Types::BasicTagSecurity
|
||||
\li 12
|
||||
\li The \l{DeviceClass} describes a security device/service.
|
||||
\row
|
||||
\li Types::BasicTagTime
|
||||
\li 13
|
||||
\li The \l{DeviceClass} describes a time device/service.
|
||||
\row
|
||||
\li Types::BasicTagShading
|
||||
\li 14
|
||||
\li The \l{DeviceClass} describes a shading device.
|
||||
\row
|
||||
\li Types::BasicTagAppliance
|
||||
\li 15
|
||||
\li The \l{DeviceClass} describes an appliance.
|
||||
\row
|
||||
\li Types::BasicTagCamera
|
||||
\li 16
|
||||
\li The \l{DeviceClass} describes a camera device.
|
||||
\row
|
||||
\li Types::BasicTagLock
|
||||
\li 17
|
||||
\li The \l{DeviceClass} describes a lock device.
|
||||
\endtable
|
||||
|
||||
\chapter Types::Unit
|
||||
\table
|
||||
\header
|
||||
|
||||
@ -60,6 +60,50 @@
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#include "deviceclass.h"
|
||||
|
||||
/*! Constructs a DeviceClass with the give \a pluginId ,\a vendorId and \a id .
|
||||
@ -113,18 +157,18 @@ void DeviceClass::setName(const QString &name)
|
||||
|
||||
/*! Returns the list of basicTags of this DeviceClass.
|
||||
|
||||
\sa Types::BasicTag
|
||||
\sa DeviceClass::BasicTag
|
||||
*/
|
||||
QList<Types::BasicTag> DeviceClass::basicTags() const
|
||||
QList<DeviceClass::BasicTag> DeviceClass::basicTags() const
|
||||
{
|
||||
return m_basicTags;
|
||||
}
|
||||
|
||||
/*! Set the list of \a basicTags of this DeviceClass.
|
||||
|
||||
\sa Types::BasicTag
|
||||
\sa DeviceClass::BasicTag
|
||||
*/
|
||||
void DeviceClass::setBasicTags(const QList<Types::BasicTag> &basicTags)
|
||||
void DeviceClass::setBasicTags(const QList<DeviceClass::BasicTag> &basicTags)
|
||||
{
|
||||
m_basicTags = basicTags;
|
||||
}
|
||||
|
||||
@ -37,6 +37,8 @@ class DeviceClass
|
||||
Q_GADGET
|
||||
Q_ENUMS(CreateMethod)
|
||||
Q_ENUMS(SetupMethod)
|
||||
Q_ENUMS(BasicTag)
|
||||
|
||||
public:
|
||||
enum CreateMethod {
|
||||
CreateMethodUser = 0x01,
|
||||
@ -52,6 +54,28 @@ public:
|
||||
SetupMethodPushButton
|
||||
};
|
||||
|
||||
enum BasicTag {
|
||||
BasicTagService,
|
||||
BasicTagDevice,
|
||||
BasicTagSensor,
|
||||
BasicTagActuator,
|
||||
BasicTagLighting,
|
||||
BasicTagEnergy,
|
||||
BasicTagMultimedia,
|
||||
BasicTagWeather,
|
||||
BasicTagGateway,
|
||||
BasicTagHeating,
|
||||
BasicTagCooling,
|
||||
BasicTagNotification,
|
||||
BasicTagSecurity,
|
||||
BasicTagTime,
|
||||
BasicTagShading,
|
||||
BasicTagAppliance,
|
||||
BasicTagCamera,
|
||||
BasicTagLock
|
||||
};
|
||||
|
||||
|
||||
DeviceClass(const PluginId &pluginId = PluginId(), const VendorId &vendorId = VendorId(), const DeviceClassId &id = DeviceClassId());
|
||||
|
||||
DeviceClassId id() const;
|
||||
@ -62,8 +86,8 @@ public:
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QList<Types::BasicTag> basicTags() const;
|
||||
void setBasicTags(const QList<Types::BasicTag> &basicTags);
|
||||
QList<BasicTag> basicTags() const;
|
||||
void setBasicTags(const QList<BasicTag> &basicTags);
|
||||
|
||||
QList<StateType> stateTypes() const;
|
||||
void setStateTypes(const QList<StateType> &stateTypes);
|
||||
@ -99,7 +123,7 @@ private:
|
||||
VendorId m_vendorId;
|
||||
PluginId m_pluginId;
|
||||
QString m_name;
|
||||
QList<Types::BasicTag> m_basicTags;
|
||||
QList<BasicTag> m_basicTags;
|
||||
QList<StateType> m_stateTypes;
|
||||
QList<EventType> m_eventTypes;
|
||||
QList<EventType> m_allEventTypes;
|
||||
|
||||
@ -234,7 +234,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
deviceClass.setPairingInfo(jo.value("pairingInfo").toString());
|
||||
deviceClass.setParamTypes(parseParamTypes(jo.value("paramTypes").toArray()));
|
||||
|
||||
QList<Types::BasicTag> basicTags;
|
||||
QList<DeviceClass::BasicTag> basicTags;
|
||||
foreach (const QJsonValue &basicTagJson, jo.value("basicTags").toArray()) {
|
||||
basicTags.append(basicTagStringToBasicTag(basicTagJson.toString()));
|
||||
}
|
||||
@ -812,47 +812,47 @@ Types::InputType DevicePlugin::inputTypeStringToInputType(const QString &inputTy
|
||||
return Types::InputTypeNone;
|
||||
}
|
||||
|
||||
Types::BasicTag DevicePlugin::basicTagStringToBasicTag(const QString &basicTag) const
|
||||
DeviceClass::BasicTag DevicePlugin::basicTagStringToBasicTag(const QString &basicTag) const
|
||||
{
|
||||
if (basicTag == "Device") {
|
||||
return Types::BasicTagDevice;
|
||||
return DeviceClass::BasicTagDevice;
|
||||
} else if (basicTag == "Service") {
|
||||
return Types::BasicTagService;
|
||||
return DeviceClass::BasicTagService;
|
||||
} else if (basicTag == "Actuator") {
|
||||
return Types::BasicTagActuator;
|
||||
return DeviceClass::BasicTagActuator;
|
||||
} else if (basicTag == "Sensor") {
|
||||
return Types::BasicTagSensor;
|
||||
return DeviceClass::BasicTagSensor;
|
||||
} else if (basicTag == "Lighting") {
|
||||
return Types::BasicTagLighting;
|
||||
return DeviceClass::BasicTagLighting;
|
||||
} else if (basicTag == "Energy") {
|
||||
return Types::BasicTagEnergy;
|
||||
return DeviceClass::BasicTagEnergy;
|
||||
} else if (basicTag == "Multimedia") {
|
||||
return Types::BasicTagMultimedia;
|
||||
return DeviceClass::BasicTagMultimedia;
|
||||
} else if (basicTag == "Weather") {
|
||||
return Types::BasicTagWeather;
|
||||
return DeviceClass::BasicTagWeather;
|
||||
} else if (basicTag == "Gateway") {
|
||||
return Types::BasicTagGateway;
|
||||
return DeviceClass::BasicTagGateway;
|
||||
} else if (basicTag == "Heating") {
|
||||
return Types::BasicTagHeating;
|
||||
return DeviceClass::BasicTagHeating;
|
||||
} else if (basicTag == "Cooling") {
|
||||
return Types::BasicTagCooling;
|
||||
return DeviceClass::BasicTagCooling;
|
||||
} else if (basicTag == "Notification") {
|
||||
return Types::BasicTagNotification;
|
||||
return DeviceClass::BasicTagNotification;
|
||||
} else if (basicTag == "Security") {
|
||||
return Types::BasicTagSecurity;
|
||||
return DeviceClass::BasicTagSecurity;
|
||||
} else if (basicTag == "Time") {
|
||||
return Types::BasicTagTime;
|
||||
return DeviceClass::BasicTagTime;
|
||||
} else if (basicTag == "Shading") {
|
||||
return Types::BasicTagShading;
|
||||
return DeviceClass::BasicTagShading;
|
||||
} else if (basicTag == "Appliance") {
|
||||
return Types::BasicTagAppliance;
|
||||
return DeviceClass::BasicTagAppliance;
|
||||
} else if (basicTag == "Camera") {
|
||||
return Types::BasicTagCamera;
|
||||
return DeviceClass::BasicTagCamera;
|
||||
} else if (basicTag == "Lock") {
|
||||
return Types::BasicTagLock;
|
||||
return DeviceClass::BasicTagLock;
|
||||
} else {
|
||||
qCWarning(dcDeviceManager) << "Could not parse basicTag:" << basicTag << "in plugin" << this->pluginName();
|
||||
}
|
||||
|
||||
return Types::BasicTagDevice;
|
||||
return DeviceClass::BasicTagDevice;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ private:
|
||||
|
||||
Types::Unit unitStringToUnit(const QString &unitString) const;
|
||||
Types::InputType inputTypeStringToInputType(const QString &inputType) const;
|
||||
Types::BasicTag basicTagStringToBasicTag(const QString &basicTag) const;
|
||||
DeviceClass::BasicTag basicTagStringToBasicTag(const QString &basicTag) const;
|
||||
|
||||
DeviceManager *m_deviceManager;
|
||||
|
||||
|
||||
@ -59,7 +59,6 @@ class Types
|
||||
{
|
||||
Q_GADGET
|
||||
Q_ENUMS(InputType)
|
||||
Q_ENUMS(BasicTag)
|
||||
Q_ENUMS(Unit)
|
||||
Q_ENUMS(StateOperator)
|
||||
Q_ENUMS(ValueOperator)
|
||||
@ -78,27 +77,6 @@ public:
|
||||
InputTypeMacAddress
|
||||
};
|
||||
|
||||
enum BasicTag {
|
||||
BasicTagService,
|
||||
BasicTagDevice,
|
||||
BasicTagSensor,
|
||||
BasicTagActuator,
|
||||
BasicTagLighting,
|
||||
BasicTagEnergy,
|
||||
BasicTagMultimedia,
|
||||
BasicTagWeather,
|
||||
BasicTagGateway,
|
||||
BasicTagHeating,
|
||||
BasicTagCooling,
|
||||
BasicTagNotification,
|
||||
BasicTagSecurity,
|
||||
BasicTagTime,
|
||||
BasicTagShading,
|
||||
BasicTagAppliance,
|
||||
BasicTagCamera,
|
||||
BasicTagLock
|
||||
};
|
||||
|
||||
enum Unit {
|
||||
UnitNone,
|
||||
UnitSeconds,
|
||||
@ -161,7 +139,6 @@ public:
|
||||
|
||||
Q_DECLARE_METATYPE(Types::InputType)
|
||||
Q_DECLARE_METATYPE(Types::Unit)
|
||||
Q_DECLARE_METATYPE(Types::BasicTag)
|
||||
Q_DECLARE_METATYPE(Types::ValueOperator)
|
||||
Q_DECLARE_METATYPE(Types::StateOperator)
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ void JsonTypes::init()
|
||||
{
|
||||
// BasicTypes
|
||||
s_basicType = enumToStrings(JsonTypes::staticMetaObject, "BasicType");
|
||||
s_basicTag = enumToStrings(Types::staticMetaObject, "BasicTag");
|
||||
s_basicTag = enumToStrings(DeviceClass::staticMetaObject, "BasicTag");
|
||||
s_stateOperator = enumToStrings(Types::staticMetaObject, "StateOperator");
|
||||
s_valueOperator = enumToStrings(Types::staticMetaObject, "ValueOperator");
|
||||
s_inputType = enumToStrings(Types::staticMetaObject, "InputType");
|
||||
@ -522,7 +522,7 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
|
||||
variant.insert("vendorId", deviceClass.vendorId());
|
||||
|
||||
QVariantList basicTags;
|
||||
foreach (const Types::BasicTag &basicTag, deviceClass.basicTags()) {
|
||||
foreach (const DeviceClass::BasicTag &basicTag, deviceClass.basicTags()) {
|
||||
basicTags.append(s_basicTag.at(basicTag));
|
||||
}
|
||||
QVariantList stateTypes;
|
||||
|
||||
@ -100,7 +100,7 @@ public:
|
||||
static QVariantMap allTypes();
|
||||
|
||||
DECLARE_TYPE(basicType, "BasicType", JsonTypes, BasicType)
|
||||
DECLARE_TYPE(basicTag, "BasicTag", Types, BasicTag)
|
||||
DECLARE_TYPE(basicTag, "BasicTag", DeviceClass, BasicTag)
|
||||
DECLARE_TYPE(stateOperator, "StateOperator", Types, StateOperator)
|
||||
DECLARE_TYPE(valueOperator, "ValueOperator", Types, ValueOperator)
|
||||
DECLARE_TYPE(inputType, "InputType", Types, InputType)
|
||||
|
||||
Reference in New Issue
Block a user