private void Open() { if (device != null) { Close(); } bool open = false; try { device = igxFactory.OpenDeviceBySN(summary.Identifier, GX_ACCESS_MODE.GX_ACCESS_EXCLUSIVE); featureControl = device.GetRemoteFeatureControl(); DahengHelper.AfterOpen(featureControl); open = true; } catch { log.DebugFormat("Could not open Daheng device."); } if (!open) { return; } SpecificInfo specific = summary.Specific as SpecificInfo; if (specific == null) { return; } // Store the camera object into the specific info so that we can retrieve device informations from the configuration dialog. specific.Device = device; if (firstOpen) { // Grab current values. Dictionary <string, CameraProperty> cameraProperties = CameraPropertyManager.Read(device); specific.CameraProperties = cameraProperties; } else { CameraPropertyManager.WriteCriticalProperties(device, specific.CameraProperties); } try { stream = device.OpenStream(0); } catch { log.DebugFormat("Could not start Daheng device."); } }
private void Open() { if (device != null) { Close(); } bool open = false; try { device = igxFactory.OpenDeviceBySN(summary.Identifier, GX_ACCESS_MODE.GX_ACCESS_EXCLUSIVE); featureControl = device.GetRemoteFeatureControl(); DahengHelper.AfterOpen(featureControl); open = true; } catch { log.DebugFormat("Could not open Daheng device."); } if (!open) { return; } SpecificInfo specific = summary.Specific as SpecificInfo; if (specific == null) { return; } // Store the camera object into the specific info so that we can retrieve device informations from the configuration dialog. specific.Device = device; isColor = DahengHelper.IsColor(featureControl); if (firstOpen) { // Always default to RGB24 for color cameras and Y800 for mono cameras. // Raw mode will have to be switched explicitly everytime for now. currentStreamFormat = isColor ? DahengStreamFormat.RGB : DahengStreamFormat.Mono; // Grab current values. Dictionary <string, CameraProperty> cameraProperties = CameraPropertyManager.Read(device); specific.CameraProperties = cameraProperties; specific.StreamFormat = currentStreamFormat; } else { CameraPropertyManager.WriteCriticalProperties(device, specific.CameraProperties); if (specific.StreamFormat != currentStreamFormat) { currentStreamFormat = specific.StreamFormat; } } try { stream = device.OpenStream(0); } catch { log.Debug("Could not start Daheng device."); } }