21 #include "HfdLights.h" 22 #include "LegacyLights.h" 25 #include <hybris/properties/properties.h> 27 #include <QtQml/qqml.h> 29 static QObject *lights_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
32 Q_UNUSED(scriptEngine)
35 char buffer[PROP_VALUE_MAX];
36 auto result = property_get("ro.build.version.sdk", buffer, "0");
38 auto sdkVersion = QString(buffer).toInt();
39 if (sdkVersion >= 27 || sdkVersion == 0) {
44 return new HfdLights();
46 return new LegacyLights();
50 void LightsPlugin::registerTypes(
const char *uri)
52 Q_ASSERT(uri == QLatin1String(
"Lights"));
53 qmlRegisterSingletonType<Lights>(uri, 0, 1,
"Lights", lights_provider);