From f51a95ce3498eff91427d31faeb58901bcfed566 Mon Sep 17 00:00:00 2001 From: Nico Stuurman Date: Fri, 22 Nov 2024 09:50:18 -0800 Subject: [PATCH] openCV: Now backward compatible with oprevious config files. --- DeviceAdapters/OpenCVgrabber/OpenCVgrabber.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DeviceAdapters/OpenCVgrabber/OpenCVgrabber.cpp b/DeviceAdapters/OpenCVgrabber/OpenCVgrabber.cpp index 4751bd195..4d8f581a3 100644 --- a/DeviceAdapters/OpenCVgrabber/OpenCVgrabber.cpp +++ b/DeviceAdapters/OpenCVgrabber/OpenCVgrabber.cpp @@ -177,9 +177,8 @@ COpenCVgrabber::COpenCVgrabber() : AddAllowedValue(cIDName, devices.at(i).deviceName.c_str()); } } - else { - AddAllowedValue(cIDName, "Undefined"); - } + // when no devices are found and for backward compatibility, allow the Undefined value + AddAllowedValue(cIDName, "Undefined"); #else String cIDNameReally = "Camera Number"; CPropertyAction* pAct = new CPropertyAction(this, &COpenCVgrabber::OnCameraID); @@ -1097,8 +1096,8 @@ int COpenCVgrabber::OnCameraID(MM::PropertyBase* pProp, MM::ActionType eAct) return DEVICE_OK; } } + pProp->Set("Undefined"); } - return DEVICE_NOT_CONNECTED; #else if (eAct == MM::AfterSet) {