示例#1
0
        /* Some features are floating point features. This function illustrates how to set and get floating
         * point parameters. */
        private static void demonstrateFloatFeature(PYLON_DEVICE_HANDLE hDev)
        {
            string featureName = "Gamma";  /* The name of the feature used. */
            bool   isAvailable;            /* Is the feature available? */
            bool   isWritable;             /* Is the feature writable? */
            double min, max, value;        /* Value range and current value. */

            isAvailable = Pylon.DeviceFeatureIsAvailable(hDev, featureName);

            if (isAvailable)
            {
                /* Query the value range and the current value. */
                min   = Pylon.DeviceGetFloatFeatureMin(hDev, featureName);
                max   = Pylon.DeviceGetFloatFeatureMax(hDev, featureName);
                value = Pylon.DeviceGetFloatFeature(hDev, featureName);

                Console.WriteLine("{0}: min = {1}, max = {2}, value = {3}", featureName, min, max, value);

                /* Set a new value. */
                isWritable = Pylon.DeviceFeatureIsWritable(hDev, featureName);
                if (isWritable)
                {
                    value = 0.5 * (min + max);
                    Console.WriteLine("Setting {0} to {1}.", featureName, value);
                    Pylon.DeviceSetFloatFeature(hDev, featureName, value);
                }
            }
            else
            {
                Console.WriteLine("The {0} feature isn't available.", featureName);
            }
        }