File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,26 @@ std::vector<std::shared_ptr<Device> > Interface::getDevices()
160160 // update available interfaces
161161
162162 GenTL::GC_ERROR err=gentl->IFUpdateDeviceList (ifh, 0 , 100 );
163+
164+ if (err == GenTL::GC_ERR_INVALID_HANDLE)
165+ {
166+ // the interface handle is invalid, try to reopen the interface
167+
168+ if (gentl->TLUpdateInterfaceList (parent->getHandle (), 0 , 10 ) != GenTL::GC_ERR_SUCCESS)
169+ {
170+ throw GenTLException (std::string (" Interface::getDevices() (recovery 1) " )+id, gentl);
171+ }
172+
173+ if (gentl->TLOpenInterface (parent->getHandle (), id.c_str (), &ifh) != GenTL::GC_ERR_SUCCESS)
174+ {
175+ throw GenTLException (std::string (" Interface::getDevices() (recovery 2) " )+id, gentl);
176+ }
177+
178+ // try to repeat discovery of devices
179+
180+ err=gentl->IFUpdateDeviceList (ifh, 0 , 100 );
181+ }
182+
163183 if (err != GenTL::GC_ERR_SUCCESS)
164184 {
165185 throw GenTLException (std::string (" Interface::getDevices() (1) " )+id+" " +std::to_string (err), gentl);
You can’t perform that action at this time.
0 commit comments