Skip to content

Commit 72cb8f6

Browse files
committed
Add get/set enabled status for CompositeDevice
1 parent 4379009 commit 72cb8f6

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Source/OnixDevice.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,41 @@ bool CompositeDevice::compareIndex(uint32_t index)
256256
return false;
257257
}
258258

259+
bool CompositeDevice::isEnabled(uint32_t index)
260+
{
261+
for (const auto& device : devices)
262+
{
263+
if (device->compareIndex(index))
264+
return device->isEnabled();
265+
}
266+
267+
Onix1::showWarningMessageBoxAsync(
268+
"Unknown Index",
269+
"Could not get the enabled status of a device at index " + std::to_string(index) + ", it was not found in " + getName()
270+
);
271+
272+
return false;
273+
}
274+
275+
void CompositeDevice::setEnabled(uint32_t index, bool newState)
276+
{
277+
for (const auto& device : devices)
278+
{
279+
if (device->compareIndex(index))
280+
{
281+
device->setEnabled(newState);
282+
return;
283+
}
284+
}
285+
286+
Onix1::showWarningMessageBoxAsync(
287+
"Unknown Index",
288+
"Could not set the enabled status of a device at index " + std::to_string(index) + ", it was not found in " + getName()
289+
);
290+
291+
return;
292+
}
293+
259294
int CompositeDevice::configureDevice()
260295
{
261296
int result = ONI_ESUCCESS;

Source/OnixDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ namespace OnixSourcePlugin
246246
CompositeDeviceType getCompositeDeviceType() const;
247247

248248
bool compareIndex(uint32_t index) override;
249+
bool isEnabled(uint32_t index);
250+
void setEnabled(uint32_t index, bool newState);
249251
int configureDevice() override;
250252
bool updateSettings() override;
251253
void startAcquisition() override;

0 commit comments

Comments
 (0)