Details coming soon.

This commit is contained in:
Paulchen-Panther
2018-12-27 23:11:32 +01:00
parent e3be03ea73
commit d762aa2f3e
186 changed files with 6156 additions and 5444 deletions

View File

@@ -13,20 +13,17 @@
// following file is auto generated by cmake! it contains all available leddevice headers
#include "LedDevice_headers.h"
LedDevice * LedDeviceFactory::construct(const QJsonObject & deviceConfig, const int ledCount)
LedDevice * LedDeviceFactory::construct(const QJsonObject & deviceConfig)
{
Logger * log = Logger::getInstance("LedDevice");
Logger * log = Logger::getInstance("LEDDEVICE");
QJsonDocument config(deviceConfig);
QString ss(config.toJson(QJsonDocument::Indented));
QString type = deviceConfig["type"].toString("UNSPECIFIED").toLower();
// set amount of led to leddevice
LedDevice::setLedCount(ledCount);
#define REGISTER(className) LedDevice::addToDeviceMap(QString(#className).toLower(), LedDevice##className::construct);
// the REGISTER() calls are autogenerated by cmake.
// the REGISTER() calls are autogenerated by cmake.
#include "LedDevice_register.cpp"
#undef REGISTER
@@ -40,12 +37,11 @@ LedDevice * LedDeviceFactory::construct(const QJsonObject & deviceConfig, const
if (dev.first == type)
{
device = dev.second(deviceConfig);
LedDevice::setActiveDevice(dev.first);
Info(log,"LedDevice '%s' configured.", QSTRING_CSTR(dev.first));
break;
}
}
if (device == nullptr)
{
Error(log, "Dummy device used, because configured device '%s' is unknown", QSTRING_CSTR(type) );
@@ -54,13 +50,13 @@ LedDevice * LedDeviceFactory::construct(const QJsonObject & deviceConfig, const
}
catch(std::exception& e)
{
Error(log, "Dummy device used, because configured device '%s' throws error '%s'", QSTRING_CSTR(type), e.what());
const QJsonObject dummyDeviceConfig;
device = LedDeviceFile::construct(QJsonObject());
}
device->open();
return device;
}