Merge PR #438: Add a getter method for thing classes to plugin api

This commit is contained in:
Jenkins nymea 2021-07-06 17:18:32 +02:00
commit 0404240fb7
2 changed files with 12 additions and 0 deletions

View File

@ -152,6 +152,17 @@ ThingClasses IntegrationPlugin::supportedThings() const
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.
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

View File

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