Add a getter method for thing classes to plugin api

This commit is contained in:
Michael Zanetti 2021-06-25 13:44:55 +02:00
parent 1acd8ca808
commit f08cd6b09f
3 changed files with 13 additions and 1 deletions

View File

@ -152,6 +152,17 @@ ThingClasses IntegrationPlugin::supportedThings() const
return m_metaData.thingClasses(); return m_metaData.thingClasses();
} }
/*! Returns a \l{ThingClass}{ThingClass} for the given \a thingClassId */
ThingClass IntegrationPlugin::thingClass(const ThingClassId &thingClassId) const
{
foreach (const ThingClass &thingClass, supportedThings()) {
if (thingClass.id() == thingClassId) {
return thingClass;
}
}
return ThingClass();
}
/*! Override this if your plugin supports things with ThingClass::CreationMethodAuto. /*! Override this if your plugin supports things with ThingClass::CreationMethodAuto.
This will be called at startup, after the configured things have been loaded. This will be called at startup, after the configured things have been loaded.
This is the earliest time you should start emitting autoThingsAppeared(). If you This is the earliest time you should start emitting autoThingsAppeared(). If you

View File

@ -93,6 +93,7 @@ public:
QString pluginDisplayName() const; QString pluginDisplayName() const;
Vendors supportedVendors() const; Vendors supportedVendors() const;
ThingClasses supportedThings() const; ThingClasses supportedThings() const;
ThingClass thingClass(const ThingClassId &thingClassId) const;
virtual void startMonitoringAutoThings(); virtual void startMonitoringAutoThings();
virtual void discoverThings(ThingDiscoveryInfo *info); virtual void discoverThings(ThingDiscoveryInfo *info);

View File

@ -8,7 +8,7 @@ JSON_PROTOCOL_VERSION_MAJOR=5
JSON_PROTOCOL_VERSION_MINOR=5 JSON_PROTOCOL_VERSION_MINOR=5
JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}" JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}"
LIBNYMEA_API_VERSION_MAJOR=7 LIBNYMEA_API_VERSION_MAJOR=7
LIBNYMEA_API_VERSION_MINOR=0 LIBNYMEA_API_VERSION_MINOR=1
LIBNYMEA_API_VERSION_PATCH=0 LIBNYMEA_API_VERSION_PATCH=0
LIBNYMEA_API_VERSION="$${LIBNYMEA_API_VERSION_MAJOR}.$${LIBNYMEA_API_VERSION_MINOR}.$${LIBNYMEA_API_VERSION_PATCH}" LIBNYMEA_API_VERSION="$${LIBNYMEA_API_VERSION_MAJOR}.$${LIBNYMEA_API_VERSION_MINOR}.$${LIBNYMEA_API_VERSION_PATCH}"