Create timer after setup to prevent crash on startup
This commit is contained in:
parent
c1f6e42d9c
commit
05331143dd
@ -75,12 +75,6 @@ void IntegrationPluginSma::setupThing(ThingSetupInfo *info)
|
|||||||
Thing *thing = info->thing();
|
Thing *thing = info->thing();
|
||||||
qCDebug(dcSma()) << "Setup thing" << thing->name();
|
qCDebug(dcSma()) << "Setup thing" << thing->name();
|
||||||
|
|
||||||
if (!m_refreshTimer) {
|
|
||||||
qCDebug(dcSma()) << "Starting refresh timer";
|
|
||||||
m_refreshTimer = hardwareManager()->pluginTimerManager()->registerTimer(1);
|
|
||||||
connect(m_refreshTimer, &PluginTimer::timeout, this, &IntegrationPluginSma::onRefreshTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thing->thingClassId() == sunnyWebBoxThingClassId) {
|
if (thing->thingClassId() == sunnyWebBoxThingClassId) {
|
||||||
//check if a Sunny WebBox is already added with this IPv4Address
|
//check if a Sunny WebBox is already added with this IPv4Address
|
||||||
foreach(SunnyWebBox *sunnyWebBox, m_sunnyWebBoxes.values()) {
|
foreach(SunnyWebBox *sunnyWebBox, m_sunnyWebBoxes.values()) {
|
||||||
@ -106,6 +100,13 @@ void IntegrationPluginSma::setupThing(ThingSetupInfo *info)
|
|||||||
connect(sunnyWebBox, &SunnyWebBox::plantOverviewReceived, this, &IntegrationPluginSma::onPlantOverviewReceived);
|
connect(sunnyWebBox, &SunnyWebBox::plantOverviewReceived, this, &IntegrationPluginSma::onPlantOverviewReceived);
|
||||||
m_sunnyWebBoxes.insert(info->thing(), sunnyWebBox);
|
m_sunnyWebBoxes.insert(info->thing(), sunnyWebBox);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!m_refreshTimer) {
|
||||||
|
qCDebug(dcSma()) << "Starting refresh timer";
|
||||||
|
m_refreshTimer = hardwareManager()->pluginTimerManager()->registerTimer(1);
|
||||||
|
connect(m_refreshTimer, &PluginTimer::timeout, this, &IntegrationPluginSma::onRefreshTimer);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Q_ASSERT_X(false, "setupThing", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
Q_ASSERT_X(false, "setupThing", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user