parent
07421e9b1f
commit
134879793f
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
\page typeutils.h
|
||||
\title Type Utils
|
||||
|
||||
|
||||
\chapter Types::StateOperator
|
||||
\table
|
||||
\header
|
||||
@ -17,7 +17,7 @@
|
||||
\li 1
|
||||
\li The logical OR \tt | operator for two \l{State}{States}
|
||||
\endtable
|
||||
|
||||
|
||||
\chapter Types::ValueOperator
|
||||
\table
|
||||
\header
|
||||
@ -27,11 +27,11 @@
|
||||
\row
|
||||
\li Types::ValueOperatorEquals
|
||||
\li 0
|
||||
\li The \tt = operator to compare two \a values of a \l{Param}.
|
||||
\li The \tt = operator to compare two \a values of a \l{Param}.
|
||||
\row
|
||||
\li Types::ValueOperatorNotEquals
|
||||
\li 1
|
||||
\li The \tt != operator to compare two \a values of a \l{Param}.
|
||||
\li The \tt != operator to compare two \a values of a \l{Param}.
|
||||
\row
|
||||
\li Types::ValueOperatorLess
|
||||
\li 2
|
||||
@ -265,6 +265,38 @@
|
||||
\li Types::UnitDollar
|
||||
\li 39
|
||||
\li The value of the \l{Param} has unit \tt {[\$]} \unicode{0x2192} dollar.
|
||||
\row
|
||||
\li Types::UnitHerz
|
||||
\li 40
|
||||
\li The value of the \l{Param} has unit \tt {[Hz]} \unicode{0x2192} herz.
|
||||
\row
|
||||
\li Types::UnitAmpere
|
||||
\li 41
|
||||
\li The value of the \l{Param} has unit \tt {[A]} \unicode{0x2192} ampere.
|
||||
\row
|
||||
\li Types::UnitMilliAmpere
|
||||
\li 42
|
||||
\li The value of the \l{Param} has unit \tt {[mA]} \unicode{0x2192} milli ampere.
|
||||
\row
|
||||
\li Types::UnitVolt
|
||||
\li 43
|
||||
\li The value of the \l{Param} has unit \tt {[V]} \unicode{0x2192} volt.
|
||||
\row
|
||||
\li Types::UnitMilliVolt
|
||||
\li 44
|
||||
\li The value of the \l{Param} has unit \tt {[mV]} \unicode{0x2192} milli volt.
|
||||
\row
|
||||
\li Types::UnitVoltAmpere
|
||||
\li 45
|
||||
\li The value of the \l{Param} has unit \tt {[VA]} \unicode{0x2192} volt ampere.
|
||||
\row
|
||||
\li Types::UnitVoltAmpereReactive
|
||||
\li 46
|
||||
\li The value of the \l{Param} has unit \tt {[var]} \unicode{0x2192} volt-ampere reactive.
|
||||
\row
|
||||
\li Types::UnitAmpereHour
|
||||
\li 47
|
||||
\li The value of the \l{Param} has unit \tt {[Ah]} \unicode{0x2192} ampere hour.
|
||||
\endtable
|
||||
|
||||
\chapter UUID Types
|
||||
@ -274,37 +306,39 @@
|
||||
|
||||
\section2 VendorId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Vendor}.
|
||||
\section2 DeviceClassId
|
||||
|
||||
\section2 DeviceClassId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{DeviceClass}.
|
||||
|
||||
\section2 DeviceId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Device}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Device}.
|
||||
|
||||
\section2 DeviceDescriptorId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{DeviceDescriptor}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{DeviceDescriptor}.
|
||||
|
||||
\section2 EventTypeId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{EventType}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{EventType}.
|
||||
|
||||
\section2 EventId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Event}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Event}.
|
||||
|
||||
\section2 StateTypeId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{StateType}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{StateType}.
|
||||
|
||||
\section2 StateId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{State}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{State}.
|
||||
|
||||
\section2 ActionTypeId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{ActionType}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{ActionType}.
|
||||
|
||||
\section2 ActionId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Action} and \l{RuleAction}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Action} and \l{RuleAction}.
|
||||
|
||||
\section2 RuleId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{guhserver::Rule}.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{guhserver::Rule}.
|
||||
|
||||
\section2 PairingTransactionId
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a pairing transaction.
|
||||
This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a pairing transaction.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@ -104,6 +104,44 @@
|
||||
|
||||
*/
|
||||
|
||||
/*! \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 DeviceIconBed
|
||||
\value DeviceIconBlinds
|
||||
\value DeviceIconCeilingLamp
|
||||
\value DeviceIconCouch
|
||||
\value DeviceIconDeskLamp
|
||||
\value DeviceIconDesk
|
||||
\value DeviceIconHifi
|
||||
\value DeviceIconPower
|
||||
\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 DeviceIconCloud
|
||||
*/
|
||||
|
||||
|
||||
#include "deviceclass.h"
|
||||
|
||||
/*! Constructs a DeviceClass with the give \a pluginId ,\a vendorId and \a id .
|
||||
@ -155,6 +193,21 @@ void DeviceClass::setName(const QString &name)
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*! Returns the default \l{DeviceIcon} of this \l{DeviceClass}'s. */
|
||||
DeviceClass::DeviceIcon DeviceClass::deviceIcon() const
|
||||
{
|
||||
return m_deviceIcon;
|
||||
}
|
||||
|
||||
/*! Set the \a deviceIcon of this 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
|
||||
|
||||
@ -39,6 +39,7 @@ class LIBGUH_EXPORT DeviceClass
|
||||
Q_ENUMS(CreateMethod)
|
||||
Q_ENUMS(SetupMethod)
|
||||
Q_ENUMS(BasicTag)
|
||||
Q_ENUMS(DeviceIcon)
|
||||
|
||||
public:
|
||||
enum CreateMethod {
|
||||
@ -76,6 +77,35 @@ public:
|
||||
BasicTagLock
|
||||
};
|
||||
|
||||
enum DeviceIcon {
|
||||
DeviceIconBed,
|
||||
DeviceIconBlinds,
|
||||
DeviceIconCeilingLamp,
|
||||
DeviceIconCouch,
|
||||
DeviceIconDeskLamp,
|
||||
DeviceIconDesk,
|
||||
DeviceIconHifi,
|
||||
DeviceIconPower,
|
||||
DeviceIconRadio,
|
||||
DeviceIconSmartPhone,
|
||||
DeviceIconSocket,
|
||||
DeviceIconStandardLamp,
|
||||
DeviceIconSun,
|
||||
DeviceIconTablet,
|
||||
DeviceIconThermometer,
|
||||
DeviceIconTune,
|
||||
DeviceIconTv,
|
||||
DeviceIconBattery,
|
||||
DeviceIconDishwasher,
|
||||
DeviceIconWashingMachine,
|
||||
DeviceIconLaundryDryer,
|
||||
DeviceIconIrHeater,
|
||||
DeviceIconRadiator,
|
||||
DeviceIconSwitch,
|
||||
DeviceIconMotionDetectors,
|
||||
DeviceIconWeather,
|
||||
DeviceIconCloud
|
||||
};
|
||||
|
||||
DeviceClass(const PluginId &pluginId = PluginId(), const VendorId &vendorId = VendorId(), const DeviceClassId &id = DeviceClassId());
|
||||
|
||||
@ -87,6 +117,9 @@ public:
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
DeviceIcon deviceIcon() const;
|
||||
void setDeviceIcon(const DeviceIcon &deviceIcon);
|
||||
|
||||
QList<BasicTag> basicTags() const;
|
||||
void setBasicTags(const QList<BasicTag> &basicTags);
|
||||
|
||||
@ -124,6 +157,7 @@ private:
|
||||
VendorId m_vendorId;
|
||||
PluginId m_pluginId;
|
||||
QString m_name;
|
||||
DeviceIcon m_deviceIcon;
|
||||
QList<BasicTag> m_basicTags;
|
||||
QList<StateType> m_stateTypes;
|
||||
QList<EventType> m_eventTypes;
|
||||
|
||||
@ -119,7 +119,15 @@ public:
|
||||
UnitPercentage,
|
||||
UnitPartsPerMillion,
|
||||
UnitEuro,
|
||||
UnitDollar
|
||||
UnitDollar,
|
||||
UnitHerz,
|
||||
UnitAmpere,
|
||||
UnitMilliAmpere,
|
||||
UnitVolt,
|
||||
UnitMilliVolt,
|
||||
UnitVoltAmpere,
|
||||
UnitVoltAmpereReactive,
|
||||
UnitAmpereHour
|
||||
};
|
||||
|
||||
enum ValueOperator {
|
||||
|
||||
@ -39,6 +39,7 @@ 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;
|
||||
@ -87,6 +88,7 @@ void JsonTypes::init()
|
||||
s_unit = enumToStrings(Types::staticMetaObject, "Unit");
|
||||
s_createMethod = enumToStrings(DeviceClass::staticMetaObject, "CreateMethod");
|
||||
s_setupMethod = enumToStrings(DeviceClass::staticMetaObject, "SetupMethod");
|
||||
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,6 +279,7 @@ QVariantMap JsonTypes::allTypes()
|
||||
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());
|
||||
@ -1103,7 +1106,7 @@ QPair<bool, QString> JsonTypes::validateVariant(const QVariant &templateVariant,
|
||||
} else if (refName == eventRef()) {
|
||||
QPair<bool, QString> result = validateMap(eventDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "event not valid";
|
||||
qCWarning(dcJsonRpc) << "Event not valid";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == paramRef()) {
|
||||
@ -1119,192 +1122,198 @@ QPair<bool, QString> JsonTypes::validateVariant(const QVariant &templateVariant,
|
||||
} else if (refName == deviceRef()) {
|
||||
QPair<bool, QString> result = validateMap(deviceDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "device not valid";
|
||||
qCWarning(dcJsonRpc) << "Device not valid";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == deviceDescriptorRef()) {
|
||||
QPair<bool, QString> result = validateMap(deviceDescriptorDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "devicedescription not valid";
|
||||
qCWarning(dcJsonRpc) << "Devicedescriptor not valid";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == vendorRef()) {
|
||||
QPair<bool, QString> result = validateMap(vendorDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "value not allowed in" << vendorRef();
|
||||
qCWarning(dcJsonRpc) << "Value not allowed in" << vendorRef();
|
||||
}
|
||||
} else if (refName == deviceClassRef()) {
|
||||
QPair<bool, QString> result = validateMap(deviceClassDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "device class not valid";
|
||||
qCWarning(dcJsonRpc) << "Device class not valid";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == paramTypeRef()) {
|
||||
QPair<bool, QString> result = validateMap(paramTypeDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "param types not matching";
|
||||
qCWarning(dcJsonRpc) << "Param types not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == ruleActionRef()) {
|
||||
QPair<bool, QString> result = validateMap(ruleActionDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "ruleAction type not matching";
|
||||
qCWarning(dcJsonRpc) << "RuleAction type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == ruleActionParamRef()) {
|
||||
QPair<bool, QString> result = validateMap(ruleActionParamDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "ruleActionParam type not matching";
|
||||
qCWarning(dcJsonRpc) << "RuleActionParam type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == actionTypeRef()) {
|
||||
QPair<bool, QString> result = validateMap(actionTypeDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "action type not matching";
|
||||
qCWarning(dcJsonRpc) << "Action type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == eventTypeRef()) {
|
||||
QPair<bool, QString> result = validateMap(eventTypeDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "event type not matching";
|
||||
qCWarning(dcJsonRpc) << "Event type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == stateTypeRef()) {
|
||||
QPair<bool, QString> result = validateMap(stateTypeDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "state type not matching";
|
||||
qCWarning(dcJsonRpc) << "State type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == stateEvaluatorRef()) {
|
||||
QPair<bool, QString> result = validateMap(stateEvaluatorDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "stateEvaluator type not matching";
|
||||
qCWarning(dcJsonRpc) << "StateEvaluator type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == stateDescriptorRef()) {
|
||||
QPair<bool, QString> result = validateMap(stateDescriptorDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "stateDescriptor type not matching";
|
||||
qCWarning(dcJsonRpc) << "StateDescriptor type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == pluginRef()) {
|
||||
QPair<bool, QString> result = validateMap(pluginDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "plugin not matching";
|
||||
qCWarning(dcJsonRpc) << "Plugin not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == ruleRef()) {
|
||||
QPair<bool, QString> result = validateMap(ruleDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "rule type not matching";
|
||||
qCWarning(dcJsonRpc) << "Rule type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == ruleDescriptionRef()) {
|
||||
QPair<bool, QString> result = validateMap(s_ruleDescription, variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "ruleDescription type not matching";
|
||||
qCWarning(dcJsonRpc) << "RuleDescription type not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == stateRef()) {
|
||||
QPair<bool, QString> result = validateMap(s_state, variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "state not matching";
|
||||
qCWarning(dcJsonRpc) << "State not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == eventDescriptorRef()) {
|
||||
QPair<bool, QString> result = validateMap(eventDescriptorDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "evendescriptor not matching";
|
||||
qCWarning(dcJsonRpc) << "Eventdescriptor not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == logEntryRef()) {
|
||||
QPair<bool, QString> result = validateMap(logEntryDescription(), variant.toMap());
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "logEntry not matching";
|
||||
qCWarning(dcJsonRpc) << "LogEntry not matching";
|
||||
return result;
|
||||
}
|
||||
} else if (refName == basicTypeRef()) {
|
||||
QPair<bool, QString> result = validateBasicType(variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "value not allowed in" << basicTypeRef();
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(basicTypeRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == stateOperatorRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_stateOperator, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "value not allowed in" << stateOperatorRef();
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(stateOperatorRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == createMethodRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_createMethod, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "value not allowed in" << createMethodRef() << variant;
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(createMethodRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == setupMethodRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_setupMethod, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << "value not allowed in" << createMethodRef();
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(setupMethodRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == valueOperatorRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_valueOperator, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(valueOperatorRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(valueOperatorRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == deviceErrorRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_deviceError, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(deviceErrorRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(deviceErrorRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == ruleErrorRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_ruleError, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(ruleErrorRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(ruleErrorRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == loggingErrorRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_loggingError, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(loggingErrorRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(loggingErrorRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == loggingSourceRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_loggingSource, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(loggingSourceRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(loggingSourceRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == loggingLevelRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_loggingLevel, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(loggingLevelRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(loggingLevelRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == loggingEventTypeRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_loggingEventType, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(loggingEventTypeRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(loggingEventTypeRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == inputTypeRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_inputType, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(inputTypeRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(inputTypeRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == unitRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_unit, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(unitRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(unitRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == basicTagRef()) {
|
||||
QPair<bool, QString> result = validateEnum(s_basicTag, variant);
|
||||
if (!result.first) {
|
||||
qCWarning(dcJsonRpc) << QString("value %1 not allowed in %2").arg(variant.toString()).arg(basicTagRef());
|
||||
qCWarning(dcJsonRpc) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(basicTagRef());
|
||||
return result;
|
||||
}
|
||||
} else if (refName == deviceIconRef()) {
|
||||
QPair<bool, QString> 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 {
|
||||
@ -1335,7 +1344,7 @@ QPair<bool, QString> JsonTypes::validateVariant(const QVariant &templateVariant,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qCWarning(dcJsonRpc) << "unhandled value" << templateVariant;
|
||||
qCWarning(dcJsonRpc) << "Unhandled value" << templateVariant;
|
||||
return report(false, QString("Unhandled value %1.").arg(templateVariant.toString()));
|
||||
}
|
||||
return report(true, "");
|
||||
|
||||
@ -107,6 +107,7 @@ public:
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user