mirror of https://github.com/nymea/nymea.git
drop criticalStateTypeId, primaryStateTypeId and primaryActionTypeId
parent
9283d31e73
commit
bab59f6754
|
|
@ -149,9 +149,6 @@ See also: \l{Param}
|
|||
"String"
|
||||
],
|
||||
"name": "String",
|
||||
"o:criticalStateTypeId": "Uuid",
|
||||
"o:primaryActionTypeId": "Uuid",
|
||||
"o:primaryStateTypeId": "Uuid",
|
||||
"paramTypes": [
|
||||
"$ref:ParamType"
|
||||
],
|
||||
|
|
@ -3432,9 +3429,6 @@ See also: \l{Tag}
|
|||
"String"
|
||||
],
|
||||
"name": "String",
|
||||
"o:criticalStateTypeId": "Uuid",
|
||||
"o:primaryActionTypeId": "Uuid",
|
||||
"o:primaryStateTypeId": "Uuid",
|
||||
"paramTypes": [
|
||||
"$ref:ParamType"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -194,9 +194,6 @@
|
|||
"o:setupMethod": "SetupMethod",
|
||||
"o:interfaces": [ "interfacename" ],
|
||||
"o:pairingInfo": "Information how to pair the device. (translatable)",
|
||||
"o:criticalStateTypeId": "uuid",
|
||||
"o:primaryStateTypeId": "uuid",
|
||||
"o:primaryActionTypeId": "uuid",
|
||||
"o:discoveryParamTypes": [ ],
|
||||
"o:paramTypes": [ ],
|
||||
"o:stateTypes": [ ],
|
||||
|
|
@ -268,21 +265,6 @@
|
|||
\li The \l{DeviceClass::pairingInfo()}{pairingInfo} will inform the user how to pair the device \unicode{0x2192} \l{DeviceClass::setupMethod()}.
|
||||
This parameter will only be used for \l{DeviceClass::SetupMethodDisplayPin}{DisplayPin} and \l{DeviceClass::SetupMethodEnterPin}{EnterPin}
|
||||
and \l{DeviceClass::SetupMethodPushButton}{PushButton}. Example: "Please press the button on the device before continue."
|
||||
\row
|
||||
\li \tt criticalStateTypeId
|
||||
\li \b O
|
||||
\li string
|
||||
\li Deprecated: please use \l{Interfaces for DeviceClasses}{interfaces} instead.
|
||||
\row
|
||||
\li \tt primaryStateTypeId
|
||||
\li \b O
|
||||
\li string
|
||||
\li Deprecated: please use \l{Interfaces for DeviceClasses}{interfaces} instead.
|
||||
\row
|
||||
\li \tt primaryActionTypeId
|
||||
\li \b O
|
||||
\li string
|
||||
\li Deprecated: please use \l{Interfaces for DeviceClasses}{interfaces} instead.
|
||||
\row
|
||||
\li \tt discoveryParamTypes
|
||||
\li \b O
|
||||
|
|
|
|||
|
|
@ -276,9 +276,6 @@ void JsonTypes::init()
|
|||
s_deviceClass.insert("interfaces", QVariantList() << basicTypeToString(String));
|
||||
s_deviceClass.insert("setupMethod", setupMethodRef());
|
||||
s_deviceClass.insert("createMethods", QVariantList() << createMethodRef());
|
||||
s_deviceClass.insert("o:criticalStateTypeId", basicTypeToString(Uuid));
|
||||
s_deviceClass.insert("o:primaryStateTypeId", basicTypeToString(Uuid));
|
||||
s_deviceClass.insert("o:primaryActionTypeId", basicTypeToString(Uuid));
|
||||
s_deviceClass.insert("stateTypes", QVariantList() << stateTypeRef());
|
||||
s_deviceClass.insert("eventTypes", QVariantList() << eventTypeRef());
|
||||
s_deviceClass.insert("actionTypes", QVariantList() << actionTypeRef());
|
||||
|
|
@ -796,15 +793,6 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass, const QLo
|
|||
foreach (const ParamType ¶mType, deviceClass.discoveryParamTypes())
|
||||
discoveryParamTypes.append(packParamType(paramType, deviceClass.pluginId(), locale));
|
||||
|
||||
if (!deviceClass.criticalStateTypeId().isNull())
|
||||
variant.insert("criticalStateTypeId", deviceClass.criticalStateTypeId().toString());
|
||||
|
||||
if (!deviceClass.primaryStateTypeId().isNull())
|
||||
variant.insert("primaryStateTypeId", deviceClass.primaryStateTypeId().toString());
|
||||
|
||||
if (!deviceClass.primaryActionTypeId().isNull())
|
||||
variant.insert("primaryActionTypeId", deviceClass.primaryActionTypeId().toString());
|
||||
|
||||
variant.insert("paramTypes", paramTypes);
|
||||
variant.insert("discoveryParamTypes", discoveryParamTypes);
|
||||
variant.insert("stateTypes", stateTypes);
|
||||
|
|
|
|||
|
|
@ -833,41 +833,6 @@ void DevicePlugin::loadMetaData()
|
|||
}
|
||||
deviceClass.setEventTypes(eventTypes);
|
||||
|
||||
// Note: keep this after the actionType / stateType / eventType parsing
|
||||
if (deviceClassObject.contains("criticalStateTypeId")) {
|
||||
StateTypeId criticalStateTypeId = StateTypeId(deviceClassObject.value("criticalStateTypeId").toString());
|
||||
if (!deviceClass.hasStateType(criticalStateTypeId)) {
|
||||
qCWarning(dcDeviceManager()) << "Skipping device class" << deviceClass.name() << ": the definend critical stateTypeId" << criticalStateTypeId.toString() << "does not match any StateType of this DeviceClass.";
|
||||
broken = true;
|
||||
} else if (deviceClass.getStateType(criticalStateTypeId).type() != QVariant::Bool) {
|
||||
// Make sure the critical stateType is a bool state
|
||||
qCWarning(dcDeviceManager()) << "Skipping device class" << deviceClass.name() << ": the definend critical stateTypeId" << criticalStateTypeId.toString() << "is not a bool StateType.";
|
||||
broken = true;
|
||||
} else {
|
||||
deviceClass.setCriticalStateTypeId(criticalStateTypeId);
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceClassObject.contains("primaryStateTypeId")) {
|
||||
StateTypeId primaryStateTypeId = StateTypeId(deviceClassObject.value("primaryStateTypeId").toString());
|
||||
if (!deviceClass.hasStateType(primaryStateTypeId)) {
|
||||
qCWarning(dcDeviceManager()) << "Skipping device class" << deviceClass.name() << ": the definend primary stateTypeId" << primaryStateTypeId.toString() << "does not match any StateType of this DeviceClass.";
|
||||
broken = true;
|
||||
} else {
|
||||
deviceClass.setPrimaryStateTypeId(primaryStateTypeId);
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceClassObject.contains("primaryActionTypeId")) {
|
||||
ActionTypeId primaryActionTypeId = ActionTypeId(deviceClassObject.value("primaryActionTypeId").toString());
|
||||
if (!deviceClass.hasActionType(primaryActionTypeId)) {
|
||||
qCWarning(dcDeviceManager()) << "Skipping device class" << deviceClass.name() << ": the definend primary actionTypeId" << primaryActionTypeId.toString() << "does not match any ActionType of this DeviceClass.";
|
||||
broken = true;
|
||||
} else {
|
||||
deviceClass.setPrimaryActionTypeId(primaryActionTypeId);
|
||||
}
|
||||
}
|
||||
|
||||
// Read interfaces
|
||||
QStringList interfaces;
|
||||
foreach (const QJsonValue &value, deviceClassObject.value("interfaces").toArray()) {
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ DeviceClass::DeviceClass(const PluginId &pluginId, const VendorId &vendorId, con
|
|||
m_id(id),
|
||||
m_vendorId(vendorId),
|
||||
m_pluginId(pluginId),
|
||||
m_criticalStateTypeId(StateTypeId()),
|
||||
m_primaryStateTypeId(StateTypeId()),
|
||||
m_primaryActionTypeId(ActionTypeId()),
|
||||
m_createMethods(CreateMethodUser),
|
||||
m_setupMethod(SetupMethodJustAdd)
|
||||
{
|
||||
|
|
@ -130,43 +127,6 @@ void DeviceClass::setDisplayName(const QString &displayName)
|
|||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
/*! Returns the critical \l{StateTypeId} of this \l{DeviceClass}.
|
||||
* A critical \l{State} describes the state which disables the whole device (i.e. connected, available or reachable). */
|
||||
StateTypeId DeviceClass::criticalStateTypeId() const
|
||||
{
|
||||
return m_criticalStateTypeId;
|
||||
}
|
||||
|
||||
/*! Set the \a criticalStateTypeId of this \l{DeviceClass}. */
|
||||
void DeviceClass::setCriticalStateTypeId(const StateTypeId &criticalStateTypeId)
|
||||
{
|
||||
m_criticalStateTypeId = criticalStateTypeId;
|
||||
}
|
||||
|
||||
/*! Returns the primary \l{StateTypeId} of this \l{DeviceClass}. */
|
||||
StateTypeId DeviceClass::primaryStateTypeId() const
|
||||
{
|
||||
return m_primaryStateTypeId;
|
||||
}
|
||||
|
||||
/*! Set the \a primaryStateTypeId of this \l{DeviceClass}. */
|
||||
void DeviceClass::setPrimaryStateTypeId(const StateTypeId &primaryStateTypeId)
|
||||
{
|
||||
m_primaryStateTypeId = primaryStateTypeId;
|
||||
}
|
||||
|
||||
/*! Returns the primary \l{ActionTypeId} of this \l{DeviceClass}. */
|
||||
ActionTypeId DeviceClass::primaryActionTypeId() const
|
||||
{
|
||||
return m_primaryActionTypeId;
|
||||
}
|
||||
|
||||
/*! Set the \a primaryActionTypeId of this \l{DeviceClass}. */
|
||||
void DeviceClass::setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId)
|
||||
{
|
||||
m_primaryActionTypeId = primaryActionTypeId;
|
||||
}
|
||||
|
||||
/*! 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
|
||||
|
|
@ -344,9 +304,8 @@ bool DeviceClass::operator==(const DeviceClass &deviceClass) const
|
|||
QStringList DeviceClass::typeProperties()
|
||||
{
|
||||
return QStringList() << "id" << "name" << "displayName" << "createMethods" << "setupMethod"
|
||||
<< "interfaces" << "pairingInfo" << "criticalStateTypeId"
|
||||
<< "primaryStateTypeId" << "primaryActionTypeId" << "discoveryParamTypes"
|
||||
<< "discoveryParamTypes" << "paramTypes" << "stateTypes" << "actionTypes" << "eventTypes";
|
||||
<< "interfaces" << "pairingInfo" << "discoveryParamTypes" << "discoveryParamTypes"
|
||||
<< "paramTypes" << "stateTypes" << "actionTypes" << "eventTypes";
|
||||
}
|
||||
|
||||
/*! Returns a list of mandatory JSON properties a DeviceClass JSON definition must have. */
|
||||
|
|
|
|||
|
|
@ -71,15 +71,6 @@ public:
|
|||
QString displayName() const;
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
StateTypeId criticalStateTypeId() const;
|
||||
void setCriticalStateTypeId(const StateTypeId &criticalStateTypeId);
|
||||
|
||||
StateTypeId primaryStateTypeId() const;
|
||||
void setPrimaryStateTypeId(const StateTypeId &primaryStateTypeId);
|
||||
|
||||
ActionTypeId primaryActionTypeId() const;
|
||||
void setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId);
|
||||
|
||||
StateTypes stateTypes() const;
|
||||
StateType getStateType(const StateTypeId &stateTypeId);
|
||||
void setStateTypes(const QList<StateType> &stateTypes);
|
||||
|
|
@ -122,9 +113,6 @@ private:
|
|||
PluginId m_pluginId;
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
StateTypeId m_criticalStateTypeId;
|
||||
StateTypeId m_primaryStateTypeId;
|
||||
ActionTypeId m_primaryActionTypeId;
|
||||
QList<StateType> m_stateTypes;
|
||||
QList<EventType> m_eventTypes;
|
||||
QList<ActionType> m_actionTypes;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
"displayName": "Mock Device",
|
||||
"interfaces": ["system", "light", "gateway", "battery"],
|
||||
"createMethods": ["user", "discovery"],
|
||||
"primaryActionTypeId": "defd3ed6-1a0d-400b-8879-a0202cf39935",
|
||||
"primaryStateTypeId": "80baec19-54de-4948-ac46-31eabfaceb83",
|
||||
"discoveryParamTypes": [
|
||||
{
|
||||
"id": "d222adb4-2f9c-4c3f-8655-76400d0fb6ce",
|
||||
|
|
@ -196,8 +194,6 @@
|
|||
"displayName": "Mock Device (Auto created)",
|
||||
"interfaces": ["system"],
|
||||
"createMethods": ["auto"],
|
||||
"primaryActionTypeId": "defd3ed6-1a0d-400b-8879-a0202cf39935",
|
||||
"primaryStateTypeId": "80baec19-54de-4948-ac46-31eabfaceb83",
|
||||
"paramTypes": [
|
||||
{
|
||||
"id": "d4f06047-125e-4479-9810-b54c189917f5",
|
||||
|
|
|
|||
Loading…
Reference in New Issue