Skip to content

Commit ecc15af

Browse files
committed
Do not process snoop if not for our active device
1 parent 01b147b commit ecc15af

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

libs/indibase/indilightboxinterface.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ bool LightBoxInterface::updateProperties()
8787
{
8888
m_DefaultDevice->defineProperty(LightSP);
8989
m_DefaultDevice->defineProperty(LightIntensityNP);
90+
if (!FilterIntensityNP.isEmpty())
91+
m_DefaultDevice->defineProperty(FilterIntensityNP);
9092
}
9193
else
9294
{
9395
m_DefaultDevice->deleteProperty(LightSP);
9496
m_DefaultDevice->deleteProperty(LightIntensityNP);
9597

96-
if (FilterIntensityNP.count() > 0)
98+
if (!FilterIntensityNP.isEmpty())
9799
m_DefaultDevice->deleteProperty(FilterIntensityNP);
98100
}
99101

@@ -197,7 +199,7 @@ bool LightBoxInterface::processText(const char *dev, const char *name, char *tex
197199
if (!ActiveDeviceTP[0].isEmpty())
198200
{
199201
IDSnoopDevice(ActiveDeviceTP[0].getText(), "FILTER_SLOT");
200-
IDSnoopDevice(ActiveDeviceTP[0].text, "FILTER_NAME");
202+
IDSnoopDevice(ActiveDeviceTP[0].getText(), "FILTER_NAME");
201203
}
202204
// If filter removed, remove presets
203205
else
@@ -236,13 +238,15 @@ bool LightBoxInterface::SetLightBoxBrightness(uint16_t value)
236238
////////////////////////////////////////////////////////////////////////////////////////////////////////
237239
bool LightBoxInterface::snoop(XMLEle *root)
238240
{
239-
// If dimming not supported, we return
240-
if (!(m_Capabilities & CAN_DIM))
241+
auto deviceName = findXMLAttValu(root, "device");
242+
243+
// If dimming not supported or not our device, we return
244+
if (!(m_Capabilities & CAN_DIM) || strcmp(ActiveDeviceTP[0].getText(), deviceName))
241245
return false;
242246

243-
XMLEle *ep = nullptr;
244-
const char *propTag = tagXMLEle(root);
245-
const char *propName = findXMLAttValu(root, "name");
247+
XMLEle *ep = nullptr;
248+
auto propTag = tagXMLEle(root);
249+
auto propName = findXMLAttValu(root, "name");
246250

247251
if (!strcmp(propTag, "delProperty"))
248252
return false;
@@ -273,6 +277,7 @@ bool LightBoxInterface::snoop(XMLEle *root)
273277
if (isDifferent)
274278
{
275279
m_DefaultDevice->deleteProperty(FilterIntensityNP);
280+
FilterIntensityNP.resize(0);
276281
}
277282
else
278283
return false;

0 commit comments

Comments
 (0)