示例#1
0
        /* Some features are boolean features that can be switched on and off.
         * This function illustrates how to access boolean features. */
        private static void demonstrateBooleanFeature(PYLON_DEVICE_HANDLE hDev)
        {
            string featureName = "GammaEnable"; /* The name of the feature. */
            bool   isWritable;                  /* Is the feature writable? */
            bool   value;                       /* The value of the feature. */

            /* Check to see if the feature is writable. */
            isWritable = Pylon.DeviceFeatureIsWritable(hDev, featureName);

            if (isWritable)
            {
                /* Retrieve the current state of the feature. */
                value = Pylon.DeviceGetBooleanFeature(hDev, featureName);

                Console.WriteLine("The {0} features is {1}.", featureName, value ? "on" : "off");

                /* Set a new value. */
                value = !value;  /* New value. */
                Console.WriteLine("Switching the {0} feature {1}.", featureName, value ? "on" : "off");
                Pylon.DeviceSetBooleanFeature(hDev, featureName, value);
            }
            else
            {
                Console.WriteLine("The {0} feature isn't writable.", featureName);
            }
        }