/// <summary>Resets the trigger-related parameters so other camera clients can acquire images without the need of adjusting camera.</summary> static void ResetDeviceSetup(int handle) { if (!string.IsNullOrEmpty(defaultTriggerSelector)) { GenICam.GenApi_SetEnumParam(handle, "TriggerSelector", defaultTriggerSelector, true); } if (!string.IsNullOrEmpty(defaultTriggerSource)) { GenICam.GenApi_SetEnumParam(handle, "TriggerSource", defaultTriggerSource, true); } if (!string.IsNullOrEmpty(defaultTriggerMode)) { GenICam.GenApi_SetEnumParam(handle, "TriggerMode", defaultTriggerMode, true); } }
/// <summary> /// <para>Setups and verifies capabilities of general camera device of unknown type for this demo. Usually /// application should be created for specific device or device class, some of this setup and verification is /// not obligatory.</para> /// <para>Device parameter setup is based on GenICam SFNC standard.</para> /// </summary> static void SetupDevice(int handle) { Console.WriteLine("Setting up device..."); // Device parameter setup is based on GenICam SFNC standard. // When selector is available, select "FrameStart" trigger in device. This parameter // must be set first because it determines what further parameters point to. if (GenICam.GenApi_GetParamExists(handle, "TriggerSelector")) { GenICam.GenApi_GetEnumParam(handle, "TriggerSelector", true, out defaultTriggerSelector); GenICam.GenApi_SetEnumParam(handle, "TriggerSelector", "FrameStart", true); } // Setup device so that it waits for software command to trigger new frame. GenICam.GenApi_GetEnumParam(handle, "TriggerSource", true, out defaultTriggerSource); GenICam.GenApi_SetEnumParam(handle, "TriggerSource", "Software", true); // Verify that command for software trigger exists. if (!GenICam.GenApi_GetParamExists(handle, "TriggerSoftware")) { throw new MemberAccessException("Command \"TriggerSoftware\" is not defined by device description."); } // Enable trigger if (GenICam.GenApi_GetParamExists(handle, "TriggerMode")) { GenICam.GenApi_GetEnumParam(handle, "TriggerMode", true, out defaultTriggerMode); GenICam.GenApi_SetEnumParam(handle, "TriggerMode", "On", true); } // Set acquisition mode to continuous - device should continue to // wait for triggers after each frame capture. GenICam.GenApi_SetEnumParam(handle, "AcquisitionMode", "Continuous", true); // If this device has automatic exposure, turn it off - we will be controlling // this parameter manually. if (GenICam.GenApi_GetParamExists(handle, "ExposureAuto")) { GenICam.GenApi_SetEnumParam(handle, "ExposureAuto", "Off", false); } // Set initial exposure value (this will also verify, if parameter is available). GenICam.GenApi_SetFloatParam(handle, "ExposureTimeAbs", 15000, true); }