From af0c5532a402e501f212cbbf785a97976ed1a930 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 21 Nov 2021 22:29:41 +0100 Subject: [PATCH] Update to libnymea-gpio changes --- debian/control | 2 +- gpio/integrationplugingpio.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/debian/control b/debian/control index b92711ac..0ac02bfe 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-depends: libboblight-dev, debhelper (>= 0.0.0), libnymea-dev (>= 0.26~), libnymea-mqtt-dev, - libnymea-gpio-dev (>= 1.0.4~), + libnymea-gpio-dev (>= 1.0.5~), libnymea-zigbee-dev, libqt5serialport5-dev, libqt5websockets5-dev, diff --git a/gpio/integrationplugingpio.cpp b/gpio/integrationplugingpio.cpp index 01f66602..d94a686b 100644 --- a/gpio/integrationplugingpio.cpp +++ b/gpio/integrationplugingpio.cpp @@ -237,15 +237,15 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) // Gpio input if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) { GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); - monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool()); - if (!monitor->enable()) { + bool activeLow = thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool(); + if (!monitor->enable(activeLow)) { qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); //: Error setting up GPIO thing monitor->deleteLater(); return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); } - connect(monitor, &GpioMonitor::interruptOccurred, thing, [thing](bool value){ + connect(monitor, &GpioMonitor::valueChanged, thing, [thing](bool value){ if (thing->thingClassId() == gpioInputRpiThingClassId) { thing->setStateValue(gpioInputRpiPowerStateTypeId, value); } else if (thing->thingClassId() == gpioInputBbbThingClassId) { @@ -267,15 +267,15 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) // Counter if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); - monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool()); - if (!monitor->enable()) { + bool activeLow = thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool(); + if (!monitor->enable(activeLow)) { qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); monitor->deleteLater(); //: Error setting up GPIO thing return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); } - connect(monitor, &GpioMonitor::interruptOccurred, thing, [this, thing](bool value){ + connect(monitor, &GpioMonitor::valueChanged, thing, [this, thing](bool value){ if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { if (value) { m_counterValues[thing->id()] += 1;